If there are 50 inputs on a transaction and there are 5 outputs can that be a multsig transactions?

If there are 50 inputs on a transaction and there are 5 outputs can that be a multsig transactions?
bob_addr = "1NWzVg38ggPoVGAG2VWt6ktdWMaV6S1pJk"#"1FMb8Jnn1jSh7yjDFfonC8xCCH3ittoEzB"
bob_hashed_pubkey = base58check.b58decode(bob_addr)[1:]
bob2_hashed_pubkey = b'\xec\x06\xb2\xbf\x18\xc8\x97\x06\x85_v\x1d!_!\xf31[9\x94'.hex()
bob3_hashed_pubkey =codecs.encode(bob_hashed_pubkey, 'hex')
print("bob_hashed_pubkey: ", bob2_hashed_pubkey )

bob_private_key = "CF933A6C602069F1CBC85990DF087714D7E86DF0D0E48398B7D8953E1F03534A"

prv_txid = "84d813beb51c3a12cb5d0bb18c6c15062453d476de24cb2f943ca6e20115d85c"

charlie_addr = "17X4s8JdSdLxFyraNUDBzgmnSNeZpjm42g"
charlie_hashed_pubkey = base58check.b58decode(charlie_addr)[1:]
charlie2_hashed_pubkey = b'G\x80u\x92*\xf4\x1f\xb4A\xaa\n\xb6~\x91\xae\xf2~\xf1\xe6\x86'.hex()

class raw_tx:
    version        = struct.pack("<L", 1)
    tx_in_count    = struct.pack("<B", 1)
    tx_in          = {}
    tx_out_count   = struct.pack("<B", 2)
    tx_out1         = {}
    tx_out2         = {}
    lock_time      = struct.pack("<L", 0)
    hashcode       = struct.pack("<L", 1)
    nonce          = struct.pack("Q", 0)

class raw_tx2:
    version        = struct.pack("<L", 1)
    lock_time      = struct.pack("<L", 0)
    hashcode       = struct.pack("<L", 1)

def flip_byte_order(string):
    flipped = "".join(reversed([string[i:i+2] for i in range(0, len(string), 2)]))
    return flipped

rtx    = raw_tx()

rtx.tx_in["txouthash"]   = codecs.decode(flip_byte_order(prv_txid), 'hex')
rtx.tx_in["tx_out_index"] = struct.pack("<L", 0)
rtx.tx_in["script"]      = codecs.decode(("76a914%s88ac" % bob2_hashed_pubkey), 'hex')
rtx.tx_in["script_bytes"]= struct.pack("<B", len(rtx.tx_in["script"]))
rtx.tx_in["sequence"]     = codecs.decode("ffffffff", 'hex')
rtx.tx_out1["value"]           = struct.pack("<Q", 100000)
rtx.tx_out1["pk_script"]       = codecs.decode(("76a914%s88ac" % charlie2_hashed_pubkey), 'hex')
rtx.tx_out1["pk_script_bytes"] = struct.pack("<B", len(rtx.tx_out1["pk_script"]))
rtx.tx_out2["value"]           = struct.pack("<Q", 50000)
rtx.tx_out2["pk_script"]       = codecs.decode(("76a914%s88ac" % bob2_hashed_pubkey), 'hex')
rtx.tx_out2["pk_script_bytes"] = struct.pack("<B", len(rtx.tx_out2["pk_script"]))

raw_tx_string = (

    rtx.version +
    rtx.tx_in_count +
    rtx.tx_in["txouthash"] +
    rtx.tx_in["tx_out_index"]+
    rtx.tx_in["script_bytes"]+
    rtx.tx_in["script"] +
    rtx.tx_in["sequence"]+
    rtx.tx_out_count +
    rtx.tx_out1["value"]+
    rtx.tx_out1["pk_script_bytes"]+
    rtx.tx_out1["pk_script"]+
    rtx.tx_out2["value"]+
    rtx.tx_out2["pk_script_bytes"]+
    rtx.tx_out2["pk_script"]+
    rtx.lock_time +
    struct.pack("<L", 1)  

)

hashed_tx_to_sign = hashlib.sha256(hashlib.sha256(raw_tx_string).digest()).digest()
sk = ecdsa.SigningKey.from_string(codecs.decode(bob_private_key, 'hex'), curve = ecdsa.SECP256k1)
vk = sk.verifying_key
public_key = (b'\04'.hex() + vk.to_string().hex())
signature = sk.sign_digest(hashed_tx_to_sign, sigencode=ecdsa.util.sigencode_der)
sigscript = (
     signature
     + b'\01' 
     + struct.pack("<B", len(codecs.decode(public_key, 'hex')))
     + codecs.decode(public_key, 'hex')

    )
print("public_key: ", public_key)
ha  = rtx.version.hex()
ha1 = rtx.tx_in_count.hex()
ha2 = flip_byte_order(prv_txid)
ha3 = struct.pack("<L", 0).hex()
ha4 = struct.pack("<B", len(sigscript) + 1).hex()
ha40 = struct.pack("<B", len(signature) + 1).hex()
ha5 = sigscript.hex()
ha6 = 'ffffffff'
ha7 = rtx.tx_out_count.hex()
ha8 = struct.pack("<Q", 100000).hex()
ha9 = struct.pack("<B", len(rtx.tx_out1["pk_script"])).hex()
ha10 = ('76a914%s88ac' % charlie2_hashed_pubkey)
ha11 = struct.pack("<Q", 50000).hex()
ha12 = struct.pack("<B", len(rtx.tx_out2["pk_script"])).hex()
ha13 = ('76a914%s88ac' % bob2_hashed_pubkey)
ha14 = rtx.lock_time.hex()
my output is :
https://ift.tt/2mNEb8O

Comments

Popular posts from this blog

sendrawtransaction and txn-mempool-conflict

couldn't connect to server: EOF reached (code 1)