Engine - Setting Max Gas + Timeouts

Engine - Setting Max Gas + Timeouts

Engine v2.0.19 improves handling of maximum gas fee overrides and introduces timeouts.

  • Smarter max gas fees: When the gas prices are high and your backend specifies a maximum gas fee, Engine delays the transaction until prices fall below your override.
  • Timeouts: Engine will drop your transaction if it isn't sent within your specified timeout.

Use cases

  • Save gas when sending periodic updates to your onchain database that can tolerate higher latency.
  • Set a timeout on your DeFi trades to avoid large changes in token prices.

Example

To specify a transfer transaction that spends up to 30 gwei of gas and tries up to 48 hours, add the following fields:

POST /backend-wallet/8453/transfer

{
  // Arguments for a transfer transaction
  "to": "0xA954fC66de1F90cFB4f29F0ABa391412406820B7",
  "amount": "0.5",
  
  // 👇 Specify these overrides based on your chain's gas settings
  "txOverrides": {
    "maxFeePerGas": "30000000000",
    "maxPriorityFeePerGas": "1000000000",
    "timeoutSeconds": 172800
  }
}
💡 Tip: It is highly recommended to set a timeout when setting a maxFeePerGas. Otherwise if gas prices don't fall, transactions may be in your queue indefinitely.

For details, see Overriding Gas Settings.


thirdweb is hiring!

The small team at thirdweb is on a mission to build the most intuitive and complete web3 platform. Our products empower over 70,000 developers each month including Shopify, AWS, Coinbase, Rarible, Animoca Brands, and InfiniGods.

See our open roles. We’d love to work with you!