Transactions API
What gas limit does this transaction need?
The gas limit to sign an unsigned EVM transaction with, estimated against the latest state, or why it would revert or cannot be paid for.
/api/external/transaction-analysis/gas-limit-estimate/{chain}What it returns
Asks the chain for the gas limit to sign an unsigned transaction with, run against the latest state. Answers the limit when the transaction would succeed; otherwise whether it would revert, with the revert reason, or could not run because the sender cannot pay the value sent plus gas. The limit is the chain's own estimate, usually above the gas the run uses, and holds only for the state it ran against: the next block can change it. No signature, nonce or fee is checked.
Chains
- BNB Chain BNB
- Ethereum ETH
- Stable STABLE
- Base BASE
- Robinhood Chain RHC
- Arc ARC
Request
Send your key in the x-dex-data-key header. Replace each <placeholder> with a real value.
curl -X POST -H "x-dex-data-key: $DEXDATA_API_KEY" \
-H "content-type: application/json" \
-d '{"from":"<from>","to":"<to>","data":"<data>","value":"<value>"}' \
"https://api.dexdata.io/api/external/transaction-analysis/gas-limit-estimate/BNB"| Parameter | Description |
|---|---|
chainpath · string · required | ETH, BNB, BASE, STABLE, ARC or RHC; every other chain returns 400. |
frombody · string · optional | Required: the sending wallet, 0x followed by 40 hexadecimal characters. |
tobody · string · optional | Required: the recipient or contract called, 0x followed by 40 hexadecimal characters. |
databody · string · optional | The calldata, 0x-prefixed hex of whole bytes. Optional; defaults to 0x (a plain transfer). |
valuebody · string · optional | Native coin sent, in wei, as a decimal string. Optional; defaults to "0". |
Response fields
A JSON response. Every field is always present; null means the value could not be established, never zero.
| Field | Type | Description |
|---|---|---|
outcome | string | success: the transaction would run, and gasLimit is the limit it needs. reverted: it would fail, so no limit is given. insufficient-funds: the sender does not hold the value sent plus gas, so it could not run at all. |
gasLimit | integer | null | The gas limit the chain estimates the transaction needs. null unless the outcome is success. |
revertReason | string | null | The contract's revert message, decoded from the revert data when it is a standard text error, or Panic(0x..) for a failed assertion or arithmetic error. null when the transaction does not revert, or reverts with a custom error or with no data — read revertData for a custom error. |
revertData | string | null | The raw revert data, lowercase hex, for decoding a custom error. null when the transaction does not revert or reverts with no data. |
Start building with DexData today
Sign in, create a key and make your first call in a minute. Free credits every month, and you only pay for calls that succeed.
Get a free API key