eth getBalance always returns 0 in testnet

0 votes

I am developing an ethereum wallet api. I want to get the balance for specific address by using eth.getBalace() on running the following testnet:

alias geth = 'geth --ipcpath /home/tom/.ethereum/testnet/geth.ipc'
geth console

At this time, I can see the eth.syncing is true. And I sent 3 ether in http://faucet.ropsten.be:3001/. But I can get balace by using eth.getBalance() method.

How can I get balance in my local?

Jul 24, 2018 in Blockchain by sabby
• 4,370 points
2,650 views

1 answer to this question.

0 votes

You are not connecting to the right network when starting geth, hence the 0 balance. The --ipcpath just tells geth where to store the IPC file when other local processes want to connect to your node. You need to specify the --testnet option to connect to Ropsten. It looks like you want to use the coinbase account for checking your balance, so you should also pass in your address with the --etherbase option.

alias geth = 'geth --ipcpath /home/tom/.ethereum/testnet/geth.ipc --testnet --etherbase \'YOUR_ADDRESS_HERE\''

You can get the full list of geth commands here.

Once geth starts, you'll also have to wait for your node to sync in order to get your balance.

answered Jul 24, 2018 by Christine
• 15,790 points

Related Questions In Blockchain

+1 vote
2 answers

Challenge while setting up Hyperledger Fabric 1.0 in Ubuntu 16.04

The rocksdb error you're seeing wouldn't be ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,610 points

edited Jun 8, 2020 by Sirajul 1,167 views
+1 vote
1 answer

How to setup testnet environment in Ethereum??

You can connect to a node using ...READ MORE

answered Apr 18, 2018 in Blockchain by Shashank
• 10,400 points
921 views
0 votes
1 answer

How to get the already existing channels in Hyperledger v1.0?

You cannot see all available channels,  but you ...READ MORE

answered Jun 4, 2018 in Blockchain by Perry
• 17,100 points
2,525 views
0 votes
1 answer

Çannot implement web3.eth.subscribe on Web3 version 1.0.0-beta.27

As the error suggests, pub/sub is not ...READ MORE

answered Jun 19, 2018 in Blockchain by Perry
• 17,100 points

edited Jun 19, 2018 by Perry 2,048 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,942 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,468 views
0 votes
0 answers

Error: Unexpected token o in JSON at position 1

I have been working with Interacting a ...READ MORE

Mar 6, 2019 in Blockchain by saeedi
• 120 points

edited Mar 6, 2019 by Omkar 2,507 views
0 votes
1 answer

GetState query via chaincode always returns empty value

fabric uses an ccenv image to build the chaincode when ...READ MORE

answered Jul 17, 2018 in Blockchain by Christine
• 15,790 points
1,724 views
0 votes
1 answer

How to make sure transactions take no fee in a private Ethereum blockchain?

In a private ethereum network you have ...READ MORE

answered Mar 26, 2018 in Blockchain by Christine
• 15,790 points

edited Mar 26, 2018 by Christine 1,591 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP