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

docs: added Merkle tree use recommendations #315

Merged
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,14 @@ grep -r -l "smt" . | xargs sed -i 's/smt/my-package/'
#### How can I create benchmarks for my library?

You can see some examples in the `benchmarks` folder. All you have to do is create a file that exports a function to run your benchmark in that folder, and add that function to the `index.ts` file. The `yarn benchmarks` command can be run with no parameters (it will run all the benchmarks), or you can specify the name of your benchmark file to run just that. When you run the command it will create a `benchmarks/results` folder with your results.

#### I need to use a Merkle Tree to prove the inclusion or exclusion of data elements within a set. Which type of Merkle Tree should I use?
**Incremental:** Ideal for applications where you frequently add new elements and need to update the tree efficiently.
***Lean Incremental:** A more memory-efficient version of the incremental Merkle tree, suitable for use cases with memory constraints.
**Sparse:** Best suited for scenarios where you need to manage a large, mostly empty set of possible elements.
sripwoud marked this conversation as resolved.
Show resolved Hide resolved

| Type | Library Name | Main Feature | Recommended for | Not Recommended for | Used by | Proof Gen Speed |
|-----------------|---------------------------|----------------------------------------------|-----------------------------------------------|----------------------------------------------|------------------------------------------------|-----------------------|
|**Incremental** | @zk-kit/imt | Fastest for incremental updates | Applications requiring frequent updates | Scenarios with very large datasets | Semaphore, Tornado Cash | Fast |
|**Lean incremental**| @zk-kit/lean-imt | Optimized for lightweight environments | Mobile and browser-based ZK applications | High-frequency update requirements | zkSync, Loopring | Moderate |
|**Sparse** | @zk-kit/smt | Handles very large sets efficiently | Applications with large static datasets | Frequent updates due to higher computational cost | Aztec, Zcash | Slow (due to large set handling) |
sripwoud marked this conversation as resolved.
Show resolved Hide resolved
Loading