Skip to content

Commit

Permalink
merkle
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavitra Agarwal authored and Pavitra Agarwal committed Apr 30, 2024
1 parent 6ad5459 commit 25e16b9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Binary file modified __pycache__/tx.cpython-312.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ def initializeTxn(txex , segwitness) :
# print(txids)



txinlittle = [little_endian_to_big_endian_txid(tx) for tx in txids]
txides = [h[::-1] for h in txids]
txinlittle = [little_endian_to_big_endian_txid(tx) for tx in txides]
merklebigedian = big_endian_to_little_endian_txid(merkle_root(txinlittle).hex())

# print(little_endian_to_big_endian_txid(txids[0]).hex())
Expand Down
2 changes: 1 addition & 1 deletion output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
020000200000000000000000000000000000000000000000000000000000000000000000e016e1851957a9a69e138c34bf5c67fdf83581514903d012886f1c3d9d0c54aa6b5a3066ffff001f9861bea1
020000200000000000000000000000000000000000000000000000000000000000000000d2bc7e0fa5eb79224ebfaf16f5b618bfa03fde212347e42efd3a45d4ee0cac7111613066ffff001f2ea3fbc7
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff6a47304402201f6e9296e322013f90f89433926509a9ff686ce91452679c82c921cf18257c95022027497b1354b4dce14b3e15d2372c69d6323ecfad9cbc0c8bb20d8d8d088fc22001210224c6633127ca04e9b678ae7d106a9828ba2aed9a402eefae69f52fbe7a065699ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed0743cafb2ad89219798f1b2651467d2f6256998e493800f2560784f5f1bcd4670120000000000000000000000000000000000000000000000000000000000000000000000000
FD0600
49a6af777488f947e2b6e2e0ab87f56f44cbfe8280c4dfd9c7c5d9c1b1291f10
Expand Down
3 changes: 3 additions & 0 deletions tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def wtxid(self) : # used to find the wxtid
return (hash256(self.serialize_segwit())[::-1]).hex() # used in the formation of the witness commitment

# tag::source5[]
def hash256for(self) :
return hash256(self.serialize_legacy())

def hash(self):
return hash256(self.serialize_legacy())[::-1]
# currently only serialixe the transaction using the
Expand Down

0 comments on commit 25e16b9

Please sign in to comment.