How to connect Metamask to my DAppNode node

Why should I connect Metamask with DAppNode?

Metamask is a crypto wallet and gateway to blockchain apps. It is the most famous and widely used wallet to interact with web3. To be able to operate properly, it needs to connect to a node from the blockchain where you want to read/submit transactions.

For example, to operate in Ethereum you need the RPC url of an Ethereum node. Metamask by default provides you an Ethereum node called mainnet.

It also provides you other RPC endpoints for the Ethereum testnets, such as Kovan, Rinkeby and Ropsten.

This feature is great and enough to interact with Ethereum, but it carries some disadvantages compared to connecting Metamask to your own Ethereum node:

  • Security risks: using Metamask’s default nodes is to blindly trust in Metamask and the information they provide.
  • Downtime: Metamask’s provided nodes are susceptible of experiencing downtimes, not allowing you to operate in Ethereum until it get resolved. It has happened in the past.
  • Privacy: Metamask or their node provider may be recording users’ data to analyze it and sell it. Do not be part of it by running your own node.
  • Decentralization: having your own node means a direct contribution to decentralization, making the blockchain more resilient and secure.

Connect Metamask to your own node with DAppNode

Requirements

  • DAppNode installed
  • Have Metamask setup in the browser and a wallet configured

There are two ways of connecting Metamask to your node in DAppNode.

  1. Via local network endpoint (accessible from anywhere through VPN or WiFi)
  2. Making the endpoint available through HTTPS (accessible from anywhere without any extra steps)

Via local network endpoint

  1. Get your RPC: in the DAppNode UI go to any blockchain node and get your RPC, in this example it is used Geth.

    The Geth RPC is http://geth.dappnode:8545

  2. Create a custom RPC: once you have the RPC to be used, in the Metamask extension click on Networks > Custom RPC

  3. Finally you will have to populate 3 fields:

  • Name: the name of the network. Can be any name.
  • New RPC url: the RPC url obtained before (http://geth.dappnode:8545)
  • ChainId: it is a number that represents the blockchain, for mainnet is 1. You can get the chain ID of any blockchain you need from this website.

Using HTTPS

You can combine the HTTPS feature in DAppNode with Metamask, by exposing the RPC endpoint you choose via HTTPS, allowing you to use the RPC without being connected to your DAppNode via Wi-Fi or VPN.

To expose the RPC go to System > Network and expose the RPC of your choice.

If the RPC you are looking for is not listed then you will have to do it manually in the Package name > Network > HTTPS domain mapping view.

Right after exposing the RPC in the HTTPs view you will get an URL, this is the RPC to be used in the new Metamask network created, as was explained in the previous section.

Resources

4 Likes

Metamask won’t allow for two networks with the same ChainID to be added, and the default Ethereum Mainnet config is locked (can’t be deleted or edited). So…how does one actually get this to work?

Having the same issue with my MetaMask setup. Using chainID = 1 is not allowed and removing the default Ethereum profile that uses Infura cannot be done.

1 Like

Solved - was not connected through VPN or Wifi. Connecting through local does not work.

1 Like

Same question as the other two about chain ID. Has anyone figured this out?

I don’t understand, connecting through a VPN made metamask accept 2 networks with chainID=1?

noticed this as well, also I believe it is metamask UI related, the workaround that i found is to put a space after the RPC URL delete the one and re-add it. This allows you to save and it works.

thanks for replying, I am still having trouble getting it to work. Are you using https to connect? or using a local (internal) IP and connecting through VPN?

Edit: have tried both ways, Metamask still wont allow the same chainID

Is there anyway to change the network chain ID withing Dappnode? or this is not possible?

Edit2: Kept messing with it and got it working, Used IH0DL’s work around, combined with closing out of the add RPC network settings page and going back in and it worked.

Thanks

2 Likes