From 116c98f562ed0091619f3625b2277e76f305851b Mon Sep 17 00:00:00 2001 From: Zaid Date: Fri, 19 Apr 2024 01:51:44 +0530 Subject: [PATCH] add: ah --- .gitignore | 3 ++- output.txt | 6 +++--- serialize.go | 46 +++++++++++++++++++++++----------------------- witnessMerkle.go | 11 ----------- 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 41d131c3..404df2a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vscode/* -go.sum \ No newline at end of file +go.sum +vendor/ \ No newline at end of file diff --git a/output.txt b/output.txt index 8d563788..97e21d74 100644 --- a/output.txt +++ b/output.txt @@ -1,6 +1,6 @@ -070000000000000000000000000000000000000000000000000000000000000000000000c16bcf5d8c955166695eec0a1d4891b2887d2b1856938cbc486639053574277111e91f66ffff001f6c380100 -010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed392466efe913d353921707d69a39cfb22952a7d75de836728f73705b3c5db5e40120000000000000000000000000000000000000000000000000000000000000000000000000 -ebc77710b2a547fe6cc86bc5b86fe810f291bcd40a9dd5e40dc8b84e866adc10 +0700000000000000000000000000000000000000000000000000000000000000000000008acb098b6fabb458fb5e9622c59b039f53be6b18ea74ba1ea979b9de7b867c1875802166ffff001f7b110000 +010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9edc12866091f7c0be0eabb04856dd16f94ccaf1d824fef2dbc601cf6af95304d9a0120000000000000000000000000000000000000000000000000000000000000000000000000 +af1ba229597bfda4230104246326f9441ce9a04f92354f9d786f5a759431a3ad 82f9f96db7bdbb9e70626747632e373b34eefd50d613dfea7092744169591b6e 7cb2a4f55245bae141a5d6ad51c08d7a9fdf2c2b905e4d97639ed80b82e69800 a9e537569db3c64340ed5abcdd983e9bb1b6ad6f90c93bc80d31c5cc0490bcea diff --git a/serialize.go b/serialize.go index 5e249936..098cc92a 100755 --- a/serialize.go +++ b/serialize.go @@ -8,31 +8,31 @@ import ( "os" ) -type Input struct { - TxID string `json:"txid"` - Vout uint32 `json:"vout"` - Prevout Prevout `json:"prevout"` - Scriptsig string `json:"scriptsig"` - ScriptsigAsm string `json:"scriptsig_asm"` - Witness []string `json:"witness"` - IsCoinbase bool `json:"is_coinbase"` - Sequence uint32 `json:"sequence"` -} + type Input struct { + TxID string `json:"txid"` + Vout uint32 `json:"vout"` + Prevout Prevout `json:"prevout"` + Scriptsig string `json:"scriptsig"` + ScriptsigAsm string `json:"scriptsig_asm"` + Witness []string `json:"witness"` + IsCoinbase bool `json:"is_coinbase"` + Sequence uint32 `json:"sequence"` + } -type Prevout struct { - Scriptpubkey string `json:"scriptpubkey"` - ScriptpubkeyAsm string `json:"scriptpubkey_asm"` - ScriptpubkeyType string `json:"scriptpubkey_type"` - ScriptpubkeyAddress string `json:"scriptpubkey_address"` - Value uint64 `json:"value"` -} + type Prevout struct { + Scriptpubkey string `json:"scriptpubkey"` + ScriptpubkeyAsm string `json:"scriptpubkey_asm"` + ScriptpubkeyType string `json:"scriptpubkey_type"` + ScriptpubkeyAddress string `json:"scriptpubkey_address"` + Value uint64 `json:"value"` + } -type Transaction struct { - Version uint32 `json:"version"` - Locktime uint32 `json:"locktime"` - Vin []Input `json:"vin"` - Vout []Prevout `json:"vout"` -} + type Transaction struct { + Version uint32 `json:"version"` + Locktime uint32 `json:"locktime"` + Vin []Input `json:"vin"` + Vout []Prevout `json:"vout"` + } var strs []byte diff --git a/witnessMerkle.go b/witnessMerkle.go index 16343c87..11b9f08d 100755 --- a/witnessMerkle.go +++ b/witnessMerkle.go @@ -8,17 +8,6 @@ import ( func CreateWitnessMerkle() string { _, _, wTxIDs := Prioritize() wTxIDs = append([]string{"0000000000000000000000000000000000000000000000000000000000000000"}, wTxIDs...) - // var wtxidsnew []string - // file, _ := os.ReadFile("wtxids.txt") - // for _, line := range strings.Split(string(file), "\n") { - // wtxidsnew = append(wtxidsnew, line) - // } - // for idx := range wtxidsnew { - // byt, _ := hex.DecodeString(wtxidsnew[idx]) - // byt = reverseBytes(byt) - // wtxidsnew[idx] = hex.EncodeToString(byt) - // } - // fmt.Println(len(wtxidsnew)) merkleRoot := NewMerkleTree(wTxIDs) fmt.Println("WMKR: ", hex.EncodeToString(merkleRoot.Data)) commitment_string := hex.EncodeToString(merkleRoot.Data) + "0000000000000000000000000000000000000000000000000000000000000000"