diff --git a/main.py b/main.py index a710fdaf..bdb32f8d 100644 --- a/main.py +++ b/main.py @@ -275,7 +275,7 @@ def wit_serialize_transaction(transactions): tx_data += little_endian_bytes(locktime, 4) wtxid_hash = hashlib.sha256(hashlib.sha256(tx_data).digest()).digest() - wtxid_array.append(wtxid_hash[::-1].hex()) + wtxid_array.append(wtxid_hash.hex()) return wtxid_array, tx_data.hex(), wtxid_hash.hex(), wtxid_hash[::-1].hex() @@ -641,7 +641,8 @@ def main(): txids, rev_trxn_ids, ser_trxn, ser_tx_id = serialize_transaction(block_trxns) rev_wtxids, ser_wit_trxn, wtxid, rev_wtxid = wit_serialize_transaction(block_trxns) - wit_hash = merkle_root(rev_wtxids) + print(f"{len(rev_wtxids)}") + wit_hash = reverse_byte_order(merkle_root(rev_wtxids)) print(f"{wit_hash}") wit_commitment = compute_witness_commitment(wit_hash) print(f"{wit_commitment}") diff --git a/output.txt b/output.txt index 104f46be..cefb2535 100644 --- a/output.txt +++ b/output.txt @@ -1,6 +1,6 @@ -000000040000000000000000000000000000000000000000000000000000000000000000c95667aeb70083e2614a717e46413facc7c8326ee72e89a2aba08bebda457a6aa29e3166ffff001f5f420000 -010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed1ef5192773bb609ffbddfcb41c128963d584af8e9cc2fab9f1c756cf3724e74a0120000000000000000000000000000000000000000000000000000000000000000000000000 -f96765ee57c2976099a63f1a281b58d3be506130326ccc1b068940baec6242f0 +000000040000000000000000000000000000000000000000000000000000000000000000c23e3dddafe457073ed9a4fc7fb683b71344fbe34b68dc0d5e4f952651aab4f1d2b43166ffff001f00d00000 +010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed622b680b9a508edaf977077f577f010bcd6ceeb0592e30261fe089e28a461da80120000000000000000000000000000000000000000000000000000000000000000000000000 +40ad22c2edd001bef1132996dddca5b0af530a440c7155410e050014f7607add 25ce6b8d39d02471c43a804569a72015e81f3400170c1b8f5418e6938cd60b74 34845a0f5eca756d7768ee2f03186ec4d73d86f9ebeaaf96abddf8bb733641b6 93bba324688af65b727f0c9c08f0fb45e2a2389b269939b1414f4818b071c598