How to import an account in private ethereum network?

–1 vote

I have created a new ethereum account using the following command: 

geth --datadir ./datadir account new

This was successful. Next, I created the genesis file with the account ID and allocated ethers to it. I initiated the genesis block and started the peer node.

All these steps were successful, I found no problem. 

But when I check the accounts, it shows not account.

> eth.accounts
[]

Why is this happening?

Jan 9 in Blockchain by digger
• 26,550 points
29 views

1 answer to this question.

0 votes

 When you create a new account, the data related to that account is stored in the UTC file. 

When you check the accounts from the geth console, it lists the details of accounts present in the ./data/keystore directory.

In your case, you have first created the account and then initialized the peer node which means the details of the newly created account is in the ./datadir(path mentioned in your command in the question) and not in the  ./data/keystore directory.

Copy the file from  ./datadir to ./data/keystore directory and then you will be able to see the account. 

answered Jan 9 by Omkar
• 67,660 points

Related Questions In Blockchain

0 votes
1 answer

Unable to perform an operation in Ethereum private network

It seems that the Unix socket can't ...READ MORE

answered Jul 31, 2018 in Blockchain by Shashank
• 10,350 points
83 views
+1 vote
1 answer

Not able to create new account in geth for private ethereum network

Looks like the account you are trying ...READ MORE

answered Dec 6, 2018 in Blockchain by Omkar
• 67,660 points
200 views
–1 vote
1 answer

How to connect two different nodes in private ethereum network?

To connect two nodes, you can use ...READ MORE

answered Jan 9 in Blockchain by Omkar
• 67,660 points
250 views
0 votes
1 answer

How to check peer connectivity in ethereum private network?

You can use the net module to check the ...READ MORE

answered Jan 10 in Blockchain by Omkar
• 67,660 points
30 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
173 views
0 votes
1 answer
0 votes
0 answers

Error: Unexpected token o in JSON at position 1

I have been working with Interacting a ...READ MORE

Mar 6 in Blockchain by saeedi
• 120 points

edited Mar 6 by Omkar 513 views
0 votes
1 answer

How to get account with ethers by default in ethereum private network?

Have you created an account before allocating ...READ MORE

answered Jan 9 in Blockchain by Omkar
• 67,660 points
65 views
–1 vote
1 answer

How to change default account in private ethereum network?

First list the accounts: > eth.accounts NOTE: Even ...READ MORE

answered Jan 9 in Blockchain by Omkar
• 67,660 points
120 views