I would like to import as well as delete the private key from go-ethereum (geth
), using the web3.py client. Can you please suggest the appropriate functions? I have already generated the private key.
Asked
Active
Viewed 3,613 times
0
1 Answers
0
The web3.py docs on using private keys has this example:
with open('~/.ethereum/keystore/UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E') as keyfile: encrypted_key = keyfile.read() private_key = w3.eth.account.decrypt(encrypted_key, 'correcthorsebatterystaple') # tip: do not save the key or password anywhere, especially into a shared source file
The process to "import as well as delete the private key from geth" is:
- Identify where geth is storing your network data
- Look in the
keystore
folder in the geth data directory - Choose the key file with the account that you want to export (the address is in the key name)
- Decrypt it locally with
w3.eth.account.decrypt(...)
- Save a backup of the private key somewhere safe and recoverable
- Test recovery of the private key from your backup
- Remove the key file from your geth data directory

carver
- 2,229
- 12
- 28