Skip to content

Instantly share code, notes, and snippets.

@jshufro

jshufro/how.md Secret

Last active Nov 30, 2022
Embed
What would you like to do?
Using Your Eth1 Client with MetaMask in Chrome/Firefox

Background

MetaMask uses Infura to submit transactions and query balances, and Infura can be flaky.

If you want to use your node's eth1 container, this guide will help you (provided you are staking from home!)

This guide assumes you're using Geth or Besu as an eth1 client

Steps

1. Update Smartnode Settings

Run rocketpool service config and go to the Execution Client (ETH1) section. Check Expose RPC Ports.

  • If you're using Chrome and Geth:
    • set Additional Flags to contain --http.corsdomain=chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn
  • If you're using Chrome and Besu:
    • set Additional Flags to contain --rpc-http-cors-origins=chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn
  • If you're using Firefox:
    • Navigate to about:debugging#/runtime/this-firefox. You need to get the moz-extension domain for your installation of MetaMask. It is unique to you. It resembles moz-extension://9675fa0d-3038-4741-a5df-c38217e77bd6 (with no trailing /manifest.json)
      • If you're using Geth, set Additional Flags to contain --http.corsdomain=moz-extension://your-moz-extension-id
      • If you're using Besu, set Additional Flags to contain --rpc-http-cors-origins=moz-extension://your-moz-extension-id

Save and exit, restarting the containers when prompted.

2. Test that the port is open.

On the node, run:

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://0.0.0.0:8545

You should see a response similar to: "jsonrpc":"2.0","id":67,"result":"Geth/v1.10.17-stable-25c9b49f/linux-amd64/go1.18"}

3. Update MetaMask

Go to the MetaMask settings and go to the Networks tab. Click Add a network.

Fill it out like this and hit save (using the LAN or Tailscale IP address of your node in the RPC URL): MM Note: MetaMask may show a red error complaining that chain id 1 is used by Ethereum Mainnet. You can ignore this error. Note: You must append :8545 to your IP address as shown in the screenshot.

Hit save. You should be all set!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment