Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamgupta2020 committed Apr 24, 2024
1 parent d38f45f commit cbb1539
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 15 deletions.
10 changes: 6 additions & 4 deletions coinbase_transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
// // 1976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac
// // 0000000000000000
// // 2e6a
// 2437dc177a1cd15bec5e1e62ed683c20ea76d3209ad5a96b2b6bd7e7db30aeb288// merkle root hash
// 0592eef8300bc4070cb745ed012a5f76243ec6a3b2c490fbcded312eaece67f3// merkle root hash
// 0000000000000000000000000000000000000000000000000000000000000000//wtxid commitment
// 2437dc177a1cd15bec5e1e62ed683c20ea76d3209ad5a96b2b6bd7e7db30aeb2880000000000000000000000000000000000000000000000000000000000000000
// // 0120
Expand All @@ -65,7 +65,9 @@
// 00000000


const final = "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed9b404e6630fbc3aefeb4cd2eba86a0471caeb5da0beddf8774ed29b64e99ac2400000000"
const final_serialized = "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed9b404e6630fbc3aefeb4cd2eba86a0471caeb5da0beddf8774ed29b64e99ac240120000000000000000000000000000000000000000000000000000000000000000000000000"
const final = "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f600000000"
const final_serialized = "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f60120000000000000000000000000000000000000000000000000000000000000000000000000"

module.exports = {final,final_serialized}
module.exports = {final,final_serialized}
//aa21a9ed
//4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f6 wtxid commitment
5 changes: 2 additions & 3 deletions create_merkle_wtxid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -31,5 +31,4 @@ function buildMerkleTree(transaction) {
}

const merkleRoot_wtxid = buildMerkleTree(wtxids);
console.log(merkleRoot_wtxid);
module.exports = {merkleRoot_wtxid}
module.exports = {merkleRoot_wtxid}
6 changes: 3 additions & 3 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
02000000000000000000000000000000000000000000000000000000000000000000000030eea806c8cd688a03b5149972b71e41fc32411654d912dcc1f0228be61ec343066a2966000000004e3d0100
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed9b404e6630fbc3aefeb4cd2eba86a0471caeb5da0beddf8774ed29b64e99ac240120000000000000000000000000000000000000000000000000000000000000000000000000
2783810b0b2c47d18ea4643de5340ecc1ad6b9856ec15bf51ac97b8325db6266
0200000000000000000000000000000000000000000000000000000000000000000000009a8daecb9ab72fc4798d27b5c53f7df09d1257c2e26c086c5e1a097e8870daec6c7929660000000066300000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2503233708184d696e656420627920416e74506f6f6c373946205b8160a4256c0000946e0100ffffffff02f595814a000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ed4caab5e8d90407ba6b96dcd40b7cf6d77c7e6cc7982038f73b7451b5b4aee8f60120000000000000000000000000000000000000000000000000000000000000000000000000
4a07ff9a6c014d80c867f9638d2c14c762476808c4d4003115202a008fc6ef59
abbd27ad7244b4a3a609cb3397723be4f0bd3c03ffb6d63951a253475dbee7ed
32a84a28b78317126ab176a2d0b8675f38a05689e40de6055db78836d93a6375
bc288e69c9bd6846d107c9c7c398ea26e817bdabada45ddbd3a505d913644e7c
Expand Down
1 change: 0 additions & 1 deletion trxnid_segwit.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ function segwit_serialized(trxn){
const serialized = serialize_trxn_segwit(trxn);
return serialized;
}

module.exports = {segwit_serialized, segwit_trxnid};
4 changes: 2 additions & 2 deletions txids_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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};
2 changes: 0 additions & 2 deletions val_trxn.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
34 changes: 34 additions & 0 deletions x.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}

0 comments on commit cbb1539

Please sign in to comment.