eth_estimateGas
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
This method only estimates gas, the transaction will not be added to the blockchain.

Example

Command Shell
Bash
1
curl https://bsc-mainnet.web3api.com/v1/JDJJU1F4K956DP9A6ZQFHGTF1NHXEIPPDI
2
-X POST
3
-H "Content-Type: application/json"
4
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\": [{\"from\": \"0x71C7656EC7ab88b098defB751B7401B5f6d8976F\",\"to\": \"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\": \"0x30D40\",\"gasPrice\": \"0x9184e72a000\",\"value\": \"0x9184e72a\",\"data\": \"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"
Copied!
1
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
2
-H 'Content-Type: application/json' \
3
--data-raw '{"jsonrpc":"2.0","method":"eth_estimateGas","params": [{"from": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas": "0x30D40","gasPrice": "0x9184e72a000","value": "0x9184e72a","data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}],"id":1}'
Copied!
Request Parameters
TRANSACTION CALL OBJECT - A complete model transaction you intend to send, with the following information.
  1. 1.
    from: 20 Bytes - The address the transaction is sent from.
  2. 2.
    to: 20 Bytes - The address the transaction is directed to.
  3. 3.
    gas: Integer of the gas provided for the transaction execution.
  4. 4.
    gasPrice: Integer of the gasPrice used for each unit of gas paid.
  5. 5.
    value: Integer of the value sent with this transaction
  6. 6.
    data: Hash of the method signature and encoded parameters. For details see Ethereum Contract ABIs.
Last modified 4mo ago
Copy link
Contents
Example