From 50637dc9f9213f4592b7c6848364f38a955c7ed6 Mon Sep 17 00:00:00 2001 From: Zaid Date: Mon, 15 Apr 2024 01:27:24 +0530 Subject: [PATCH] fix: segserialized cbtx --- main.go | 4 +++- output.txt | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index f29c7071..25f4320b 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,7 @@ func main() { cbTx := Coinbase(netReward) serializedcbTx, _ := serializeTransaction(cbTx) + fmt.Printf("CBTX: %x\n", serializedcbTx) TxIDs = append([]string{hex.EncodeToString(reverseBytes(to_sha(to_sha(serializedcbTx))))}, TxIDs...) mkr := NewMerkleTree(TxIDs) Bh.merkleRoot = hex.EncodeToString(mkr.Data) @@ -42,8 +43,9 @@ func main() { fmt.Println(Bh.merkleRoot) fmt.Println(Bh.nonce) serializedBh := SerializeBlockHeader(&Bh) + segserialized, _ := SegWitSerialize(cbTx) file.WriteString(hex.EncodeToString(serializedBh) + "\n") - file.WriteString(hex.EncodeToString(serializedcbTx) + "\n") + file.WriteString(hex.EncodeToString(segserialized) + "\n") for _, tx := range TxIDs { file.WriteString(tx + "\n") } diff --git a/output.txt b/output.txt index 2f7e86be..ebb46f67 100644 --- a/output.txt +++ b/output.txt @@ -1,5 +1,5 @@ -0700000000000000000000000000000000000000000000000000000000000000000000001469c49fc3a805b159391bfc2921584aa21f67e9f545d1110bff17d3313b83f5f3321c66ffff001f602f0500 -01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02895d8c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed392466efe913d353921707d69a39cfb22952a7d75de836728f73705b3c5db5e400000000 +0700000000000000000000000000000000000000000000000000000000000000000000001469c49fc3a805b159391bfc2921584aa21f67e9f545d1110bff17d3313b83f5ee341c66ffff001f0ba90000 +010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02895d8c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed392466efe913d353921707d69a39cfb22952a7d75de836728f73705b3c5db5e40120000000000000000000000000000000000000000000000000000000000000000000000000 76bdb34d637ae63ec4ee9dc11c8e242c1ce89cef399dedbfc902e325c44e9e86 82f9f96db7bdbb9e70626747632e373b34eefd50d613dfea7092744169591b6e 7cb2a4f55245bae141a5d6ad51c08d7a9fdf2c2b905e4d97639ed80b82e69800