生成ETH私钥、公钥和地址

1.安装pyethereum包
github地址:https://github.com/ethereum/pyethereum
安装注意:执行pip install -r requestment.txt时可能会报文件找不到错误,重新sudo apt-get install目标对象即可
2.安装bitcoin包
sudo pip install bitcoin


3.具体生成步骤
from ethereum.utils import *
import bitcoin
import os
key = os.urandom(32)
private_key = encode_hex(key)
public_key = encode_hex(bitcoin.privkey_to_pubkey(key))
address = '0x' + encode_hex(privtoaddr(key))

你可能感兴趣的:(ETH)