它是以太坊区块链的HDWallet生成器。
cobra-hdwallet的Python项目详细描述
眼镜蛇钱包
这是以太坊区块链的hdwallet生成器。
您可以在metamask/myetherwallet上粘贴助记符(seed)或私钥
安装
安装Cobra HDWallet
pip install cobra-hdwallet
用法
创建hdwallet
from cobra_hdwallet import HDWallet
# init HDWallet
hdWallet = HDWallet()
# Generate seed
mnemonic = hdWallet.generate_mnemonic("english")
# Check seed it is not required
# if not hdWallet.check_mnemonic(mnemonic, "english"):
# exit()
# Create HDWallet by seed and password.
# enHDWallet = hdWallet.create_hdwallet(mnemonic) # Without password
enHDWallet = hdWallet.create_hdwallet(mnemonic, "password")
# Print Generated HDWallet
print(enHDWallet)
OUTPUT
{
'coin': '...',
'name': '...',
'address': '...',
'mnemonic': '...',
'wif': '...',
'finger_print': '...',
'chain_code': '...',
'private_key': '...',
'public_key': '...',
'uncompressed_public_key': '...',
'serialized': {
'private_key_hex': '...',
'public_key_hex': '...',
'xprivate_key_base58': '...',
'xpublic_key_base58': '...'
}
}
从私钥中获取hdwallet
from cobra_hdwallet import HDWallet
# init HDWallet
hdWallet = HDWallet()
# Get HDWallet from private key
private_key = 'bc42cee69a730913a84df8b70eee15517c0b56e8c8cc36ba3d11bbad91ee5456'
pvHDWallet = hdWallet.hdwallet_from_private(private_key)
# Print HDWallet
print(pvHDWallet)
OUTPUT
{
'coin': '...',
'name': '...',
'address': '...',
'wif': '...',
'finger_print': '...',
'private_key': '...',
'public_key': '...',
'uncompressed_public_key': '...'
}
进一步帮助
眼镜蛇框架去看看Cobra。