Python BtcTxStore.verifysignature方法代码示例(pythonbtctxstore.verifysignature使用的例子)

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


Python BtcTxStore.verifysignature方法代码示例(pythonbtctxstore.verifysignature使用的例子)

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

示例1: TestVerifySignature

# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import verifysignature [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))
开发者ID:NinjaDevelper,项目名称:btctxstore,代码行数:45,代码来源:api.py

示例2: TestSignData

# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import verifysignature [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)
开发者ID:NinjaDevelper,项目名称:btctxstore,代码行数:22,代码来源:api.py

本文标签属性:

示例:示例英语

代码:代码是什么

Python:python菜鸟教程

BtcTxStore:BtcTxStore

verifysignature:verifysignaturefailed是什么意思

上一篇:乘电梯被取消楼层(乘电梯被取消楼层怎么办)(业主申请取消电梯梯控的流程?)
下一篇:陆地的反义词_陆地的近义词_陆地的词语解释(陆地的拼音)(“陆地的反义词大陆海洋“陆地”相关近义词反义词的解释)

为您推荐