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


Python BtcTxStore.verifysignature方法代码示例

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


在下文中一共展示了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


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