Search
⌘K
BNB Chain
Methods
debug_getBadBlocks
debug_getRawBlock
debug_getRawHeader
debug_getRawReceipts
debug_getRawTransaction
debug_traceBlockByHash
debug_traceBlockByNumber
debug_traceCall
debug_traceTransaction
eth_accounts
eth_baseFee
eth_blobBaseFee
eth_blockNumber
eth_call
eth_callMany
eth_chainId
eth_coinbase
eth_createAccessList
eth_estimateGas
eth_feeHistory
eth_gasPrice
eth_getAccount
eth_getBalance
eth_getBlockByHash
eth_getBlockByNumber
eth_getBlockReceipts
eth_getBlockTransactionCountByHash
eth_getBlockTransactionCountByNumber
eth_getCode
eth_getFilterChanges
eth_getFilterLogs
eth_getLogs
eth_getProof
eth_getStorageAt
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockNumberAndIndex
eth_getTransactionByHash
eth_getTransactionCount
eth_getTransactionReceipt
eth_getUncleByBlockHashAndIndex
eth_getUncleByBlockNumberAndIndex
eth_getUncleCountByBlockHash
eth_getUncleCountByBlockNumber
eth_hashrate
eth_maxPriorityFeePerGas
eth_mining
eth_newBlockFilter
eth_newFilter
eth_newPendingTransactionFilter
eth_protocolVersion
eth_sendRawTransaction
eth_sendTransaction
eth_sign
eth_signTransaction
eth_simulateV1
eth_subscribe
eth_syncing
eth_uninstallFilter
eth_unsubscribe
net_listening
net_peerCount
net_version
trace_block
trace_call
trace_callMany
trace_filter
trace_get
trace_rawTransaction
trace_replayBlockTransactions
trace_replayTransaction
trace_transaction
txpool_content
web3_clientVersion
web3_sha3
Docs·APIs·Web3 RPC API·BNB Chain·Methods·eth_estimateGas

eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.

https://api.1inch.com/web3/56

Parameters

Transaction (required)

Transaction
* object
type
string
nonce
string
to
any
oneOf[0]
null
oneOf[1]
string
from
string
gas
string
value
string
input
string
gasPrice
string
maxPriorityFeePerGas
string
maxFeePerGas
string
maxFeePerBlobGas
string
accessList
array
items
object
address
* string
storageKeys
* array
items
string
additionalProperties
none
blobVersionedHashes
array
items
string
blobs
array
items
string
chainId
string
authorizationList
array
items
object
chainId
* string
nonce
* string
address
* string
yParity
* string
r
* string
s
* string
additionalProperties
none

Block

Block
any
oneOf[0]
string
oneOf[1]
string (Enum)
earliest
finalized
safe
latest
pending

Request

Request
object
jsonrpc
* string (Enum)
2.0
method
* string
params
array
items
any
oneOf[0]
object
type
string
nonce
string
to
any
oneOf[0]
null
oneOf[1]
string
from
string
gas
string
value
string
input
string
gasPrice
string
maxPriorityFeePerGas
string
maxFeePerGas
string
maxFeePerBlobGas
string
accessList
array
items
object
address
* string
storageKeys
* array
items
string
additionalProperties
none
blobVersionedHashes
array
items
string
blobs
array
items
string
chainId
string
authorizationList
array
items
object
chainId
* string
nonce
* string
address
* string
yParity
* string
r
* string
s
* string
additionalProperties
none
oneOf[1]
any
oneOf[0]
string
oneOf[1]
string (Enum)
earliest
finalized
safe
latest
pending
id
* number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const response = await fetch('https://api.1inch.com/web3/56', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${API_KEY}`,
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'eth_estimateGas',
    params: [
      {
        type: 'string',
        nonce: 'string',
        to: null,
        from: 'string',
        gas: 'string',
        value: 'string',
        input: 'string',
        gasPrice: 'string',
        maxPriorityFeePerGas: 'string',
        maxFeePerGas: 'string',
        maxFeePerBlobGas: 'string',
        accessList: [
          {
            address: 'string',
            storageKeys: ['string'],
          },
        ],
        blobVersionedHashes: ['string'],
        blobs: ['string'],
        chainId: 'string',
        authorizationList: [
          {
            chainId: 'string',
            nonce: 'string',
            address: 'string',
            yParity: 'string',
            r: 'string',
            s: 'string',
          },
        ],
      },
      'string',
    ],
    id: 1,
  }),
});

const data = await response.json();
console.log(data);

Response

Gas used

Gas used
string
JSON
1
2
"0x5208"

Did you find what you need?