I am using this command to start geth. Geth starts but I cannot connect to it via Web3. I get a couldn't connect to localhost. Has anyone any idea why this would happen?

nohup geth --datadir node6/ --syncmode 'full' --port 30316 --rpc --rpcaddr 'localhost' --rpcport 8506 --rpccorsdomain "*" --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://739f2c03c2378b1335bbdff6f8fff481339224b9bb6dccf2799a8075c450871fa40057c42c10de0703e2637514537b1a7d129177f452e9d719e7832cde55fbd7@' --networkid 1520 --gasprice '1' -unlock 'f39995b718ae7a0075557f9781425b92fd8b28a6' --password node6/password.txt --nat "any" --mine &

  • try putting at the place of localhost – Aniket May 8 '18 at 8:05
  • I did test that, and the same issue was there. I did also discover that 8545 is needed apparently for Web3 access via RPC. With that change I can now access the node via Web3 in node. But the Chrome access still fails. – Trevor Oakley May 8 '18 at 9:25
  • 8545 is the default port when you didn't provide any such value, in your case 8506 will work. Can you please put some code how you are trying to access it? – Aniket May 8 '18 at 9:41
  • I am using web3 = new Web3(new Web3.providers.HttpProvider("localhost:8545")); with different port numbers. – Trevor Oakley May 8 '18 at 10:39
  • web3js.readthedocs.io/en/1.0/web3.html#providers : Trying using one of the methods mentioned here – Aniket May 8 '18 at 13:09

Your Answer

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

Browse other questions tagged or ask your own question.