Why are my Signature Scripts Different from my professors?

Why are my Signature Scripts Different from my professors?

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("

class raw_tx2: version = struct.pack("

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("

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("

)

print("public_key: ", public_key) ha = rtx.version.hex() ha1 = rtx.tx_in_count.hex() ha2 = flip_byte_order(prv_txid) ha3 = struct.pack("

my output is : 01000000 01 5cd81501e2a63c942fcb24de76d4532406156c8cb10b5dcb123a1cb5be13d884 00000000 8b 48 304502207088158730ae6a7f0d6bc51e3e6ea30fb36599a5017760f222f20dee8a4d6701022100ff1636de2d06332e78532bcb8cfcb15db4bd956bd53bbe98ace82d1c2f6b9c2b014 10437078f8c4a54b67cd1724a3535cb1918bca186c7a143459c9aac35113d4a958b0d4eea6b320fa82c17147b72e0fe11c08b0054897ffb7bdb194f259b0db9e129 ffffffff 02 a086010000000000 1976a914478075922af41fb441aa0ab67e91aef27ef1e68688ac 50c3000000000000 1976a914ec06b2bf18c89706855f761d215f21f3315b399488ac 00000000

her output is: 01000000 01 5cd81501e2a63c942fcb24de76d4532406156c8cb10b5dcb123a1cb5be13d884 00000000 8b 48 304502205139475c3a1b5d6c009d1856fcc906a50e594eac92e317e989fec0fd2a1f73b8022100d36ba3cc952ef0e71df0b6f0215cdc7136e90ce6134cd21245645bbc7b63bc6a01410437078f8c4a54b67cd1724a3535cb1918bca186c7a143459c9aac35113d4a958b0d4eea6b320fa82c17147b72e0fe11c08b0054897ffb7bdb194f259b0db9e129 ffffffff 02 a086010000000000 19 76a914478075922af41fb441aa0ab67e91aef27ef1e68688ac 50c3000000000000 19 76a914ec06b2bf18c89706855f761d215f21f3315b399488ac 00000000

Can one let me know why my signature script is a not identical?

https://ift.tt/2NQzm9Y

Comments

Popular posts from this blog

sendrawtransaction and txn-mempool-conflict

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