#merkle-tree #merkle #poseidon #poseidon-hash #tree #data #structure

no-std poseidon-merkle

Crate implementing Dusk Network's Merkle tree with the poseidon hash function

7 releases (4 breaking)

0.5.0 Jan 3, 2024
0.4.0 Dec 13, 2023
0.3.0 Oct 12, 2023
0.2.1 Aug 9, 2023
0.1.0 Jun 28, 2023

#6 in #poseidon

Download history 41/week @ 2023-12-15 15/week @ 2023-12-22 33/week @ 2023-12-29 12/week @ 2024-01-05 37/week @ 2024-01-12 24/week @ 2024-01-19 71/week @ 2024-01-26 157/week @ 2024-02-02 202/week @ 2024-02-09 454/week @ 2024-02-16 421/week @ 2024-02-23 119/week @ 2024-03-01 54/week @ 2024-03-08 38/week @ 2024-03-15 56/week @ 2024-03-22 99/week @ 2024-03-29

252 downloads per month
Used in 4 crates

MPL-2.0 license

53KB
927 lines

dusk-merkle

A sparsely populated dusk_merkle merkle tree, which uses the poseidon hash algorithm for level aggregation and is parametrized over its height and arity.

Height 0             h
                    / \
                   /   \
                  /     \
                 /       \
                /         \
Height 1       h           h
              / \         / \
             /   \       /   \
Height 2    h     x     h     h
           / \         / \   / \
Height 3  h   x       x   h h   h
Position  0               5 6   7

Additionally to the tree itself, this crate defines an opening gadget that can be used to create a merkle opening circuit for zero-knowledge applications under the "zk" feature.

The type Item<T> has the aggregation of the hash part with the poseidon hash pre-defined and additionally allows for a custom data type with custom aggregation.

Benchmarks

There are benchmarks for the poseidon tree calculation available with

cargo bench

and additional benchmarks for the opening proof generation with PLONK

cargo bench --features zk

This requires a nightly toolchain.

License

This project is licensed under the Mozilla Public License, version 2.0. See the license file for more details.

Dependencies

~6.5MB
~137K SLoC