Skip to content

Commit

Permalink
docs: added Merkle tree use recommendations (#315)
Browse files Browse the repository at this point in the history
* docs: added Merkle tree use recommendations

Added FAQ to guide the developers about when and why use a specific type of Merkle tree for their projects

The FAQ has a short text answer plus a comparison table with more detailed data
Refs: #311

* docs: merkle tree use recommendations changes format fixes

Fix README format (prettier)

Fix missing new lines in explanation text

Add links to the homepage of the projects

re 315

* docs: merkle tree use recommendations changes format fixes (correction)

Fix README format (prettier)

Fix missing new lines in explanation text

Add links to the homepage of the projects

re 315
  • Loading branch information
0xarcano authored Sep 2, 2024
1 parent 62cb5d5 commit 253277c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,17 @@ 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.

| 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](https://github.com/semaphore-protocol/semaphore), [Tornado Cash](https://github.com/tornadocash/tornado-core) | Fast |
| **Lean incremental** | @zk-kit/lean-imt | Optimized for lightweight environments | Mobile and browser-based ZK applications | High-frequency update requirements | [zkSync](https://github.com/matter-labs/zksync), [Loopring](https://github.com/Loopring) | Moderate |
| **Sparse** | @zk-kit/smt | Handles very large sets efficiently | Applications with large static datasets | Frequent updates due to higher computational cost | [Aztec](https://github.com/AztecProtocol), [Zcash](https://github.com/zcash) | Slow (due to large set handling) |

0 comments on commit 253277c

Please sign in to comment.