Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: testing hai bhai #13

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified Prioritize.go
100644 → 100755
Empty file.
Empty file modified address.go
100644 → 100755
Empty file.
Empty file modified coinbase.go
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion main.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ func main() {
file.WriteString(tx + "\n")
}
}

// Serialize()
}
Empty file modified merkle.go
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
0700000000000000000000000000000000000000000000000000000000000000000000008acb098b6fabb458fb5e9622c59b039f53be6b18ea74ba1ea979b9de7b867c18c4891f66ffff001fc2940000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9edc12866091f7c0be0eabb04856dd16f94ccaf1d824fef2dbc601cf6af95304d9a0120000000000000000000000000000000000000000000000000000000000000000000000000
af1ba229597bfda4230104246326f9441ce9a04f92354f9d786f5a759431a3ad
07000000000000000000000000000000000000000000000000000000000000000000000089ad28d689aa0222e107a7477a7755763953963ab61353d0f6e5b42c4debfb9b4ee41f66ffff001f4ad40000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff1b03951a0604f15ccf5609013803062b9b5a0100072f425443432f20ffffffff02de538c0100000000160014df4bf9f3621073202be59ae590f55f42879a21a00000000000000000266a24aa21a9ed3a44995d77b02e34b810da0cb9e5af0ca02aafeed77241c892d7ba23e4779c8b0120000000000000000000000000000000000000000000000000000000000000000000000000
0faaf895a1035fd964229b745660f13592236663ea0f69961ab427f00333ab48
82f9f96db7bdbb9e70626747632e373b34eefd50d613dfea7092744169591b6e
7cb2a4f55245bae141a5d6ad51c08d7a9fdf2c2b905e4d97639ed80b82e69800
a9e537569db3c64340ed5abcdd983e9bb1b6ad6f90c93bc80d31c5cc0490bcea
Expand Down
Empty file modified p2pkh.go
100644 → 100755
Empty file.
Empty file modified p2sh.go
100644 → 100755
Empty file.
Empty file modified p2wpkh.go
100644 → 100755
Empty file.
Empty file modified p2wsh.go
100644 → 100755
Empty file.
Empty file modified pow.go
100644 → 100755
Empty file.
22 changes: 22 additions & 0 deletions serialize.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,25 @@ func Handle(err error) {
fmt.Println(err)
}
}

// func Serialize() {
// dir := "./mempool"
// files, err := os.ReadDir(dir)
// fileF, _ := os.Create("txids.txt")
// fileF2, _ := os.Create("wtxids.txt")
// Handle(err)
// for _, file := range files {
// data, err := jsonData(dir + "/" + file.Name())
// Handle(err)
// var tx Transaction
// err = json.Unmarshal([]byte(data), &tx)
// Handle(err)
// serializedTx, err := serializeTransaction(&tx)
// Handle(err)
// txid := hex.EncodeToString((to_sha(to_sha(serializedTx))))
// fileF.WriteString(txid + "\n")
// segserialized, _ := SegWitSerialize(&tx)
// wtxid := hex.EncodeToString((to_sha(to_sha(segserialized))))
// fileF2.WriteString(wtxid + "\n")
// }
// }
Empty file modified signature.go
100644 → 100755
Empty file.
8,131 changes: 8,131 additions & 0 deletions txids.txt

Large diffs are not rendered by default.

Empty file modified weight.go
100644 → 100755
Empty file.
13 changes: 12 additions & 1 deletion witnessMerkle.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@ package main

import (
"encoding/hex"
"fmt"
"os"
"strings"
)

func CreateWitnessMerkle() string {
_, _, wTxIDs := Prioritize()
wTxIDs = append([]string{"0000000000000000000000000000000000000000000000000000000000000000"}, wTxIDs...)
merkleRoot := NewMerkleTree(wTxIDs)
var wtxidsnew []string
file, _ := os.ReadFile("wtxids.txt")
for _, line := range strings.Split(string(file), "\n") {
wtxidsnew = append(wtxidsnew, line)
}
// fmt.Println(len(wtxidsnew))
merkleRoot := NewMerkleTree(wtxidsnew)
fmt.Println("WMKR: ", hex.EncodeToString(merkleRoot.Data))
commitment_string := hex.EncodeToString(merkleRoot.Data) + "0000000000000000000000000000000000000000000000000000000000000000"
WitnessCommitment, _ := hex.DecodeString(commitment_string)
WitnessCommitment = to_sha(to_sha(WitnessCommitment))
fmt.Println("Witness Commitment: ", hex.EncodeToString(WitnessCommitment))
return hex.EncodeToString(WitnessCommitment)
}
3,354 changes: 3,354 additions & 0 deletions wtxids.txt

Large diffs are not rendered by default.