Unable to list accounts using geth console even though accounts exist

Viewed 517

When I run the geth command to list all accounts, it works fine:

geth account list
INFO [04-09|15:47:35.967] Maximum peer count                       ETH=50 LES=0 total=50
INFO [04-09|15:47:35.967] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [04-09|15:47:35.968] Set global gas cap                       cap=25000000
Account #0: {<my_public_address>} keystore: <path_to_keystore>

But when I start it's console, I get undefined and an empty array while requesting balances/accounts:

> eth.getAccounts()
undefined
> eth.accounts
[]

However, if I specify my address in order to check the balance, it works fine:

> eth.getBalance("<my account address>")
3000000000000000000

I am running a local self-hosted Ethereum node on rinkeby network: geth --rinkeby --rpc --rpcapi "eth,net,web3" --cache 2048

1 Answers

Try manually using the --keystore option, and adding the path to the folder that has your keystore. (in this case it's probably ~/.ethereum/rinkeby/keystore )

Related