📖
📖
📖
📖
EthStaker KB
English
Ask or search…
K

Configuring an RPC endpoint

This page will show you how to configure your execution client to serve HTTP RPC requests.
This will allow you to interact directly with the Ethereum network using your own node. No need to use a 3rd party service like Infura anymore!

1) Configure your execution client

You will need to add the following flags to your execution client.
Geth
Nethermind
Besu
Erigon

Required Flags

--http
--http.api eth,net,web3
--http.corsdomain '*'
Please note, configuring your --http-corsdomain as per the above example will allow anyone to use your node as an RPC endpoint. Please ensure this is also paired with the appropriate firewall rule(s) to prevent this from happening.

Optional Flags

--http.addr 0.0.0.0
--http.port 8545
This will indicate your Geth node is ready for RPC connections

Required Flags

--JsonRpc.Enabled true

Optional Flags

--JsonRpc.Port=8545
--JsonRpc.Host="127.0.0.1"
--JsonRpc.EnabledModules=[Eth,Web3,Net,Rpc]
This will indicate your Nethermind node is ready for RPC connections

Required Flags

--rpc-http-api=ETH,NET,WEB3
--rpc-http-cors-origins="*"
--rpc-http-enabled=true
Please note, configuring your --rpc-http-cors-origins as per the above example will allow anyone to use your node as an RPC endpoint. Please ensure this is also paired with the appropriate firewall rule(s) to prevent this from happening.

Optional Flags

--rpc-http-host=0.0.0.0
This will indicate your Besu node is ready for RPC connections

Required Flags

--http.api=eth,erigon,web3,net,debug,trace,txpool
--http.vhosts '*'
Please note, configuring your --http.vhosts as per the above example will allow anyone to use your node as an RPC endpoint. Please ensure this is also paired with the appropriate firewall rule(s) to prevent this from happening.

Optional Flags

--http #HTTP-RPC server (enabled by default). Use --http=false to disable it (default: true)
--http.addr value #HTTP-RPC server listening interface (default: "localhost")
--http.port value #HTTP-RPC server listening port (default: 8545)
This will indicate your Erigon node is ready for RPC connections

2) Configure your wallet

Now you will need a wallet that allows you to add custom RPC endpoints. You can find a list of wallets with this feature via this link.
The below example will show you how to use your RPC endpoint with Metamask as it is one of the most commonly used wallets.

2.1) Open Metamask, click the menu icon at the top right, and select "Add Network"

2.2) Scroll down the bottom and select "Add a network manually"

2.3) Fill in your node details

The specific details will vary depending on your local setup. As I am running Geth on the same machine as my Metamask installation, so I am using 127.0.0.1 as the IP address.
If your RPC is unavailable or otherwise inaccessible, it may show an error when you enter the Chain ID and won't allow you to save the network.

2.4) Look out for the confirmation message

2.5) Swap to your new network if Metamask hasn't done so already

Success! Now you can use Metamask as you normally would with the added benefit of accessing the Ethereum network through your own node 🥳