zendoo-mc-cryptolib
is an FFI library crate that exposes the ginger-lib Rust components needed to support Zendoo in mainchain.
In particular it exposes interfaces to:
- handle the finite fields that are the alphabets of the zk Proving Systems
- call the Poseidon function, a Snark friendly hashing algorithm
- use a full in-memory Poseidon-based Merkle Tree, thus optimized for performance but limited in size (depending on the available RAM)
- manage the SCTxsCommitmentTree, as described in section 4.1.3 of the Zendoo paper
- manage BitVectorTree (as described in Appendix A of the Zendoo paper) and get its Merkle root
- verify a single or a batch of Zendoo SNARK proofs related to backward transfer certificates and ceased sidechain withdrawals transactions
Please note: the code is in development. No guarantees are provided about its security and functionality
The proving system has been switched from Groth16 to our Marlin variant Coboundary Marlin. Support has been also introduced to verify Final Darlin proofs, as per last step of our recursive PCD scheme (See HGB for details).
The library compiles on the stable
Rust toolchain.
To install Rust, just install rustup
by following the instructions here, or via your platform's package manager.
After that, use cargo
, the standard Rust build tool, to build the library:
git clone https://github.com/HorizenOfficial/zendoo-mc-cryptolib.git
cd zendoo-mc-cryptolib
cargo build --release
This library comes with unit tests for each of the provided crates. Run the tests with:
cargo test
More detailed build guide, as well as instructions to build the .jar, can be found in in our build guide.
In the example folder you can find a few C++ tests and examples of invocation of Rust functions. You can compile and execute them via the provided Makefile.