# Running the Server
Learn how to run and setup the JSON-RPC server on Evmos.
Important: You cannot use all JSON RPC methods unless your node stores the entire copy of the blockchain locally. Do you need archives/snapshots of our networks? Go to this section (opens new window).
# Introduction
JSON-RPC is provided on multiple transports. Evmos supports JSON-RPC over HTTP and WebSocket.
# Requirements
We recommend to use the server with minimum 8-core CPU and 64gb of RAM. You must have ports 8545 and 8546 open on your firewall.
# Enable Server
To enable RPC server use the following flag (set to true by default).
# Defining Namespaces
Eth
,Net
and Web3
namespaces are enabled by default,
but for the JSON-RPC you need to add more namespaces.
In order to enable other namespaces edit app.toml
file.
# Set a Gas Cap
eth_call
and eth_estimateGas
define a global gas cap over rpc for DoS protection.
You can override the default gas cap value of 25,000,000 by passing a custom value in app.toml
:
# CORS
If accessing the RPC from a browser, CORS will need to be enabled with the appropriate domain set. Otherwise, JavaScript calls are limit by the same-origin policy and requests will fail.
The CORS setting can be updated from the app.toml
# Pruning
For all methods to work correctly, your node must be archival (store the entire copy of the blockchain locally).
Pruning must be disabled.
The pruning settings can be updated from the app.toml
# WebSocket Server
Websocket is a bidirectional transport protocol. A Websocket connection is maintained by client and server until it is explicitly terminated by one. Most modern browsers support Websocket which means it has good tooling.
Because Websocket is bidirectional, servers can push events to clients.
That makes Websocket a good choice for use-cases involving event subscription.
Another benefit of Websocket is that after the handshake procedure, the overhead of individual messages is low,
making it good for sending high number of requests.
The WebSocket Server can be enabled from the app.toml
# ETH Tx Indexer
The ETH Tx Indexer provides an optional indexer services for Ethereum transactions to optimize JSON RPC performance. This removes the need for Tendermint Tx Indexer to support RPCs which reduces considerably storage costs.
# Enable Indexer
To enable the ETH Indexer run the following command
# Index Historical Transactions
If the chain had already started and you need the ETH Indexer to catch up on old transactions,
you could run the index-eth-tx
command to index historical ETH transactions.
After the eth indexer has finished catching up, the Tendermint indexer can be disabled for JSON RPC support.
If you need to index transactions from the last indexed block to the top of the chain, you can run
# Eth Tx Indexer and State sync
If setting up a node with state sync, you need to first start the node and index at least one block before turning on the eth tx indexer.