本文整理汇总了Python中pybitcoin.make_pay_to_address_script函数的典型用法代码示例。如果您正苦于以下问题:Python make_pay_to_address_script函数的具体用法?Python make_pay_to_address_script怎么用?Python make_pay_to_address_script使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_pay_to_address_script函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: make_outputs
def make_outputs( data, inputs, change_addr, fee, tx_fee, pay_fee=True ):
"""
Make outputs for a namespace preorder:
[0] OP_RETURN with the name
[1] change address with the NAME_PREORDER sender's address
[2] pay-to-address with the *burn address* with the fee
Raise ValueError if there are not enough inputs to make the transaction
"""
dust_fee = DEFAULT_OP_RETURN_FEE + (len(inputs) + 2) * DEFAULT_DUST_FEE + tx_fee
op_fee = max(fee, DEFAULT_DUST_FEE)
dust_value = DEFAULT_DUST_FEE
bill = op_fee
if not pay_fee:
# subsidized
dust_fee = 0
op_fee = 0
dust_value = 0
bill = 0
return [
# main output
{"script_hex": make_op_return_script(str(data), format='hex'),
"value": 0},
# change address
{"script_hex": make_pay_to_address_script(change_addr),
"value": calculate_change_amount(inputs, bill, dust_fee)},
# burn address
{"script_hex": make_pay_to_address_script(BLOCKSTACK_BURN_ADDRESS),
"value": op_fee}
]
开发者ID:paulpw,项目名称:blockstack-cli,代码行数:35,代码来源:namespacepreorder.py
示例2: make_outputs
def make_outputs( data, inputs, sender_addr, op_fee, format='bin' ):
"""
Make outputs for a name preorder:
[0] OP_RETURN with the name
[1] address with the NAME_PREORDER sender's address
[2] pay-to-address with the *burn address* with the fee
NOTE: the fee must cover *all* the names
"""
outputs = [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# change address (can be subsidy key)
{"script_hex": make_pay_to_address_script(sender_addr),
"value": calculate_change_amount(inputs, 0, 0)},
# burn address
{"script_hex": make_pay_to_address_script(BLOCKSTORE_BURN_ADDRESS),
"value": op_fee}
]
dust_fee = tx_dust_fee_from_inputs_and_outputs( inputs, outputs )
outputs[1]['value'] = calculate_change_amount( inputs, op_fee, dust_fee )
return outputs
开发者ID:pombredanne,项目名称:blockstore,代码行数:27,代码来源:preorder_multi.py
示例3: check
def check( state_engine ):
# not revealed, but ready
ns = state_engine.get_namespace_reveal( "test" )
if ns is not None:
return False
ns = state_engine.get_namespace( "test" )
if ns is None:
return False
if ns['namespace_id'] != 'test':
return False
# not preordered
preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
if preorder is not None:
print json.dumps(name_rec, indent=4)
return False
# registered to new owner
name_rec = state_engine.get_name( "foo.test" )
if name_rec is None:
print "name rec is None"
return False
if name_rec['address'] != wallets[3].addr or name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[3].addr):
print json.dumps(name_rec, indent=4 )
return False
return True
开发者ID:shaowenliu,项目名称:blockstore,代码行数:31,代码来源:name_preorder_register_reregister_sameowner.py
示例4: check
def check( state_engine ):
global transfer_block
# not revealed, but ready
ns = state_engine.get_namespace_reveal( "test" )
if ns is not None:
return False
ns = state_engine.get_namespace( "test" )
if ns is None:
return False
if ns['namespace_id'] != 'test':
return False
# not preordered
for i in xrange(0, len(wallets)):
preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[i].addr), wallets[(i+1)%5].addr )
if preorder is not None:
print "preordered"
return False
# registered
name_rec = state_engine.get_name( "foo.test" )
if name_rec is None:
print "no name"
return False
# owned by
if name_rec['address'] != wallets[8].addr or name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[8].addr):
print "address/sender is wrong: got %s, %s" % (name_rec['address'], name_rec['sender'])
return False
# has new sender pubkey (from the payment key)
if name_rec['sender_pubkey'] != wallets[7].pubkey_hex:
print "wrong pubkey: %s != %s" % (name_rec['sender_pubkey'], wallets[7].pubkey_hex)
return False
# has no value hash
if name_rec['value_hash'] is not None:
print "still has value hash"
return False
# transfer happened
historic_name_rec = state_engine.get_name_at( "foo.test", transfer_block, include_expired=True )
if historic_name_rec is None or len(historic_name_rec) == 0:
print "no name at %s" % transfer_block
return False
historic_name_rec = historic_name_rec[0]
if historic_name_rec['opcode'] != "NAME_TRANSFER":
print "transfer didn't occur at %s" % transfer_block
return False
if historic_name_rec['address'] != wallets[4].addr or historic_name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[4].addr):
print "address/sender is wrong for transfer: got %s, %s" % (name_rec['address'], name_rec['sender'])
return False
return True
开发者ID:blockstack,项目名称:blockstack-integration-tests,代码行数:60,代码来源:name_import_renew_transfer_expire_reregister.py
示例5: check
def check( state_engine ):
# not revealed, but ready
ns = state_engine.get_namespace_reveal( "test" )
if ns is not None:
return False
ns = state_engine.get_namespace( "test" )
if ns is None:
return False
if ns['namespace_id'] != 'test':
return False
# not preordered
preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
if preorder is not None:
return False
# registered
name_rec = state_engine.get_name( "foo.test" )
if name_rec is None:
return False
# owned by
if name_rec['address'] != wallets[3].addr or name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[3].addr):
return False
# NOT renewed
if name_rec['last_renewed'] != name_rec['first_registered']:
print name_rec['last_renewed']
print name_rec['first_registered']
return False
return True
开发者ID:ChairmanTubeAmp,项目名称:blockstack-server,代码行数:35,代码来源:name_preorder_register_renew_cantforce.py
示例6: make_outputs
def make_outputs( data, inputs, recipient_address, sender_address, update_hash_b58, tx_fee):
"""
Builds the outputs for a name import:
* [0] is the OP_RETURN
* [1] is the new owner (recipient)
* [2] is the update hash
* [3] is the change sent to the original owner
Raise ValueError if there are not enough inputs to make the transaction
"""
dust_fee = DEFAULT_OP_RETURN_FEE + (len(inputs) + 3) * DEFAULT_DUST_FEE + tx_fee
op_fee = 2 * DEFAULT_DUST_FEE
dust_value = DEFAULT_DUST_FEE
return [
# main output
{"script_hex": make_op_return_script(str(data), format='hex'),
"value": 0},
# recipient output
{"script_hex": make_pay_to_address_script(recipient_address),
"value": dust_value},
# update hash output
{"script_hex": make_pay_to_address_script(update_hash_b58),
"value": dust_value},
# change output
{"script_hex": make_pay_to_address_script(sender_address),
"value": calculate_change_amount(inputs, op_fee, dust_fee)}
]
开发者ID:paulpw,项目名称:blockstack-cli,代码行数:32,代码来源:nameimport.py
示例7: make_outputs
def make_outputs( data, inputs, register_addr, change_addr, renewal_fee=None, format='bin' ):
"""
Make outputs for a register:
[0] OP_RETURN with the name
[1] pay-to-address with the *register_addr*, not the sender's address.
[2] change address with the NAME_PREORDER sender's address
"""
total_to_send = DEFAULT_OP_RETURN_FEE + DEFAULT_DUST_FEE
if renewal_fee is not None:
total_to_send += max(renewal_fee, DEFAULT_DUST_FEE)
outputs = [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": DEFAULT_OP_RETURN_FEE},
# register address
{"script_hex": make_pay_to_address_script(register_addr),
"value": DEFAULT_DUST_FEE},
# change address
{"script_hex": make_pay_to_address_script(change_addr),
"value": calculate_change_amount(inputs, total_to_send, (len(inputs) + 3) * DEFAULT_DUST_FEE)},
]
if renewal_fee is not None:
outputs.append(
# burn address (when renewing)
{"script_hex": make_pay_to_address_script(BLOCKSTORE_BURN_ADDRESS),
"value": max(renewal_fee, DEFAULT_DUST_FEE)}
)
return outputs
开发者ID:john-light,项目名称:blockstore,代码行数:35,代码来源:register.py
示例8: make_outputs
def make_outputs( data, inputs, change_addr, op_fee, format='bin' ):
"""
Make outputs for a namespace preorder:
[0] OP_RETURN with the name
[1] change address with the NAME_PREORDER sender's address
[2] pay-to-address with the *burn address* with the fee
"""
op_fee = max( op_fee, DEFAULT_DUST_FEE )
outputs = [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# change address
{"script_hex": make_pay_to_address_script(change_addr),
"value": calculate_change_amount(inputs, 0, 0)},
# burn address
{"script_hex": make_pay_to_address_script(BLOCKSTORE_BURN_ADDRESS),
"value": op_fee}
]
dust_fee = tx_dust_fee_from_inputs_and_outputs( inputs, outputs )
outputs[1]['value'] = calculate_change_amount( inputs, op_fee, dust_fee )
return outputs
开发者ID:pombredanne,项目名称:blockstore,代码行数:28,代码来源:namespacepreorder.py
示例9: make_outputs
def make_outputs( data, inputs, change_addr, fee, pay_fee=True, format='bin' ):
"""
Make outputs for a namespace preorder:
[0] OP_RETURN with the name
[1] change address with the NAME_PREORDER sender's address
[2] pay-to-address with the *burn address* with the fee
"""
dust_fee = DEFAULT_OP_RETURN_FEE + (len(inputs) + 2) * DEFAULT_DUST_FEE
op_fee = max(fee, DEFAULT_DUST_FEE)
dust_value = DEFAULT_DUST_FEE
bill = op_fee
if not pay_fee:
# subsidized
dust_fee = 0
op_fee = 0
dust_value = 0
bill = 0
return [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# change address
{"script_hex": make_pay_to_address_script(change_addr),
"value": calculate_change_amount(inputs, bill, dust_fee)},
# burn address
{"script_hex": make_pay_to_address_script(BLOCKSTORE_BURN_ADDRESS),
"value": op_fee}
]
开发者ID:shaowenliu,项目名称:blockstore,代码行数:34,代码来源:namespacepreorder.py
示例10: make_outputs
def make_outputs( data, inputs, sender_addr, fee, format='bin' ):
"""
Make outputs for a name preorder:
[0] OP_RETURN with the name
[1] address with the NAME_PREORDER sender's address
[2] pay-to-address with the *burn address* with the fee
"""
op_fee = max(fee, DEFAULT_DUST_FEE)
dust_fee = (len(inputs) + 2) * DEFAULT_DUST_FEE + DEFAULT_OP_RETURN_FEE
dust_value = DEFAULT_DUST_FEE
bill = op_fee
return [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# change address (can be subsidy key)
{"script_hex": make_pay_to_address_script(sender_addr),
"value": calculate_change_amount(inputs, bill, dust_fee)},
# burn address
{"script_hex": make_pay_to_address_script(BLOCKSTORE_BURN_ADDRESS),
"value": op_fee}
]
开发者ID:shaowenliu,项目名称:blockstore,代码行数:27,代码来源:preorder.py
示例11: make_outputs
def make_outputs( data, inputs, recipient_address, sender_address, update_hash_b58, format='bin'):
"""
Builds the outputs for a name import:
* [0] is the OP_RETURN
* [1] is the new owner (recipient)
* [2] is the update hash
* [3] is the change sent to the original owner
"""
dust_value = DEFAULT_DUST_FEE
outputs = [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# recipient output
{"script_hex": make_pay_to_address_script(recipient_address),
"value": dust_value},
# update hash output
{"script_hex": make_pay_to_address_script(update_hash_b58),
"value": dust_value},
# change output
{"script_hex": make_pay_to_address_script(sender_address),
"value": calculate_change_amount(inputs, 0, 0)}
]
dust_fee = tx_dust_fee_from_inputs_and_outputs( inputs, outputs )
outputs[-1]['value'] = calculate_change_amount( inputs, 2*dust_value, dust_fee )
return outputs
开发者ID:pombredanne,项目名称:blockstore,代码行数:32,代码来源:nameimport.py
示例12: check
def check( state_engine ):
# not revealed, but ready
ns = state_engine.get_namespace_reveal( "test" )
if ns is not None:
print "'test' not revealed"
return False
ns = state_engine.get_namespace( "test" )
if ns is None:
print "'test' not found"
return False
if ns['namespace_id'] != 'test':
print "'test' not returned"
return False
# not preordered
preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
if preorder is not None:
print "'foo.test' still preordered"
return False
# registered
name_rec = state_engine.get_name( "foo.test" )
if name_rec is None:
print "'foo.test' not registered"
return False
# transferred
if name_rec['address'] != wallets[4].addr or name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[4].addr):
print "'foo.test' invalid owner"
return False
return True
开发者ID:ChairmanTubeAmp,项目名称:blockstack-server,代码行数:35,代码来源:name_preorder_register_transfer.py
示例13: do_interleaving
def do_interleaving( name, namerecs, order ):
# order should be a string of "u", "t", and "r"
order = list(order)
for i in xrange(0, len(order)):
op = order[i]
if op == 'r':
# renew
print "\nrenew '%s' with %s\n" % (name, pybitcoin.make_pay_to_address_script( namerecs[name][0].addr ))
resp = testlib.blockstack_name_renew( name, namerecs[name][0].privkey, register_addr=namerecs[name][0].addr )
if 'error' in resp:
print json.dumps( resp, indent=4 )
elif op == 'u':
# update
resp = testlib.blockstack_name_update( name, ("%s%s" % (i, i)) * 20, namerecs[name][0].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
elif op == 't':
# transfer and exchange wallets
print "\ntransfer '%s' from %s to %s" % (name, pybitcoin.make_pay_to_address_script( namerecs[name][0].addr ), pybitcoin.make_pay_to_address_script( namerecs[name][1].addr ))
resp = testlib.blockstack_name_transfer( name, namerecs[name][1].addr, True, namerecs[name][0].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
tmp = namerecs[name][0]
namerecs[name][0] = namerecs[name][1]
namerecs[name][1] = tmp
开发者ID:ChairmanTubeAmp,项目名称:blockstack-server,代码行数:32,代码来源:name_preorder_register_update_transfer_renew_interleaving.py
示例14: make_outputs
def make_outputs( data, inputs, reveal_addr, change_addr, format='bin', testset=False ):
"""
Make outputs for a register:
[0] OP_RETURN with the name
[1] pay-to-address with the *reveal_addr*, not the sender's address.
[2] change address with the NAMESPACE_PREORDER sender's address
"""
outputs = [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# register address
{"script_hex": make_pay_to_address_script(reveal_addr),
"value": DEFAULT_DUST_FEE},
# change address
{"script_hex": make_pay_to_address_script(change_addr),
"value": calculate_change_amount(inputs, 0, 0)},
]
dust_fee = tx_dust_fee_from_inputs_and_outputs( inputs, outputs )
outputs[-1]['value'] = calculate_change_amount( inputs, DEFAULT_DUST_FEE, dust_fee )
return outputs
开发者ID:pombredanne,项目名称:blockstore,代码行数:25,代码来源:namespacereveal.py
示例15: check
def check(state_engine):
# not revealed, but ready
ns = state_engine.get_namespace_reveal("test")
if ns is not None:
return False
ns = state_engine.get_namespace("test")
if ns is None:
return False
if ns["namespace_id"] != "test":
return False
# not preordered
preorder = state_engine.get_name_preorder(
"foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr
)
if preorder is not None:
return False
# registered
name_rec = state_engine.get_name("foo.test")
if name_rec is None:
return False
# owned by
if name_rec["address"] != wallets[3].addr or name_rec["sender"] != pybitcoin.make_pay_to_address_script(
wallets[3].addr
):
return False
return True
开发者ID:reddink,项目名称:blockstore,代码行数:33,代码来源:name_preorder_register.py
示例16: make_outputs
def make_outputs( data, inputs, recipient_address, sender_address, update_hash_b58, format='bin'):
"""
Builds the outputs for a name import:
* [0] is the OP_RETURN
* [1] is the new owner (recipient)
* [2] is the update hash
* [3] is the change sent to the original owner
"""
dust_fee = DEFAULT_OP_RETURN_FEE + (len(inputs) + 3) * DEFAULT_DUST_FEE
op_fee = 2 * DEFAULT_DUST_FEE
dust_value = DEFAULT_DUST_FEE
return [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# recipient output
{"script_hex": make_pay_to_address_script(recipient_address),
"value": dust_value},
# update hash output
{"script_hex": make_pay_to_address_script(update_hash_b58),
"value": dust_value},
# change output
{"script_hex": make_pay_to_address_script(sender_address),
"value": calculate_change_amount(inputs, op_fee, dust_fee)}
]
开发者ID:ChairmanTubeAmp,项目名称:blockstack-server,代码行数:30,代码来源:nameimport.py
示例17: check
def check( state_engine ):
# not revealed, but ready
ns = state_engine.get_namespace_reveal( "test" )
if ns is not None:
return False
ns = state_engine.get_namespace( "test" )
if ns is None:
return False
if ns['namespace_id'] != 'test':
return False
# not preordered
preorder = state_engine.get_name_preorder( "foo.test", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
if preorder is not None:
return False
# registered
name_rec = state_engine.get_name( "foo.test" )
if name_rec is None:
return False
# updated, and data is preserved
if name_rec['value_hash'] != '11' * 20:
return False
# transferred
if name_rec['address'] != wallets[4].addr or name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[4].addr):
return False
return True
开发者ID:reddink,项目名称:blockstore,代码行数:33,代码来源:name_preorder_register_update_transfer_verify.py
示例18: make_outputs
def make_outputs( data, inputs, new_name_owner_address, change_address, pay_fee=True, format='bin' ):
"""
Builds the outputs for a name transfer operation.
"""
dust_fee = None
op_fee = None
dust_value = DEFAULT_DUST_FEE
if pay_fee:
dust_fee = (len(inputs) + 2) * DEFAULT_DUST_FEE + DEFAULT_OP_RETURN_FEE
op_fee = DEFAULT_DUST_FEE
else:
dust_fee = 0
op_fee = 0
return [
# main output
{"script_hex": make_op_return_script(data, format=format),
"value": 0},
# new name owner output
{"script_hex": make_pay_to_address_script(new_name_owner_address),
"value": dust_value},
# change output
{"script_hex": make_pay_to_address_script(change_address),
"value": calculate_change_amount(inputs, op_fee, dust_fee)}
]
开发者ID:ChairmanTubeAmp,项目名称:blockstack-server,代码行数:28,代码来源:transfer.py
示例19: make_outputs
def make_outputs( data, inputs, new_name_owner_address, change_address, tx_fee=0, pay_fee=True):
"""
Builds the outputs for a name transfer operation.
Raise ValueError if there are not enough inputs to make the transaction
"""
dust_fee = None
op_fee = None
dust_value = DEFAULT_DUST_FEE
if pay_fee:
dust_fee = (len(inputs) + 2) * DEFAULT_DUST_FEE + DEFAULT_OP_RETURN_FEE + tx_fee
op_fee = DEFAULT_DUST_FEE
else:
dust_fee = 0
op_fee = 0
return [
# main output
{"script_hex": make_op_return_script(str(data), format='hex'),
"value": 0},
# new name owner output
{"script_hex": make_pay_to_address_script(new_name_owner_address),
"value": dust_value},
# change output
{"script_hex": make_pay_to_address_script(change_address),
"value": calculate_change_amount(inputs, op_fee, dust_fee)}
]
开发者ID:paulpw,项目名称:blockstack-cli,代码行数:29,代码来源:transfer.py
示例20: check
def check( state_engine ):
# not revealed, but ready
ns = state_engine.get_namespace_reveal( "id" )
if ns is not None:
print "namespace reveal exists"
return False
ns = state_engine.get_namespace( "id" )
if ns is None:
print "no namespace"
return False
if ns['namespace_id'] != 'id':
print "wrong namespace"
return False
# not preordered
preorder = state_engine.get_name_preorder( "foo.id", pybitcoin.make_pay_to_address_script(wallets[2].addr), wallets[3].addr )
if preorder is not None:
print "preorder exists"
return False
# registered
name_rec = state_engine.get_name( "foo.id" )
if name_rec is None:
print "name does not exist"
return False
# owned by
if name_rec['address'] != wallets[3].addr or name_rec['sender'] != pybitcoin.make_pay_to_address_script(wallets[3].addr):
print "sender is wrong"
return False
return True
开发者ID:destenson,项目名称:blockstack--blockstack-server,代码行数:35,代码来源:name_preorder_register_portal_auth.py
注:本文中的pybitcoin.make_pay_to_address_script函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论