本文整理汇总了Python中btctxstore.BtcTxStore.getaddress方法的典型用法代码示例。如果您正苦于以下问题:Python BtcTxStore.getaddress方法的具体用法?Python BtcTxStore.getaddress怎么用?Python BtcTxStore.getaddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类btctxstore.BtcTxStore
的用法示例。
在下文中一共展示了BtcTxStore.getaddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestGetAddress
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import getaddress [as 别名]
class TestGetAddress(unittest.TestCase):
def setUp(self):
self.api = BtcTxStore(dryrun=True, testnet=True)
def test_getaddress(self):
wif = fixtures["wallet"]["wif"]
result = self.api.getaddress(wif)
expected = fixtures["wallet"]["address"]
self.assertEqual(result, expected)
示例2: TestSignData
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import getaddress [as 别名]
class TestSignData(unittest.TestCase):
def setUp(self):
self.api = BtcTxStore(dryrun=True, testnet=True)
def test_sign_a(self):
wif = fixtures["wallet"]["wif"]
data = binascii.hexlify(b"testmessage")
address = self.api.getaddress(wif)
sig = self.api.signdata(wif, data)
valid = self.api.verifysignature(address, sig, data)
self.assertEqual(valid, True)
def test_sign_b(self):
wif = "cSuT2J14dYbe1zvB5z5WTXeRcMbj4tnoKssAK1ZQbnX5HtHfW3bi"
data = binascii.hexlify(b"testmessage")
address = self.api.getaddress(wif)
sig = self.api.signdata(wif, data)
valid = self.api.verifysignature(address, sig, data)
self.assertEqual(valid, True)
示例3: TestVerifySignature
# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import getaddress [as 别名]
class TestVerifySignature(unittest.TestCase):
def setUp(self):
self.api = BtcTxStore(dryrun=True, testnet=True)
def test_verify_positive(self):
_fixtures = fixtures["verifysignature"]["positive"]
address = _fixtures["address"]
signature = _fixtures["signature"]
data = binascii.hexlify(b"testmessage")
result = self.api.verifysignature(address, signature, data)
self.assertEqual(result, True)
def test_verify_incorrect_address(self):
_fixtures = fixtures["verifysignature"]["incorrect_address"]
address = _fixtures["address"]
signature = _fixtures["signature"]
data = binascii.hexlify(b"testmessage")
result = self.api.verifysignature(address, signature, data)
self.assertEqual(result, False)
def test_verify_incorrect_signature(self):
_fixtures = fixtures["verifysignature"]["incorrect_signature"]
address = _fixtures["address"]
signature = _fixtures["signature"]
data = binascii.hexlify(b"testmessage")
result = self.api.verifysignature(address, signature, data)
self.assertEqual(result, False)
def test_verify_incorrect_data(self):
_fixtures = fixtures["verifysignature"]["incorrect_data"]
address = _fixtures["address"]
signature = _fixtures["signature"]
data = binascii.hexlify(b"testmessagee")
result = self.api.verifysignature(address, signature, data)
self.assertEqual(result, False)
def test_verify_signature_params(self):
wif = "cSuT2J14dYbe1zvB5z5WTXeRcMbj4tnoKssAK1ZQbnX5HtHfW3bi"
data = binascii.hexlify(b"testmessage")
address = self.api.getaddress(wif)
sig = "///////////////////////////////////////////////////////////////////////////////////////="
self.assertFalse(self.api.verifysignature(address, sig, data))