Skip to content

Commit

Permalink
Merge pull request #16 from pred695/ok
Browse files Browse the repository at this point in the history
add: ah
  • Loading branch information
pred695 authored Apr 18, 2024
2 parents 7911353 + 116c98f commit 33bffe9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode/*
go.sum
go.sum
vendor/
6 changes: 3 additions & 3 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
070000000000000000000000000000000000000000000000000000000000000000000000c16bcf5d8c955166695eec0a1d4891b2887d2b1856938cbc486639053574277111e91f66ffff001f6c380100
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed392466efe913d353921707d69a39cfb22952a7d75de836728f73705b3c5db5e40120000000000000000000000000000000000000000000000000000000000000000000000000
ebc77710b2a547fe6cc86bc5b86fe810f291bcd40a9dd5e40dc8b84e866adc10
0700000000000000000000000000000000000000000000000000000000000000000000008acb098b6fabb458fb5e9622c59b039f53be6b18ea74ba1ea979b9de7b867c1875802166ffff001f7b110000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9edc12866091f7c0be0eabb04856dd16f94ccaf1d824fef2dbc601cf6af95304d9a0120000000000000000000000000000000000000000000000000000000000000000000000000
af1ba229597bfda4230104246326f9441ce9a04f92354f9d786f5a759431a3ad
82f9f96db7bdbb9e70626747632e373b34eefd50d613dfea7092744169591b6e
7cb2a4f55245bae141a5d6ad51c08d7a9fdf2c2b905e4d97639ed80b82e69800
a9e537569db3c64340ed5abcdd983e9bb1b6ad6f90c93bc80d31c5cc0490bcea
Expand Down
46 changes: 23 additions & 23 deletions serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions witnessMerkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 33bffe9

Please sign in to comment.