本文整理汇总了Python中address.Address.fromPrivkey方法的典型用法代码示例。如果您正苦于以下问题:Python Address.fromPrivkey方法的具体用法?Python Address.fromPrivkey怎么用?Python Address.fromPrivkey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类address.Address
的用法示例。
在下文中一共展示了Address.fromPrivkey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fake_transaction
# 需要导入模块: from address import Address [as 别名]
# 或者: from address.Address import fromPrivkey [as 别名]
def fake_transaction(model=None):
key = ecdsa.SigningKey.from_string(
"\xe8\x00\xb8\xd4\xa1b\xb7o\x0f;\xf2\xcf\xca\xfd\x1a$\xb9\xa9"
"\xeb\x0b\x08X\x9f}9C\xe4\x88\xfdD\x11b", curve=ecdsa.curves.SECP256k1)
address = Address.fromPrivkey(key)
script = tools.compile(
"OP_DUP OP_HASH160 {0} OP_EQUALVERIFY OP_CHECKSIG".format(
address.rawPubkey()[1:-4].encode("hex"))).encode("hex")
utxo = utxodb.UTXO("D34DB33F", 0, 1, script)
utxo.address_rec = object()
utxo.address_rec = AddressRec(address)
txin = txspec.ComposedTxSpec.TxIn(utxo)
txout = txspec.ComposedTxSpec.TxOut(1, address.pubkey)
composed = txspec.ComposedTxSpec([txin], [txout])
return txcons.SignedTxSpec(model, composed, False), address
示例2: test_ecdsa_key
# 需要导入模块: from address import Address [as 别名]
# 或者: from address.Address import fromPrivkey [as 别名]
def test_ecdsa_key(self):
address = Address(*self.keys)
ecdsa_key = address.ecdsaPrivkey()
address2 = Address.fromPrivkey(ecdsa_key)
self.assertEqual(address.privkey, address2.privkey)