I am throwing together a sample app. I want to query an address and display its account balance.

In the constructor of my React component, I am querying a random address:

constructor(props) {

  var web3 = new Web3(new Web3.providers.HttpProvider());

  // TODO: This should be a form input
  // Bittrex Address
  this.address = '0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98'
  this.accountBalance = web3.fromWei(web3.eth.getBalance(this.address), 'ether');

I am running geth with the terminal command:

geth --testnet --fast --rpc --rpcapi db,eth,net,web3,personal --cache=1024  --rpcport 8545 --rpcaddr --rpccorsdomain "*"

When I output this.accountBalance.toString() to the console, it's 0. However, if I output the account balance of a valid address on my local testnet (testrpc), it outputs 100 (default balance).

What am I doing incorrectly

1 Answer 1


With geth --testnet you are connected to the Ropsten chain.

Balance of the address from your code is actually 0 in this chain. Please, check it in etherscan https://ropsten.etherscan.io/address/0x7a970c5653b72232c9d52f7bcda80fc9fbecb7d3

If you really want to know the balance of this address in mainnet, you should start geth without --testnet parameter or you can quickly check it with connection of web3 to INFURA RPC url: https://mainnet.infura.io/your_access_token

  • If I sign up with INFURA, would I then be able to host my app somewhere and point to INFURA without having to download the entire blockchain?
    – Huy
    Aug 18, 2017 at 4:34
  • Actually I just tried it out. Thanks for the link to INFURA - exactly what I was looking for for my next step.
    – Huy
    Aug 18, 2017 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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