当前位置: 首页>>代码示例>>Python>>正文


Python BIP32Node.subkey_for_path方法代码示例

本文整理汇总了Python中pycoin.key.BIP32Node.BIP32Node.subkey_for_path方法的典型用法代码示例。如果您正苦于以下问题:Python BIP32Node.subkey_for_path方法的具体用法?Python BIP32Node.subkey_for_path怎么用?Python BIP32Node.subkey_for_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pycoin.key.BIP32Node.BIP32Node的用法示例。


在下文中一共展示了BIP32Node.subkey_for_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print

# 需要导入模块: from pycoin.key.BIP32Node import BIP32Node [as 别名]
# 或者: from pycoin.key.BIP32Node.BIP32Node import subkey_for_path [as 别名]
print(r.text)
# being this a demontrational code no file or directies will be created.
# I print everything for future transactions. Feel free to change the code
# for key storing inside gpg protected files etc.
print("")
print("Gererated public wallet : %s" % mpk3) # created and supplied by Cryptocorp
print("BIP32 wallet n.1        : %s" % hwif1.hwif(as_private=True))
print("BIP32 wallet n.2        : %s" % hwif2.hwif(as_private=True))
print("")

#path: 0/0/7 easy to remember

path = "0/0/7"


spk1 = BIP32Node.subkey_for_path(hwif1, path)
spk2 = BIP32Node.subkey_for_path(hwif2, path)
spk3 = BIP32Node.subkey_for_path(hmpk1, path)

#list of the public keys in sec format (to display them)
print("public keys in hex:")
print (BIP32Node.subkey_for_path(hwif1, path).sec_as_hex())
print (BIP32Node.subkey_for_path(hwif2, path).sec_as_hex())
print (BIP32Node.subkey_for_path(hmpk1, path).sec_as_hex())

#public subkeys in sec binary format (because ScriptMultisig requires it)
keys = [spk1, spk2, spk3] #just remember that the third has not the secret exponent
print(keys)
script = ScriptMultisig(n=2, sec_keys=[key.sec() for key in keys]).script()
print("script:")
print(b2h(script))
开发者ID:gabridome,项目名称:cryptocorp,代码行数:33,代码来源:createchain.py

示例2: print

# 需要导入模块: from pycoin.key.BIP32Node import BIP32Node [as 别名]
# 或者: from pycoin.key.BIP32Node.BIP32Node import subkey_for_path [as 别名]
<<<<<<< Updated upstream

# Also cryptocorp's key is supplyed
=======
private_wallets = json.load(open((chain_file + ".mseks.json"), "r"))
# The next is because I will use only one key
private_wallets.remove(private_wallets[1])
>>>>>>> Stashed changes
chainPaths = ["0/0/7","0/0/7","0/0/7"]
print("Chain paths:")
pp.pprint(chainPaths)
print("")

# masterbip32nodes = [Key.from_text(i) for i in public_wallets]

sub_bip32_nodes = [BIP32Node.subkey_for_path(Key.from_text(public_wallets[i]), chainPaths[i]) for i in range(len(chainPaths))]
print("Sub BIP32 wallets:")
for i in sub_bip32_nodes:
    print(i)

print("")

script_encoded = ScriptMultisig(n=2, sec_keys=[key.sec() for key in sub_bip32_nodes]).script()

script = b2h(script_encoded)
print("Script:")
print(script)
print("")

address = address_for_pay_to_script(script_encoded)
# 3Bi36w9RZHmibi1ip7ud9dvtpDt59ij7GC
开发者ID:gabridome,项目名称:cryptocorp,代码行数:33,代码来源:send_with_pycoin.py


注:本文中的pycoin.key.BIP32Node.BIP32Node.subkey_for_path方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。