6

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?

2 Answers 2

5

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.

1
  • Had the same issue despite having the right datadir location (geth --help shows the current datadir). Providing --keystore option also worked for me. Thanks! Commented Mar 3, 2020 at 21:31
1

I am not sure what was causing the problem. But copying only the address files from old keystore to new keystore instead of replacing new keystore folder with old one solved the problem.
It seems weird to me yet it solved the problem. Anyone having reson for this is welcome to edit the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.