def create_transaction(prevtx, n, sig, value, scriptPubKey=CScript()):
    tx = CTransaction()
    assert (n < len(prevtx.vout))
    tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), sig, 4294967295))
    tx.vout.append(CTxOut(value, scriptPubKey))
    tx.calc_sha256()
    return tx
def create_transaction(prevtx, n, sig, value, scriptPubKey=CScript()):
    tx = CTransaction()
    assert (n < len(prevtx.vout))
    tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), sig, 4294967295))
    tx.vout.append(CTxOut(value, scriptPubKey))
    tx.calc_sha256()
    return tx