5

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
  • 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" Commented Oct 26, 2017 at 23:22

3 Answers 3

2

Solved . I didnt specify --rpccorsdomain .

geth --rpc --rpccorsdomain="*" 

This solved the problem.

1
  • 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 Commented Nov 6, 2018 at 4:58
1

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.

0

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

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

1
  • The problem was , I didnt specify the rpccorsdomain ,a silly mistake to make . Commented Oct 27, 2017 at 3:01

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.