Skip to content

Latest commit

 

History

History
118 lines (95 loc) · 17 KB

rpc-api.md

File metadata and controls

118 lines (95 loc) · 17 KB

As an implementation of HIP 419, the Hedera JSON RPC Relay provides some Ethereum JSON-RPC APIs which implement the JSON-RPC 2.0 Specification to support Ethereum tools interacting with Hedera nodes e.g. wallets, developer tools.

Requests

Requests to the Relay will take the form of HTTP calls to an endpoints method. A curl example to the eth_chainId takes the form Request

  curl ${RELAY_ENDPOINT_URL} -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":"2","method":"eth_chainId","params":[null]}'

Where

  • RELAY_ENDPOINT_URL - HTTP url endpoint, default http://localhost:7546

Result Schema

Result responses can take the form of success or error.

Success Response

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

Error Response

{
  "id": 2,
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid params"
  }
}

The values can range from regular data types (String, int, array) to defined Ethereum objects such as:

Endpoints

The JSON RPC Relay methods implements a subset of the standard method:

Endpoint Table

Below is a table of provided methods.

Method Static Response Value Hedera Nodes (Relay Only, Mirror Node, Consensus Node, Both Nodes)
eth_accounts [] N/A
eth_blockNumber N/A Mirror Node
eth_call N/A Consensus Node
eth_chainId Chain_ID Relay Only
eth_coinbase -32601 (Method not found) N/A
eth_estimateGas Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
eth_feeHistory N/A Mirror Node, Consensus Node backup
eth_gasPrice N/A Mirror Node, Consensus Node backup
eth_getBalance N/A Mirror Node
eth_getBlockByHash Note that stateRoot value returned is always zero. Mirror Node
eth_getBlockByNumber Note that stateRoot value returned is always zero. Mirror Node
eth_getBlockTransactionCountByHash N/A Mirror Node
eth_getBlockTransactionCountByNumber N/A Mirror Node
eth_getCode N/A Mirror Node, Consensus Node backup
eth_getFilterLogs N/A Mirror Node
eth_getFilterChanges N/A Mirror Node
eth_getLogs N/A Mirror Node
eth_getStorageAt N/A Mirror Node
eth_getTransactionByBlockHashAndIndex N/A Mirror Node
eth_getTransactionByBlockNumberAndIndex N/A Mirror Node
eth_getTransactionByHash N/A Mirror Node
eth_getTransactionCount N/A Mirror Node, Consensus Node backup
eth_getTransactionReceipt N/A Mirror Node
eth_getUncleByBlockHashAndIndex null N/A
eth_getUncleByBlockNumberAndIndex null N/A
eth_getUncleCountByBlockHash null N/A
eth_getUncleCountByBlockNumber 0x0 N/A
eth_getWork -32601 (Method not found) N/A
eth_hashrate 0x0 N/A
eth_maxPriorityFeePerGas 0x0 N/A
eth_mining false N/A
eth_newBlockFilter N/A N/A
eth_newFilter N/A N/A
eth_pendingTransactionFilter -32601 (Method not found) N/A
eth_protocolVersion -32601 (Method not found) N/A
eth_sendRawTransaction N/A Consensus Node
eth_sendTransaction -32601 (Method not found) N/A
eth_signTransaction -32601 (Method not found) N/A
eth_sign -32601 (Method not found) N/A
eth_submitHashrate -32601 (Method not found) N/A
eth_submitWork false N/A
eth_syncing false N/A
eth_uninstallFilter true/false Relay only
net_listening false N/A
net_version Chain_ID Relay Only
web3_clientVersion relay/<semanticVersion> Relay Only

Live events API

Details for the Real-Time Events API can be found here

Open RPC Spec

The detailed schema specifications of the current methods offerred by the JSON RPC relay is captured in our Open RPC Specification