[Ethereum] Get private key from web3.personal.newAccount(‘password’)

go-ethereummyetherwalletweb3js

I created a wallet account(ethereum) using web3.personal.newAccount('password'). Now, this method generally returns the address of new account, however, to send transactions from that account I would also need a private key. Can anyone please help from where I can get that?

Thanks in advance!

Best Answer

If you want to send transactions from within geth, just type personal.unlockAccount(address) and then send transactions.

If you need the actual private key from outside geth, you can find the JSON file with all necessary information to retrieve the private key at the same directory as the ipc was started when you started geth (typically .ethereum if working in the main network), under keystore/

With this JSON file, you can import it in many wallets, or in metamask, and start sending transactions.

If you need the actual plaintext private key for raw signing or whatever you need it, load up the file to myetherwallet.com. I am aware of another way of manually decipher from within geth but I can not find it at the moment.

Related Topic