Why do some ethereum related websites (for example regis.nu, there are many others) tell me they cannot find a node running at http://localhost:8545 and what can I do about that?

Regis.nu allowed me to create a "light-wallet" and then I had to put some ether in there, but I didn't really want to do that. I wanted to use my own wallet. I tried starting 'geth' but now I'm going into deep water and I can't swim.

So question: How can I start a node at http://localhost:8545?

up vote 18 down vote accepted

http://localhost:8545 is the RPC port of your locally running Ethereum node software.

When running geth, the Go implementation of the Ethereum node software, the command line parameters to create and configure this RPC service follows:

user@Kumquat:~$ geth --help | grep rpc
  --rpc                         Enable the HTTP-RPC server
  --rpcaddr "127.0.0.1"         HTTP-RPC server listening interface
  --rpcport "8545"              HTTP-RPC server listening port
  --rpcapi "db,eth,net,web3"    API's offered over the HTTP-RPC interface
  --rpccorsdomain               Domains from which to accept cross origin requests (browser enforced)

The defaults for --rpcaddr, --rpcport and --rpcapi will allow the regis.nu webpage to connect to your local geth node. You will however need to configure the --rpccorsdomain to allow your web browser to get access to your local Ethereum node.

To start a node on your local machine providing the regis.nu webpage with access to your node, try:

geth --rpc --rpcaddr "127.0.0.1" --rpcport "8545" \
  --rpc --rpccorsdomain "http://regis.nu" console

Note: Setting --rpccorsdomain to "http://regis.nu" will work with the regis.nu webpage. If you are having trouble connecting, start testing with "*" to check whether the webpage can connect to your node, then find the correct setting to minimise your security risk - see Cross-origin resource sharing for more information. And note that using "*" could be risky.

Looking into the JavaScript code in regis.nu/main.js linked from regis.nu, you will see:

 module.exports={nodeAddress:["http://localhost:8545","http://104.41.138.167:8545"], ...}

The page will firstly try connecting to your RPC port locally, then try the RPC port available at IP address 104.41.138.167 .

I loaded http://regis.nu in my web browser, then clicked on the Start button, but the website could not connect to the RPC port of my locally running geth. I had to temporarily allow http://localhost in my NoScript addon within my browser before the regis.nu web page was allowed to connect to my local geth node and list my accounts.

Useful reference:

  • I read somewhere that --rpccorsdomain "*" was a bit overly open. May I put the domain name (in this case regis.nu) in there? Thanks for the very informative answer by the way. – Thomas Jay Rush Apr 24 '16 at 12:49
  • 1
    I've just tested the web page, and setting --rpccorsdomain to regis.nu does not work, but http://regis.nu works. – The Officious BokkyPooBah Apr 24 '16 at 13:15
  • 1
    Thanks. Another place I saw this happen was etherid.org where they say explicitly (now that I see it): Please note that using --rpccorsdomain "*" is dangerous. – Thomas Jay Rush Apr 24 '16 at 13:24
  • You should use instead --rpccorsdomain "subdom.domain.com" like for example with multiple options: --rpccorsdomain "*.myetherwallet.com,*.ethereum.org" – Andy B. Apr 11 at 18:44

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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