Skip to content

Instantly share code, notes, and snippets.

@MaHu6
Created August 8, 2018 09:38
Show Gist options
  • Save MaHu6/c183aedd5b1de9697eaaab644129949b to your computer and use it in GitHub Desktop.
Save MaHu6/c183aedd5b1de9697eaaab644129949b to your computer and use it in GitHub Desktop.
according privatekey export keystore
# pip3 install web3
from web3 import Web3
import json
# network = "https://ropsten.infura.io/your_key"
network = "http://127.0.0.1:8545"
web3 = Web3(Web3.HTTPProvider(network))
private_key = "55dcb09dc6afc5c34ec6b4879ede6c08b20bcf129d4fc158b820983c369d3536"
passwd = ""
try:
keystore = web3.eth.account.encrypt(private_key, passwd)
print(json.dumps(keystore))
except Exception as e:
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment