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


Python BIP32Node.from_text方法代码示例

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


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

示例1: sign_transaction

# 需要导入模块: from pycoin.key.BIP32Node import BIP32Node [as 别名]
# 或者: from pycoin.key.BIP32Node.BIP32Node import from_text [as 别名]
    def sign_transaction(self, tx, master_password, path=''):
        """
        Args:
            tx: hex transaction to sign
            master_password: master password for BIP32 wallets. Can be either a
                master_secret or a wif
            path (Optional[str]): optional path to the leaf address of the
                BIP32 wallet. This allows us to retrieve private key for the
                leaf address if one was used to construct the transaction.
        Returns:
            signed transaction

        .. note:: Only BIP32 hierarchical deterministic wallets are currently
            supported.

        """
        netcode = 'XTN' if self.testnet else 'BTC'

        # TODO review
        # check if its a wif
        try:
            BIP32Node.from_text(master_password)
            return bitcoin.signall(tx, master_password)
        except (AttributeError, EncodingError):
            # if its not get the wif from the master secret
            return bitcoin.signall(tx, BIP32Node.from_master_secret(master_password, netcode=netcode).subkey_for_path(path).wif())
开发者ID:amiromayer,项目名称:transactions,代码行数:28,代码来源:transactions.py

示例2: sign_transaction

# 需要导入模块: from pycoin.key.BIP32Node import BIP32Node [as 别名]
# 或者: from pycoin.key.BIP32Node.BIP32Node import from_text [as 别名]
    def sign_transaction(self, tx, master_password, path=''):
        # master_password can be either a master_secret or a wif
        netcode = 'XTN' if self.testnet else 'BTC'

        # check if its a wif
        try:
            BIP32Node.from_text(master_password)
            return pybitcointools.signall(tx, master_password)
        except EncodingError:
            # if its not get the wif from the master secret
            return pybitcointools.signall(tx, BIP32Node.from_master_secret(master_password, netcode=netcode).subkey_for_path(path).wif())
开发者ID:jaksco,项目名称:transactions,代码行数:13,代码来源:transactions.py

示例3: generate_revocation_addresses

# 需要导入模块: from pycoin.key.BIP32Node import BIP32Node [as 别名]
# 或者: from pycoin.key.BIP32Node.BIP32Node import from_text [as 别名]
def generate_revocation_addresses(config):
    key_path = config.key_path if config.key_path else ''
    output_handle = open(config.output_file, 'w') if config.output_file else sys.stdout

    try:
        key = BIP32Node.from_text(config.extended_public_key)
    except:
        print('The extended public (or private) key seems invalid.')
        sys.exit()
    key_path_batch = key.subkey_for_path(key_path)
    for i in range(config.number_of_addresses):
        subkey = key_path_batch.subkey(i)
        output_handle.write("{0}\n".format(subkey.address(config.use_uncompressed)))

    if output_handle is not sys.stdout:
        output_handle.close()
开发者ID:NiclausLiu,项目名称:cert-tools,代码行数:18,代码来源:create_revocation_addresses.py

示例4: Flask

# 需要导入模块: from pycoin.key.BIP32Node import BIP32Node [as 别名]
# 或者: from pycoin.key.BIP32Node.BIP32Node import from_text [as 别名]
# change the receiving_key in config.py in the root folder.
from config import receiving_key, SATOSHIS_PER_MINUTE, BitCoreURL
from pycoin.key.BIP32Node import BIP32Node
from sqlalchemy.sql.functions import func

# logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.ERROR)

auth_app = Flask(__name__, static_folder='static')
#auth_app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/wifiportal21.db'
auth_app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://wifiportal:[email protected]/wifiportal'

db = SQLAlchemy(auth_app)

receiving_account = BIP32Node.from_text(receiving_key)


SATOSHIS_PER_MBTC = 100 * 10 ** 3
SATOSHIS_PER_BTC = 100 * 10 ** 6

STATUS_NONE = 0
STATUS_PAYREQ = 1
STATUS_PAID = 2

RECEIVING = 0

class Guest(db.Model):
    uuid = db.Column(db.String(255), primary_key=True)
    mac = db.Column(db.String(17), unique=True)
    address = db.Column(db.String(40), unique=True)
开发者ID:Unepic,项目名称:wifiportal21,代码行数:32,代码来源:auth_server.py


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