2

I came across this when I made a typo checking my ETH balance from the ethconsole. I had incorrectly typed web3.eth.coinbase. I poked around and anything after web3.eth. that is a typo brought up a balance of 7088.445913801793117574.

I asked on Redit with the example of web3.eth.wololo and Nick Johnson posted to following response:

web3.eth.wololo evaluates to undefined, and web3.eth.getBalance apparently treats undefined the same as 0 - so you're seeing the balance of account 0.

So, back to the console. I have only 1 account and this is account 0. I will post my outputs below:

c:\>geth --cache=1204 -rpc --datadir "f:\Ethereum" account list

Account #0: {dd289578d8915156de085df3d03062335238a293} f:\Ethereum\keystore\UTC--2016-06-21T17-26-40.480551500Z--dd289578d8915156de085df3d03062335238a293

c:\>geth --cache=1204 -rpc --datadir "f:\Ethereum" --unlock 0xDD289578D8915156De085DF3d03062335238a293

!! Truncated !!

Unlocking account 0xDD289578D8915156De085DF3d03062335238a293 | Attempt 1/3 Passphrase:

I1010 00:30:37.012616 cmd/geth/accountcmd.go:189] Unlocked account dd289578d8915156de085df3d03062335238a293

!!! Eth Console !!!

web3.fromWei(web3.eth.getBalance(web3.eth.wololo), "ether")

7088.445913801793117574

web3.fromWei(web3.eth.getBalance(web3.eth.coinbase), "ether")

15.9387038629625851

web3.eth.sendTransaction({from: web3.eth.wololo, to: '0xDD289578D8915156De085DF3d03062335238a293', value: web3.toWei(1, "ether"), gas:22000});

(shell):4334: Error: account is locked
throw errors.InvalidResponse(result);
^
Error: account is locked
at Object.module.exports.InvalidResponse ((shell):2103:16)
at RequestManager.send ((shell):4334:22)
at Method.send ((shell):4002:59)
at (shell):1:10
Error: Uncaught Error: account is locked

1
3

When Nick was talking about account 0, he did not mean web3.eth.accounts[0], he meant account "0x0000000000000000000000000000000000000000".

> web3.fromWei(eth.getBalance("0x0000000000000000000000000000000000000000"))
7088.445913801793117574

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.