1

I have started an rpc server as follows :

 geth --datadir ./chaindata --rpc --rpcapi="db,eth,net,web3,personal,web3"

It says that an http endpoint is started . But i cant access this endpoint through metamask . Is there something Im missing . It is working fine with testrpc

  • 1
    You need to expose the some extra data in that command geth --datadir ./chaindata --rpc -rpcport 8545 --rpcapi="db,eth,net,web3,personal,web3" – Eduardo Pereira Oct 26 '17 at 23:22
1

Solved . I didnt specify --rpccorsdomain .

geth --rpc --rpccorsdomain="*"

This solved the problem.

  • warning - this can be a security risk since it allows any website you browse connect to your local node. Better use a more specific value than the wildcard. For chrome, it's currently chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn – Allen Hamilton Nov 6 '18 at 4:58
0

Eduardo is correct. This process is documented on the metamask support page:

https://support.metamask.io/kb/article/2-using-a-local-node

  • The problem was , I didnt specify the rpccorsdomain ,a silly mistake to make . – Zach Dev Oct 27 '17 at 3:01
0

I don't have enough reputation to put this in a comment, so I'm just going to write out a whole new answer in order to include Firefox, especially since it will allow Tor users to run off a local node).

As pointed out above, the --rpccorsdomain flag needs to be enabled. Each browser has a different extension that you'll need to put in, though.

Chrome

For Chrome (as detailed on MetaMask's docs here):

geth --rpc --rpccorsdomain="chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn"

Firefox/Tor

I got two different outputs on two different computers for the moz-extension for MetaMask's Firefox extension. (Tor is built on Firefox, and as such, Tor users should follow the same process.) A such, I'll link to this StackOverflow question which can tell you how to find the ID on your machine (ignore the last backslash). (Make sure MetaMask is active, as to say not disabled, when you run the memory test.) Your geth command should look something like:

geth --rpc --rpccorsdomain="moz-extension://f3a66ea7-df4d-4731-80db-de45a4abebd6"

I can confirm that I have connected a local node to MetaMask on Firefox using this method.

Brave

I suspect Brave is using the Chrome extension (especially since it's the example on their site here, and can therefore use the same code as for Chrome above, but have not confirmed this.

Opera and Edge

I have no knowledge as to how to connect on Opera or Edge, but am happy to update if anyone else does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.