7

I have created one account using the command geth account new , name acc1 and another under the geth console using the command personal.newAccount() name it acc2. Now i am not able to see the acc1 using the command eth.accounts and acc2 using the command geth account list .

Both accounts have been created on same node. Then why the data of both accounts have been synchronized between both consoles.

What is the difference in both the ways of account creation?

1
  • can you help me create my account in ethereum
    – Mlandvo
    Commented Dec 18, 2017 at 19:45

1 Answer 1

12

It happens. The reason is the datadir being used for creating the account. for

geth account new

the default datadir is used is "~/.ethereum/keystore"(it's on my ubuntu OS).

You can go to that directory and see. There shall be one file of format "UTC--2017-02-13T07-14-57.563336682Z--your account". this is the account, which gets created when you do

geth account new

if you're running your private chain using geth, then you must have defined your own datadir while starting the geth console. so, when you do

personal.newAccount()

it goes into the "datadir/keystore".

Now, if you want the account created by

geth account new

to come under the

eth.accounts

You simply do cp from the "~/.ethereum/keystore" to "datadir/keystore". you shall be able to see the accounts in the

eth.accounts

in your console.

Now, if you want that your all future accounts, create using

geth account new

must be visible when you do

eth.accounts

in geth console, then you must do this:

geth --datadir "**path to your data dir**" account new

This shall create all the accounts, as per your private chain datadir. and you shall be able to see all the accounts.

Hope it helps.

Thanks

1
  • Curious about records geth account new makes on a filesystem. Could you please confirm it is just an encrypted public key, e.g. "UTC--2017-02-13T07-14-57.563336682Z--your account"?
    – Gleichmut
    Commented May 5, 2023 at 11:39

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.