Skip to main content
Live on testnet. These gas heuristics require fixed_gas_enabled to be set to true in the Exchange module params. This is currently enabled on testnet and will be activated on mainnet via a forthcoming governance params proposal.
This doc contains suggested gasWanted values for specific Exchange messages. Values were obtained heuristically by observing gas consumption during MsgServer execution for a transaction containing a single Msg type. Conceptually, for any transaction the following formula applies:
where ante_gas is the gas consumed during AnteHandler and the subsequent sum of msg_gas is gas consumed by MsgServer of each particular msg (highest observed ante_gas is 120_000). With fixed_gas_enabled set to true in Exchange params, the following values can be used as gasWanted in order to ensure a transaction does not run out of gas:
Note: Values assume a transaction containing a single message. Suggested gasWanted is the fixed message gas plus the 120,000 ante allowance.
For a GTB (Good Till Block) limit order, multiply the fixed message gas by 1.1 (GTBOrdersGasMultiplier), then add the ante allowance. The multiplier applies to the fixed message gas only, including the post-only variant. It does not apply to market orders or cancellations. Batch Msg types Gas for batch message types varies depending on the message content. Additionally, ante_gas scales with the number of orders (it’s estimated that 3000 gas provides for sufficient ante handler headroom). N is the number of orders.
  • MsgBatchCreateSpotLimitOrders: tx_gas = 120_000 + N x 183_000 (for 3 orders this results in 669_000)
  • MsgBatchCancelSpotOrders: tx_gas = 120_000 + N x 68_000
  • MsgBatchCreateDerivativeLimitOrders: tx_gas = 120_000 + N x 213_000
  • MsgBatchCancelDerivativeOrders: tx_gas = 120_000 + N x 83_000
  • MsgBatchCancelBinaryOptionsOrders: tx_gas = 120_000 + N x 83_000
MsgBatchUpdateOrders
For cancel all, gas is charged per order found in each listed market. Sum the order counts across markets rather than multiplying by an average. Additionally, the batch-create formulas above are for normal orders, as post-only and GTB orders are priced individually. For example, let’s suppose you want to:
  • cancel 3 spot orders in market A
  • create 2 derivative orders in market B
  • create 1 binary options post-only order in market C
  • cancel all orders in spot markets X and Y (2 orders in X and 2 orders in Y)
The resulting gas would be computed as such:
which ends up resulting in a total of 1_269_000 gas.
Last modified on October 8, 2026