This is the repo for hackathon project by MixBytes team of ETHGLobal Hackathon Istanbul, implementing Merkle Patricia Tree storage proofs
The project is based on ZKLLVM compiler-assigner-prover and forked from zkllvm-template project.
git clone --recurse-submodules https://github.com/mixbytes/zkllvm-mpt-proofs.git
cd zkllvm-mpt-proofs
If you initially cloned without --recurse-submodules
, update submodules explicitly:
git submodule update --init --recursive
Compile and run the main()
function, calling the same verify_path()
function, that is used in circuit to debug
clang++ -std=c++14 -Wno-unknown-attributes -I libs/crypto3/libs/hash/include/ src/main.cpp src/cJSON.cpp
(result is in a.out
, you can run it)
docker pull ghcr.io/nilfoundation/toolchain:latest
Run the script from the root of your project.
scripts/run.sh --docker compile
The compile
command does the following:
- Starts a Docker container based on
nilfoundation/zkllvm-template
. - Makes a clean
./build
directory and initializescmake
. - Compiles the code into a circuit.
Next step is to make a compiled circuit and assignment table.
scripts/run.sh --docker run_assigner
On this step, we run the assigner
, giving it the circuit in LLVM IR format (template.lls
)
and the input data (./src/main-input.json
).
The assigner
produces the following files:
- Circuit file
./build/template.crct
is the circuit in a binary format that is usable by theproof-generator
. - Assignment table
./build/template.tbl
is a representation of input data, prepared for proof computation with this particular circuit.
scripts/run.sh --docker prove