From cbb15391c6308864655bca3759bb69ed16f0333e Mon Sep 17 00:00:00 2001 From: shivamgupta2020 Date: Thu, 25 Apr 2024 02:58:31 +0530 Subject: [PATCH] updated --- coinbase_transaction.js | 10 ++++++---- create_merkle_wtxid.js | 5 ++--- output.txt | 6 +++--- trxnid_segwit.js | 1 - txids_generator.js | 4 ++-- val_trxn.js | 2 -- x.json | 34 ++++++++++++++++++++++++++++++++++ 7 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 x.json diff --git a/coinbase_transaction.js b/coinbase_transaction.js index 4b075b2..11e1898 100644 --- a/coinbase_transaction.js +++ b/coinbase_transaction.js @@ -45,7 +45,7 @@ // // 1976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac // // 0000000000000000 // // 2e6a -// 2437dc177a1cd15bec5e1e62ed683c20ea76d3209ad5a96b2b6bd7e7db30aeb288// merkle root hash +// 0592eef8300bc4070cb745ed012a5f76243ec6a3b2c490fbcded312eaece67f3// merkle root hash // 0000000000000000000000000000000000000000000000000000000000000000//wtxid commitment // 2437dc177a1cd15bec5e1e62ed683c20ea76d3209ad5a96b2b6bd7e7db30aeb2880000000000000000000000000000000000000000000000000000000000000000 // // 0120 @@ -65,7 +65,9 @@ // 00000000 -const final = "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed9b404e6630fbc3aefeb4cd2eba86a0471caeb5da0beddf8774ed29b64e99ac2400000000" -const final_serialized = "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed9b404e6630fbc3aefeb4cd2eba86a0471caeb5da0beddf8774ed29b64e99ac240120000000000000000000000000000000000000000000000000000000000000000000000000" +const final = "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f600000000" +const final_serialized = "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f60120000000000000000000000000000000000000000000000000000000000000000000000000" -module.exports = {final,final_serialized} \ No newline at end of file +module.exports = {final,final_serialized} +//aa21a9ed +//4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f6 wtxid commitment diff --git a/create_merkle_wtxid.js b/create_merkle_wtxid.js index 9d910dd..f8c086d 100644 --- a/create_merkle_wtxid.js +++ b/create_merkle_wtxid.js @@ -2,7 +2,7 @@ const crypto = require('crypto'); const {wtxids} = require('./txids_generator.js'); const { hash256 } = require('./utils.js'); -// + function buildMerkleTree(transaction) { transaction.unshift("0000000000000000000000000000000000000000000000000000000000000000"); @@ -31,5 +31,4 @@ function buildMerkleTree(transaction) { } const merkleRoot_wtxid = buildMerkleTree(wtxids); -console.log(merkleRoot_wtxid); -module.exports = {merkleRoot_wtxid} \ No newline at end of file +module.exports = {merkleRoot_wtxid} diff --git a/output.txt b/output.txt index 6598aa9..27d5e17 100644 --- a/output.txt +++ b/output.txt @@ -1,6 +1,6 @@ -02000000000000000000000000000000000000000000000000000000000000000000000030eea806c8cd688a03b5149972b71e41fc32411654d912dcc1f0228be61ec343066a2966000000004e3d0100 -010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed9b404e6630fbc3aefeb4cd2eba86a0471caeb5da0beddf8774ed29b64e99ac240120000000000000000000000000000000000000000000000000000000000000000000000000 -2783810b0b2c47d18ea4643de5340ecc1ad6b9856ec15bf51ac97b8325db6266 +0200000000000000000000000000000000000000000000000000000000000000000000009a8daecb9ab72fc4798d27b5c53f7df09d1257c2e26c086c5e1a097e8870daec6c7929660000000066300000 +010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f60120000000000000000000000000000000000000000000000000000000000000000000000000 +4a07ff9a6c014d80c867f9638d2c14c762476808c4d4003115202a008fc6ef59 abbd27ad7244b4a3a609cb3397723be4f0bd3c03ffb6d63951a253475dbee7ed 32a84a28b78317126ab176a2d0b8675f38a05689e40de6055db78836d93a6375 bc288e69c9bd6846d107c9c7c398ea26e817bdabada45ddbd3a505d913644e7c diff --git a/trxnid_segwit.js b/trxnid_segwit.js index 5e15f78..6c71694 100644 --- a/trxnid_segwit.js +++ b/trxnid_segwit.js @@ -67,5 +67,4 @@ function segwit_serialized(trxn){ const serialized = serialize_trxn_segwit(trxn); return serialized; } - module.exports = {segwit_serialized, segwit_trxnid}; \ No newline at end of file diff --git a/txids_generator.js b/txids_generator.js index a267c26..7a512fc 100644 --- a/txids_generator.js +++ b/txids_generator.js @@ -6,7 +6,7 @@ const { segwit_wtrxnid } = require('./wtxid_segwit.js'); //add a txid in front of the valid_transactions array function txids_generator() { - var txids_array = ["6662db25837bc91af55bc16e85b9d61acc0e34e53d64a48ed1472c0b0b818327"]; + var txids_array = ["59efc68f002a20153100d4c408684762c7142c8d63f967c8804d016c9aff074a"]; valid_transactions.forEach(transaction => { { txids_array.push(segwit_trxnid(transaction)); @@ -27,4 +27,4 @@ function wtxids_generator(){ const txids = txids_generator(valid_transactions); const wtxids = wtxids_generator(valid_transactions); -module.exports = { txids,wtxids}; +module.exports = {txids, wtxids}; diff --git a/val_trxn.js b/val_trxn.js index 3cf5459..732f58c 100644 --- a/val_trxn.js +++ b/val_trxn.js @@ -1,7 +1,5 @@ const allTransactions = require('./read_txn.js'); const crypto = require('crypto'); -const { bigToLittleEndian } = require('./utils.js'); -const { createAddress_p2pkh, createAddress_p2sh } = require('./utils.js'); const { ecdsa_verify_p2wpkh } = require('./p2wpkh_message.js'); console.log(allTransactions.length); diff --git a/x.json b/x.json new file mode 100644 index 0000000..b37775d --- /dev/null +++ b/x.json @@ -0,0 +1,34 @@ +{ + "version": 2, + "locktime": 0, + "vin": [ + { + "txid": "8c655da543f574b6af8b1cdeb15cf3cdee89395e43c574264521e81f6ede533a", + "vout": 54, + "prevout": { + "scriptpubkey": "00149c628aaca2a3bd3373ebfdc29b33ca816d23094e", + "scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 9c628aaca2a3bd3373ebfdc29b33ca816d23094e", + "scriptpubkey_type": "v0_p2wpkh", + "scriptpubkey_address": "bc1qn33g4t9z5w7nxultlhpfkv72s9kjxz2wksp96r", + "value": 88070 + }, + "scriptsig": "", + "scriptsig_asm": "", + "witness": [ + "3045022100a6139473fb960fc20ff54364ef011b7bc4e1a1c7f358291d5ecdc932578b9b6202201a4a91ba720eb9da1bf147001100ab79b2e1d6522a361b4cc1c7f71ee3bda31e01", + "021d52e1142b0255b98d210866dfa6c5160426b4a6aec58f4559972a8009c8ed0f" + ], + "is_coinbase": false, + "sequence": 4294967293 + } + ], + "vout": [ + { + "scriptpubkey": "0014cfbd92a6337e8b6043552d6fc5c35c7e5062281e", + "scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 fc3967f2b87d497e7c8eff08a452524afd019b7d", + "scriptpubkey_type": "v0_p2wpkh", + "scriptpubkey_address": "bc1qlsuk0u4c04yhulywluy2g5jjft7srxmaqxlvsr", + "value": 82483801 + } + ] + } \ No newline at end of file