본문으로 건너뛰기
이 페이지는 영어로 된 기계 번역을 사용하므로 오류나 불명확한 언어가 포함될 수 있습니다. 가장 정확한 정보는 영어 원문을 참조하시기 바랍니다. 잦은 업데이트로 인해 일부 콘텐츠는 원래 영어로 되어 있을 수 있습니다. Crowdin에서 이 페이지의 번역을 개선하는 데 동참하여 도움을 주세요. (Crowdin translation page, Contributing guide)

[Transaction] klay_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 Kaia Virtual Machine mechanics and node performance.

JSONRPC: klay_estimateGas

Request

Body

    params

    undefined[]

    required

  • 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

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...
페이지를 개선해 주세요