Пример #1
0
def build_spending_tx(script_in_bin, credit_tx):
    txs_in = [
        network.tx.TxIn(credit_tx.hash(),
                        0,
                        script_in_bin,
                        sequence=4294967295)
    ]
    txs_out = [network.tx.TxOut(credit_tx.txs_out[0].coin_value, b'')]
    spend_tx = network.tx(1,
                          txs_in,
                          txs_out,
                          unspents=credit_tx.tx_outs_as_spendable())
    return spend_tx
Пример #2
0
def main():
    if len(sys.argv) != 2:
        print("usage: %s address" % sys.argv[0])
        sys.exit(-1)

    # validate the address
    address = sys.argv[1]
    assert network.parse.address(address) is not None

    print("creating coinbase transaction to %s" % address)

    tx_in = network.tx.TxIn.coinbase_tx_in(script=b'')
    tx_out = network.tx.TxOut(50 * 1e8, network.contract.for_address(address))
    tx = network.tx(1, [tx_in], [tx_out])
    print("Here is the tx as hex:\n%s" % tx.as_hex())
Пример #3
0
def main():
    if len(sys.argv) != 2:
        print("usage: %s address" % sys.argv[0])
        sys.exit(-1)

    # validate the address
    address = sys.argv[1]
    assert network.parse.address(address) is not None

    print("creating coinbase transaction to %s" % address)

    tx_in = network.tx.TxIn.coinbase_tx_in(script=b'')
    tx_out = network.tx.TxOut(50*1e8, network.contract.for_address(address))
    tx = network.tx(1, [tx_in], [tx_out])
    print("Here is the tx as hex:\n%s" % tx.as_hex())
Пример #4
0
def build_credit_tx(script_out_bin, coin_value=0):
    txs_in = [
        network.tx.TxIn(b'\0' * 32, 4294967295, b'\0\0', sequence=4294967295)
    ]
    txs_out = [network.tx.TxOut(coin_value, script_out_bin)]
    return network.tx(1, txs_in, txs_out)
Пример #5
0
def build_spending_tx(script_in_bin, credit_tx):
    txs_in = [network.tx.TxIn(credit_tx.hash(), 0, script_in_bin, sequence=4294967295)]
    txs_out = [network.tx.TxOut(credit_tx.txs_out[0].coin_value, b'')]
    spend_tx = network.tx(1, txs_in, txs_out, unspents=credit_tx.tx_outs_as_spendable())
    return spend_tx
Пример #6
0
def build_credit_tx(script_out_bin, coin_value=0):
    txs_in = [network.tx.TxIn(b'\0'*32, 4294967295, b'\0\0', sequence=4294967295)]
    txs_out = [network.tx.TxOut(coin_value, script_out_bin)]
    return network.tx(1, txs_in, txs_out)