Skip to content

Instantly share code, notes, and snippets.

View kcalvinalvin's full-sized avatar

Calvin Kim kcalvinalvin

View GitHub Profile
@kcalvinalvin
kcalvinalvin / utreexo-algorithms.md
Last active March 14, 2024 08:11
Utreexo algorithms

Add

Utreexo accumulator is a collection of proper merkle trees. All the merkle trees have 2 children or none.

Below is an example of adding 7 leaves to the tree. You can run the code I used to generate this at https://go.dev/play/p/um5263SDk59

This is an accumulator with 1 leaf. It has 1 root, which is also a leaf.

@kcalvinalvin
kcalvinalvin / sanity_test.go
Created August 29, 2022 06:41
Test function to verify that the code is incorrect
package patriciaaccumulator
import (
"encoding/hex"
"fmt"
"os"
"path/filepath"
"testing"
)
@kcalvinalvin
kcalvinalvin / reproduce-results.patch
Last active August 29, 2022 06:32
Patch to reproduce the results of the blog
diff --git a/bridgenode/genproofs.go b/bridgenode/genproofs.go
index 36f1117..cca31b8 100644
--- a/bridgenode/genproofs.go
+++ b/bridgenode/genproofs.go
@@ -110,6 +110,7 @@ func BuildProofs(
logrus.SetOutput(logfile)
logrus.SetLevel(logrus.InfoLevel)
for ; height != knownTipHeight && !stop; height++ {
+ fmt.Println("on block", height)