0

I have started Sync of ETH node to my VPS. I want to call RPC Call to get balance details of addresses. What i have done is as below: 1) Install geth started geth service 2) geth --fast --rpc

After few hours i have stopped geth sync and add some peers using admin.addPeers() method

Again start geth sync using below command on specific port

geth --syncmode light console --rpc --rpcport 3000

after this i have fired admin.peers it shows empty Array so i have add some peers and then check using admin.peers below is the image of admin.peers

enter image description here

Now i am still not able to call RPC Call on my IP 5.101.139.166:3000 I am getting error

Error: Couldn't connect to server Here are some additional things that may help.

Documentation Contact Support Loading... Cancel Request Unknown Response Code0.000 milliseconds Read
Current Status of Node sync is as below enter image description here

Error while calling RPC Call enter image description here

  • from where and how are you calling Geth exposed RPC server ? – kherwa May 22 '18 at 7:41
  • I am calling RPC all to server by specified port 3000 – Rushabh Madhu May 22 '18 at 8:01
  • I mean from browser or Node.js or anything else? – kherwa May 22 '18 at 8:09
  • Are you using curl or web3 to consume RPC API’s? – kherwa May 22 '18 at 8:18
  • I am calling from postman or restclient. as it is not responding in postman it will not reflact in other restclient also – Rushabh Madhu May 22 '18 at 8:20
0

Can you try to use this geth option --rpccorsdomain "*" (or --rpccorsdomain "5.101.139.166")?

To accept cross origin requests, this rpccorsdomain option should be set when you launch geth from console.

  • Okay, Let me try this – Rushabh Madhu May 22 '18 at 7:18
  • This is not working, I have checked, it shows same error. – Rushabh Madhu May 22 '18 at 7:24
  • I have added answer that fixed my problem. But still i am getting some minor issues like "no suitable peers available" – Rushabh Madhu May 22 '18 at 10:43
0

As you have started RPC server at port 3000, when running Geth with option --rpcport=3000. So while consuming RPC API's use port 3000, instead of default port 8545. That will solve your problem.

  • This is not a actual problem. – Rushabh Madhu May 22 '18 at 10:36
  • then what is the problem? As far as i can see in postman , you are sending JSON-RPC request to port 8545 – kherwa May 22 '18 at 10:40
0

Start geth by this command will solve the problem. Using below command it allows all other IP to access it.

geth --syncmode light console --rpc --rpcport 8545 --rpccorsdomain "*" --rpcaddr 0.0.0.0 --rpcapi db,eth,net,web3,personal

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.