[Ethereum] geth account list returns accounts but eth.accounts does not


I had my ethereum node on one server. I needed to migrate the accounts and all to another server (due to the huge size of blockchain). I started new ethereum node on another server. To copy my accounts, I copied the keystore folder from one server to other.

Now my node on new server is fully synced but when in geth console I type eth.accounts, it returns an empty array. However, if I check by geth account list, it displays me list of all accounts. Also on eth.coinbase returns me one of my accounts. What's going wrong?

I have etheres as well as custom token in my account. Am I missing anything?

Best Answer

I had to explicitly set the location of my keystore directory to get eth.accounts to show the right thing.

What I did was:

geth --light --keystore ~/.ethereum/keystore console

and then typing eth.accounts showed me a non-null array.

Very strangely, it seems this is a limited-time thing - I now no longer need to specify --keystore <location> anymore.

Should it help others, I had just done geth account import before eth.accounts stopped working as expected.

Related Topic