eth_estimateGas

Returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain.

Parameters

transaction    (object)
    from       (string)
    to         (string) Required
    gas        (integer)
    gasPrice   (integer)
    value      (integer)
    data       (string)
    
blockNumber    (string)

state_override (object)
    balance    (string)
    nonce      (string)
    code       (string)
    state      (object)
    stateDiff  (integer)

Returns

quantity       (string)

Request

{
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [
    {
      "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
      "to": "0x87265f0e8b7b9b5f7e1a8e4d2c6f9a1b3e8d7c6a",
      "value": "0xde0b6b3a7640000"
    }
  ],
  "id": 1
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x5208"
}

Last updated