eth_subscribe, eth_unsubscribe
These methods are used for real-time events through subscriptions. See the subscription documentation for more information.eth_call
Executes a new message call immediately, without creating a transaction on the block chain. The eth_call method can be used to query internal contract state, to execute validations coded into a contract or even to test what the effect of a transaction would be without running it live.Parameters
The method takes 3 parameters: an unsigned transaction object to execute in read-only mode; the block number to execute the call against; and an optional state override-set to allow executing the call against a modified chain state.1. Object - Transaction call object
The transaction call object is mandatory.2. Quantity | Tag - Block number or the string latest or pending
The block number is mandatory and defines the context (state) against which the specified transaction should be executed. It is not possible to execute calls against reorged blocks; or blocks older than 128 (unless the node is an archive node).3. Object - State override set
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. Each address maps to an object containing:FIELD | TYPE | BYTES | OPTIONAL | DESCRIPTION |
---|---|---|---|---|
balance | Quantity | <32 | Yes | Fake balance to set for the account before executing the call. |
nonce | Quantity | <8 | Yes | Fake nonce to set for the account before executing the call. |
code | Binary | any | Yes | Fake EVM bytecode to inject into the account before executing the call. |
state | Object | any | Yes | Fake key-value mapping to override all slots in the account storage before executing the call. |
stateDiff | Object | any | Yes | Fake key-value mapping to override individual slots in the account storage before executing the call. |
- It can be used by DApps to reduce the amount of contract code needed to be deployed on chain. Code that simply returns internal state or does pre-defined validations can be kept off chain and fed to the node on-demand.
- It can be used for smart contract analysis by extending the code deployed on chain with custom methods and invoking them. This avoids having to download and reconstruct the entire state in a sandbox to run custom code against.
- It can be used to debug smart contracts in an already deployed large suite of contracts by selectively overriding some code or state and seeing how execution changes. Specialized tooling will probably be necessary.
eth_createAccessList
This method creates an EIP2930 type accessList based on a given Transaction. The accessList contains all storage slots and addresses read and written by the transaction, except for the sender account and the precompiles. This method uses the same transaction call object and blockNumberOrTag object as eth_call. An accessList can be used to unstuck contracts that became inaccessible due to gas cost increases. ParametersFIELD | TYPE | DESCRIPTION |
---|---|---|
transaction | Object | TransactionCall object |
blockNumberOrTag | Object | Optional, blocknumber or latest or pending |
eth_getHeaderByNumber
Returns a block header. ParametersFIELD | TYPE | DESCRIPTION |
---|---|---|
blockNumber | Quantity | Block number |
curl localhost:8545 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getHeaderByNumber","params":["0x10823a8"],"id":0}'
Response
eth_getHeaderByHash
Returns a block header. ParametersFIELD | TYPE | DESCRIPTION |
---|---|---|
blockHash | string | Block hash |