本文整理汇总了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())
示例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())
示例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()
示例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)