I have set my ethereum node in Amazon Ec2.

I start syncing through this command

sudo geth --datadir /home/ubuntu/data/ --cache=512 --allow-insecure-unlock --rpcapi "web3,eth,personal" --rpc --rpcaddr "" --rpccorsdomain "*" --mainnet

After a couple of days got all the latest blocks downloaded.

Now I created an account using the below command

sudo geth --datadir /home/ubuntu/data/ account new

Got this public address

Public address of the key: 0x18bfeAc7ceAa60B53647dd2c0F73fcF74c1eB3A4

To know balance I ran this below command it showed 0

sudo geth --datadir /home/ubuntu/data/ --exec 'web3.fromWei(eth.getBalance("0x18bfeac7ceaa60b53647dd2c0f73fcf74c1eb3a4"), "ether")' attach 0

yes, this is correct. Now I asked my friend to transfer a small amount to check the balance.

He transferred an amount and the transaction was successful in etherscan.

Now when I ran this command again

sudo geth --datadir /home/ubuntu/data/ --exec 'web3.fromWei(eth.getBalance("0x18bfeac7ceaa60b53647dd2c0f73fcf74c1eb3a4"), "ether")' attach

It is still showing zero.

In etherscan https://etherscan.io/address/0x18bfeac7ceaa60b53647dd2c0f73fcf74c1eb3a4 balance is showing correctly.

Any idea what I am missing. Your help will be greatly appreciated. Thanks


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.