Return one-input, one-output transaction object spending the prevtx's n-th output with the given amount. Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend ouput.
(prevtx, n, script_sig=b"", *, amount, script_pub_key=CScript())
| 119 | return coinbase |
| 120 | |
| 121 | def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, script_pub_key=CScript()): |
| 122 | """Return one-input, one-output transaction object |
| 123 | spending the prevtx's n-th output with the given amount. |
| 124 | |
| 125 | Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend ouput. |
| 126 | """ |
| 127 | tx = CTransaction() |
| 128 | assert(n < len(prevtx.vout)) |
| 129 | tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), script_sig, 0xffffffff)) |
| 130 | tx.vout.append(CTxOut(amount, script_pub_key)) |
| 131 | tx.calc_sha256() |
| 132 | return tx |
| 133 | |
| 134 | def create_transaction(node, txid, to_address, *, amount): |
| 135 | """ Return signed transaction spending the first output of the |
no test coverage detected