Compare Geth and Erigon execution client RPC method support, performance characteristics, and debug/trace API differences on Chainstack Ethereum nodes.
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.
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.
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.
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.
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_subscribe
eth_unsubscribe
web3_clientVersion
web3_sha3
txpool_content
txpool_status
net_listening
net_peerCount
net_version
eth_getUncleByBlockHashAndIndex
eth_getUncleByBlockNumberAndIndex
eth_getRawTransactionByHash
eth_getRawTransactionByBlockHashAndIndex
eth_getRawTransactionByBlockNumberAndIndex
eth_createAccessList
debug_accountRange
debug_getModifiedAccountsByNumber
debug_getModifiedAccountsByHash
debug_traceBlockByNumber
debug_traceBlockByHash
debug_traceTransaction
debug_storageRangeAt
debug_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.
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.
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.
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!