Skip to content

Latest commit

 

History

History
101 lines (85 loc) · 10.1 KB

rpc-api.md

File metadata and controls

101 lines (85 loc) · 10.1 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 N/A
eth_estimateGas N/A Both Nodes
eth_feeHistory N/A Both Nodes
eth_gasPrice N/A Both Nodes
eth_getBalance N/A Consensus Node
eth_getBlockByHash N/A Mirror Node
eth_getBlockByNumber N/A Mirror Node
eth_getBlockTransactionCountByHash N/A Mirror Node
eth_getBlockTransactionCountByNumber N/A Mirror Node
eth_getLogs 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
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 N/A
eth_hashrate 0x0 N/A
eth_maxPriorityFeePerGas 0x0 N/A
eth_mining false N/A
eth_protocolVersion -32601 N/A
eth_sendRawTransaction N/A Consensus Node
eth_sendTransaction -32601 N/A
eth_signTransaction -32601 N/A
eth_sign -32601 N/A
eth_submitHashrate -32601 N/A
eth_submitWork false N/A
eth_syncing false N/A
net_listening false N/A
net_version Chain_ID Relay Only
web3_clientVersion relay/<semanticVersion> Relay Only

Open RPC Spec

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