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.
Required Flags
--http--http.apieth,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.
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.
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 🥳