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


Python Transaction.pay_script方法代码示例

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


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

示例1: make_unsigned_request

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import pay_script [as 别名]
def make_unsigned_request(req):
    from transaction import Transaction
    addr = req['address']
    time = req.get('time', 0)
    exp = req.get('exp', 0)
    if time and type(time) != int:
        time = 0
    if exp and type(exp) != int:
        exp = 0
    amount = req['amount']
    if amount is None:
        amount = 0
    memo = req['memo']
    script = Transaction.pay_script('address', addr).decode('hex')
    outputs = [(script, amount)]
    pd = pb2.PaymentDetails()
    for script, amount in outputs:
        pd.outputs.add(amount=amount, script=script)
    pd.time = time
    pd.expires = time + exp if exp else 0
    pd.memo = memo
    pr = pb2.PaymentRequest()
    pr.serialized_payment_details = pd.SerializeToString()
    pr.signature = ''
    return pr
开发者ID:FuzzyHobbit,项目名称:electrum,代码行数:27,代码来源:paymentrequest.py

示例2: make_request

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import pay_script [as 别名]
def make_request(config, req):
    from transaction import Transaction
    addr = req['address']
    time = req['timestamp']
    amount = req['amount']
    expiration = req['expiration']
    message = req['memo']
    script = Transaction.pay_script('address', addr).decode('hex')
    outputs = [(script, amount)]
    key_path = config.get('ssl_privkey')
    cert_path = config.get('ssl_chain')
    return make_payment_request(outputs, message, time, time + expiration if expiration else None, key_path, cert_path)
开发者ID:alkiswani,项目名称:electrum,代码行数:14,代码来源:paymentrequest.py

示例3: sweep

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import pay_script [as 别名]
 def sweep(self, privkey, to_address, fee = 0.0001):
     pubkey = public_key_from_private_key(privkey)
     address = address_from_private_key(privkey)
     pay_script = Transaction.pay_script(address)
     unspent = self.network.synchronous_get([ ('blockchain.address.listunspent',[address])])[0]
     if not unspent:
         return
     total = sum( map(lambda x:int(x.get('value')), unspent) ) - int(Decimal(fee)*100000000)
     inputs = map(lambda i: {'prevout_hash': i['tx_hash'], 'prevout_n':i['tx_pos'], 'scriptPubKey':pay_script, 'redeemPubkey':pubkey}, unspent)
     outputs = [(to_address, total)]
     tx = Transaction.from_io(inputs, outputs)
     tx.sign({ pubkey:privkey })
     return tx
开发者ID:RagnarDanneskjold,项目名称:electrum-ltc,代码行数:15,代码来源:commands.py

示例4: make_unsigned_request

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import pay_script [as 别名]
def make_unsigned_request(req):
    from transaction import Transaction
    addr = req['address']
    time = req['timestamp']
    amount = req['amount']
    if amount is None:
        amount = 0
    expires = req['expiration']
    memo = req['memo']
    script = Transaction.pay_script('address', addr).decode('hex')
    outputs = [(script, amount)]
    pd = pb2.PaymentDetails()
    for script, amount in outputs:
        pd.outputs.add(amount=amount, script=script)
    pd.time = time
    pd.expires = time + expires if expires else 0
    pd.memo = memo
    pr = pb2.PaymentRequest()
    pr.serialized_payment_details = pd.SerializeToString()
    pr.signature = ''
    return pr
开发者ID:rnicoll,项目名称:electrum,代码行数:23,代码来源:paymentrequest.py


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