2

I have been searching and seeing similar questions but I don't really understand the answer. I have a very simple node.js application that does not involve smart contacts. All I want to do is check the balance of an ethereum address. I see this in the web3js documentation

web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));

but that is if I'm running a node on my server, which has a bunch of security issues on its own. Is there a provider I can use for mainnet to just check balances? If not why not?

2

Use infura api. Go to infura website and create your own infura key that will make a connection with ethereum block chain, and provide you stable node. web3.setProvider(new web3.providers.HttpProvider('http://mainnet.infura.com/infurakey'));

  • Thank you! Just curious, are there other ways to do it or do you always need to use a service like that? – PixMach Jan 24 '18 at 16:11
  • 1
    You was asking about the provider, that's why i mentioned that way.. you can also do that using geth but its seriously not a good idea according to me, because we need to take care alot of things with this procedure.so i prefer you to use this service provider. – Hamza yasin Jan 24 '18 at 16:19
  • I meant are there many service providers, or is there a collection of them somewhere? – PixMach Jan 24 '18 at 17:22

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.