我想获取与我的扩展公钥关联的所有地址。我在bitcoinlib 的文档上找到了如何做到这一点:
初始化地址对象。指定一个公钥、redeemscript 或一个散列。
>>> addr = Address('03715219f51a2681b7642d1e0e35f61e5288ff59b87d275be9eaf1a5f481dcdeb6', encoding='bech32', script_type='p2wsh') >>> addr.address 'bc1qaehsuffn0stxmugx3z69z9hm6gnjd9qzeqlfv92cpf5adw63x4tsfl7vwl'
但是Address()
,由于我的代码:
from bitcoin import * # using import * because not sure what else to import?
master = Address("my extended pub key", encoding='bech32', script_type='p2wpkh')
print(master.address)
产生此错误:
NameError: name 'Address' is not defined