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


Python BtcTxStore.store_nulldata方法代码示例

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


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

示例1: TestStoreNulldata

# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import store_nulldata [as 别名]
class TestStoreNulldata(unittest.TestCase):

    def setUp(self):
        self.api = BtcTxStore(dryrun=True, testnet=True)

    def test_store_nulldata_alpha(self):
        wifs = fixtures["store_nulldata"]["alpha"]["wifs"]
        result = self.api.store_nulldata("f483", wifs)
        expected = fixtures["store_nulldata"]["alpha"]["expected"]
        self.assertEqual(result, expected)

    def test_store_nulldata_beta(self):
        wifs = fixtures["store_nulldata"]["beta"]["wifs"]
        expected = fixtures["store_nulldata"]["beta"]["expected"]
        data = binascii.hexlify(b"github.com/F483/btctxstore")
        result = self.api.store_nulldata(data, wifs)
        self.assertIn(result, expected)

    def test_store_nulldata_insufficient_funds(self):
        wifs = fixtures["store_nulldata"]["insufficient_funds"]["wifs"]
        data = binascii.hexlify(b"f483")

        def callback():
            self.api.store_nulldata(data, wifs)
        self.assertRaises(exceptions.InsufficientFunds, callback)

    def test_store_nulldata_txouts(self):
        wifs = fixtures["store_nulldata"]["txouts"]["wifs"]
        txouts = fixtures["store_nulldata"]["txouts"]["txouts"]
        expected = fixtures["store_nulldata"]["txouts"]["expected"]
        result = self.api.store_nulldata("f483", wifs, txouts=txouts)
        self.assertEqual(result, expected)

    def test_store_nulldata_change_address(self):
        _fixtures = fixtures["store_nulldata"]["change_address"]
        wifs = _fixtures["wifs"]
        change_address = _fixtures["change_address"]
        expected = _fixtures["expected"]
        result = self.api.store_nulldata("f483", wifs, change_address)
        self.assertEqual(result, expected)
开发者ID:F483,项目名称:btctxstore,代码行数:42,代码来源:other.py

示例2: Copyright

# 需要导入模块: from btctxstore import BtcTxStore [as 别名]
# 或者: from btctxstore.BtcTxStore import store_nulldata [as 别名]
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2015 Fabian Barkhau <[email protected]>
# License: MIT (see LICENSE file)

from __future__ import print_function
from __future__ import unicode_literals
import binascii
from btctxstore import BtcTxStore

# Wallet used to pay for fee. Please do not spend the testnet coins is
# this wallet or the example will fail due to lack of funds.
wifs = ["cUZfG8KJ3BrXneg2LjUX4VoMg76Fcgx6QDiAZj2oGbuw6da8Lzv1"]

# use testnet and dont post tx to blockchain for example
api = BtcTxStore(testnet=True, dryrun=True)

# store data in blockchain as nulldata output (max 40bytes)
data = binascii.hexlify(b"github.com/F483/btctxstore")
txid = api.store_nulldata(data, wifs)
print(txid)
开发者ID:F483,项目名称:btctxstore,代码行数:23,代码来源:storenulldata.py


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