Geth vs Erigon: Deep dive into RPC methods on Ethereum clients
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.
APIs available on Chainstack
At Chainstack, you have the flexibility to deploy different types of nodes that best suit your needs. In general, there are six types of nodes available to choose from.
- Elastic full node (without debug and trace API), running on Geth
- Elastic archive node (without debug and trace API), running on Geth
- Elastic archive node (with debug and trace API), running on Erigon
- Dedicated full node (with debug and trace API), running on Geth
- Dedicated archive node (with debug and trace API), running on Erigon
- Dedicated archive node (with debug and trace API), running on Geth
All elastic Geth nodes come without debug and trace API. The three available API namespaces are
The Erigon node is only available when a user deploys an elastic archive node with debug and trace API. It comes with six available API namespaces:
A dedicated node is customizable. If a user wants debug APIs on a Geth node, the only choice is to deploy a dedicated Geth node. It has five available API namespaces:
If you are interested to learn more about the differences between Geth and Erigon at the architecture level, the guide Ethereum clients—Geth and Erigon will give you a good overview.
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
Check the Chainstack Ethereum node API reference to learn how these methods work.
Standard methods available on Geth only
The following methods require the client to be associated with a wallet address. They are either deprecated or not implemented by Erigon.
The following methods are only available in miner mode:
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_unsubscribe RPC methods, available exclusively through WebSocket Secure (WSS), allow subscribing to real-time data streams for events like new blocks and pending transactions.
web3_clientVersion function delivers client information, while
web3_sha3 calculates the Keccak hash for a given string.
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.
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
Geth provides two additional methods in the
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_freezeClientforces a temporary client freeze.
debug_setHeadsets the current head of the local chain by block number.
debug_setTrieFlushIntervalconfigures 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
Erigon inherits some debug and trace methods from Nethermind and Flashbot, which provides more possibilities than a Geth node.
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
Updated 11 days ago