TLDR

  • Geth and Erigon share most Ethereum JSON-RPC API calls but differ in some advanced functionality.
  • Geth provides a few extra methods for mining and wallet-bound calls (e.g., eth_sendTransaction), while Erigon supports others like eth_getBlockReceipts and unique debugging/trace methods.
  • Identify which client your provider runs to ensure compatibility and avoid missing methods.
  • Explore the Chainstack API reference for more detail and use web3_clientVersion to check your client programmatically.

Main article

The JSON-RPC API is an essential tool for blockchain development as it provides a standardized way to interact with blockchain networks through HTTP or WebSocket connections. At the time of writing, there are seven clients for Ethereum, which is a great achievement in terms of decentralization. However, this can cause a problem for developers because different clients often implement different RPC API sets, leading to confusion.

For example, if your DApp was developed on Erigon and you plan to switch to a new RPC provider running Geth, it’s possible that the core API used in your application won’t be available on the new node. To avoid compatibility issues, it’s important to identify the current client you’re using and the available API methods.

This article compares the available RPC APIs for two Ethereum clients, Erigon and Geth, that are available on Chainstack. It is important to note that all tests were performed using Erigon version 2.42 and Geth version 1.11.5, which were the most up-to-date versions as of May 2023. It is possible that there may be changes in the future.

Find what client your node is running

With Chainstack, you can easily view this information in the console. However, if you prefer a programmatic approach, consider using the web3_clientVersion method. This RPC method returns the client version as a response.

Discover how to use web3_clientVersion and explore code examples in the Ethereum node API reference.

Standard Ethereum JSON RPC methods available

The Ethereum JSON-RPC is a standard collection of methods that all execution clients must implement. The detailed specification can be found in the Ethereum documentation.

Most of the standard methods are implemented in both Geth and Erigon. However, the Erigon team has either deprecated or not implemented a few of them.

Methods available on both Erigon and Geth

eth_blockNumbereth_syncingeth_gasPriceeth_maxPriorityFeePerGas
eth_feeHistoryeth_getBlockTransactionCountByHasheth_getUncleCountByBlockHasheth_getUncleCountByBlockNumber
eth_getTransactionByHasheth_getTransactionByBlockHashAndIndexeth_getTransactionByBlockNumberAndIndexeth_getTransactionReceipt
eth_estimateGaseth_getBalanceeth_getCodeeth_getTransactionCount
eth_getStorageAteth_calleth_createAccessListeth_newFilter
eth_newBlockFiltereth_newPendingTransactionFiltereth_getFilterLogseth_getFilterChanges
eth_uninstallFiltereth_getLogseth_sendRawTransaction

Check the Chainstack Ethereum node API reference to learn how these methods work.

Standard methods available on Geth only

eth_accountseth_sendTransactioneth_signeth_signTransaction
eth_miningeth_hashrateeth_getWorketh_submitWork
eth_submitHashrateeth_signeth_signTransactioneth_getProof
eth_sendTransactiondebug_getRawBlockdebug_getRawTransactiondebug_getRawReceipts
debug_getRawHeaderdebug_getBadBlocks

The following methods require the client to be associated with a wallet address. They are either deprecated or not implemented by Erigon.

  • eth_accounts
  • eth_sendTransaction
  • eth_sign
  • eth_signTransaction

The following methods are only available in miner mode:

  • eth_mining
  • eth_hashrate
  • eth_getWork
  • eth_submitWork
  • eth_submitHashrate

Non-standard methods available on both Geth and Erigon

In addition to the standard methods, Geth and Erigon implement their own RPC methods. Erigon was originally a fork of Geth, so both clients share the majority of the RPC APIs.

eth_subscribeeth_unsubscribe
web3_clientVersionweb3_sha3
txpool_contenttxpool_status
net_listeningnet_peerCountnet_version
eth_getUncleByBlockHashAndIndexeth_getUncleByBlockNumberAndIndexeth_getRawTransactionByHash
eth_getRawTransactionByBlockHashAndIndexeth_getRawTransactionByBlockNumberAndIndexeth_createAccessList
debug_accountRangedebug_getModifiedAccountsByNumberdebug_getModifiedAccountsByHash
debug_traceBlockByNumberdebug_traceBlockByHashdebug_traceTransaction
debug_storageRangeAtdebug_traceCall

The eth_subscribe and eth_unsubscribe RPC methods, available exclusively through WebSocket Secure (WSS), allow subscribing to real-time data streams for events like new blocks and pending transactions.

The web3_clientVersion function delivers client information, while web3_sha3 calculates the Keccak hash for a given string.

Utilize txpool_content and txpool_status RPC methods for accessing transactions in the mempool.

RPC methods within the net namespace facilitate the monitoring of a node’s P2P status.

Leveraging non-standard methods in the eth namespace is advantageous for obtaining extra information that is not accessible via standard RPC methods but is highly valuable for developers.

The debug methods are designed for advanced users and fulfill a range of purposes, including gathering execution traces for single or multiple transactions.

Non-standard methods available on Geth only

txpool_contentFromtxpool_inspect
debug_backtraceAtdebug_blockProfiledebug_chaindbCompactdebug_chaindbProperty
debug_cpuProfiledebug_dbAncientdebug_dbAncientsdebug_dbGet
debug_dumpBlockdebug_freeOSMemorydebug_freezeClientdebug_gcStats
debug_getAccessibleStatedebug_getBadBlocksdebug_getRawBlockdebug_getRawHeader
debug_getRawTransactiondebug_getRawReceiptsdebug_goTracedebug_intermediateRoots
debug_memStatsdebug_mutexProfiledebug_preimagedebug_printBlock
debug_seedHashdebug_setBlockProfileRatedebug_setGCPercentdebug_setHead
debug_setMutexProfileFractiondebug_setTrieFlushIntervaldebug_stacksdebug_standardTraceBlockToFile
debug_standardTraceBadBlockToFiledebug_startCPUProfiledebug_startGoTracedebug_stopCPUProfile
debug_stopGoTracedebug_traceBadBlockdebug_traceBlockdebug_traceBlockFromFile
debug_traceChaindebug_verbositydebug_vmoduledebug_writeBlockProfile
debug_writeMemProfiledebug_writeMutexProfile

Geth provides two additional methods in the txpool namespace: txpool_contentFrom and txpool_inspect. txpool_contentFrom retrieves the transactions contained within the txpool, and txpool_inspect lists a textual summary of all transactions.

In addition, Geth exposes many execution-time node tuning through the debug namespace. Some of these methods are destructive to the node itself so it should be used with caution. For example:

  • debug_freezeClient forces a temporary client freeze.
  • debug_setHead sets the current head of the local chain by block number.
  • debug_setTrieFlushInterval configures how often in-memory state tries are persisted to disk. If this value is set to 0, the node will essentially turn into an archive node.

Geth also provides handy trace methods in the debug namespace. If you are interested in how they work, the guide Deep Dive into Ethereum debug_trace APIs may be useful for you.

Non-standard methods available on Erigon only

eth_getBlockReceiptseth_protocolVersioneth_callManyeth_callBundle
debug_accountAtdebug_traceCallMany
trace_calltrace_callManytrace_rawTransactiontrace_replayBlockTransactions
trace_replayTransactiontrace_blocktrace_filtertrace_get
trace_transaction
erigon_getHeaderByHasherigon_getBlockReceiptsByBlockHasherigon_getHeaderByNumbererigon_getLogsByHash
erigon_forkserigon_getBlockByTimestamperigon_BlockNumbererigon_getLatestLogs

Erigon inherits some debug and trace methods from Nethermind and Flashbot, which provides more possibilities than a Geth node.

For example, debug_traceCallMany and trace_callMany are handy methods that don’t exist on Geth. These two methods perform the same function, allowing users to send multiple transactions in a batch to oversee their execution. The transactions are executed in sequence, with each transaction depending on the resulting state of the previous transactions.

Last but not least

If you would like to learn more about how these methods work in detail, you can visit Chainstack’s API documentation. Additionally, there is a Chainstack Postman collection for you to try out these RPC methods.

Hope this article is helpful for you. If you have any questions, feel free to ping me on my social media or in Chainstack’s Telegram or Discord.

Happy coding, cheers!

About the author

xCKUgveS_400x400

Wuzhong Zhu

Developer Advocate @ Chainstack

BUIDLs on Ethereum, zkEVMs, The Graph protocol, and IPFS