본문으로 건너뛰기
This page uses machine translation from English, which may contain errors or unclear language. For the most accurate information, please see the original English version. Some content may be in the original English due to frequent updates. Help us improve this page's translation by joining our effort on Crowdin. (Crowdin translation page, Contributing guide)

[Transaction] eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

JSONRPC: eth_estimateGas

Request

Body

    params

    undefined[]

  • Array [

  • CallObject

    object

    The transaction call object. See the next table for the object's properties.

    from 20-byte DATA

    (optional) The address the transaction is sent from.

    to 20-byte DATA

    (optional when testing the deployment of a new contract) The address the transaction is directed to.

    gas hex

    (optional) Integer of the gas provided for the transaction execution. kaia_call consumes zero gas, but this parameter may be needed by some executions.

    gasPrice hex

    (optional) Integer of the gasPrice used for each paid gas.

    value hex

    (optional) Integer of the value sent with this transaction.

    input DATA

    (optional) Hash of the method signature and encoded parameters. It replaces data field, but 'data` field is still supported for backward compatibility.

    BlockNumberOrHashOrTag

    object

    oneOf

    the block number with type integer

    number

    StateOverrideSet

    object

    The state override set is an optional address-to-state mapping, where each entry specifies some state to be ephemerally overridden prior to executing the call.

    balance int64

    (optional) Fake balance to set for the account before executing the call.

    nonce int64

    (optional) Fake nonce to set for the account before executing the call.

    code DATA

    (optional) Fake EVM bytecode to inject into the account before executing the call.

    state object

    (optional) Fake key-value mapping to override all slots in the account storage before executing the call.

    stateDiff object

    (optional) Fake key-value mapping to override individual slots in the account storage before executing the call.

  • ]

Responses

Return the amount of gas used.

Schema

    error

    object

    code int64required

    A Number that indicates the error type that occurred. This MUST be an integer.

    codemessagedescription
    -32700Parse errorinvalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
    -32602Invalid paramsInvalid method parameter(s).
    message string

    A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.

    data string

    A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).

    result hex

    The amount of gas used.

Loading...
페이지를 개선해 주세요