Skip to content
/ ezkl Public
forked from zkonduit/ezkl

ezkl is a library and command-line tool for doing inference for deep learning models and other computational graphs in a zk-snark (ZKML)

License

Notifications You must be signed in to change notification settings

sudo-ron/ezkl

 
 

Repository files navigation


💭

EZKL


Easy Zero-Knowledge Inference

Test

ezkl is a library and command-line tool for doing inference for deep learning models and other computational graphs in a zk-snark (ZKML). It enables the following workflow:

  1. Define a computational graph, for instance a neural network (but really any arbitrary set of operations), as you would normally in pytorch or tensorflow.
  2. Export the final graph of operations as an .onnx file and some sample inputs to a .json file.
  3. Point ezkl to the .onnx and .json files to generate a ZK-SNARK circuit with which you can prove statements such as:

"I ran this publicly available neural network on some private data and it produced this output"

"I ran my private neural network on some public data and it produced this output"

"I correctly ran this publicly available neural network on some public data and it produced this output"

In the backend we use Halo2 as a proof system.

The generated proofs can then be used on-chain to verify computation, only the Ethereum Virtual Machine (EVM) is supported at the moment.

resources 📖

docs the official ezkl docs page
colab notebook demo demo of ezkl python bindings on google's colab
cargo doc --open compile and open the docs in your default browser locally

tutorials

You can find a range of python based tutorials in the examples/notebooks section. These all assume you have the ezkl python library installed. If you want the bleeding edge version of the library, you can install it from the main branch with:

python -m venv .env
source .env/bin/activate
pip install -r requirements.txt
maturin develop --release --features python-bindings
# dependencies specific to tutorials
pip install torch pandas numpy seaborn jupyter onnx kaggle py-solc-x web3 librosa tensorflow keras tf2onnx

Getting Started ⚙️

ezklxdemo.mp4

building the project 🔨

Note that the library requires a nightly version of the rust toolchain. You can change the default toolchain by running:

# we set it to this version because of https://github.com/rust-lang/rust/issues/110829
rustup override set nightly-2023-04-17

After which you may build the library

cargo build --release

A folder ./target/release will be generated. Add this folder to your PATH environment variable to call ezkl from the CLI.

# For UNIX like systems
# in .bashrc, .bash_profile, or some other path file
export PATH="<replace with where you cloned the repo>/ezkl/target/release:$PATH"

Restart your shell or reload your shell settings

# example, replace .bash_profile with the file you use to configure your shell
source ~/.bash_profile

You will need a functioning installation of solc in order to run ezkl properly. solc-select is recommended. Follow the instructions on solc-select to activate solc in your environment.

Repos

The EZKL project has several libraries and repos.

Repo Description
@zkonduit/ezkl the main ezkl repo in rust with wasm and python bindings
@zkonduit/pyezkl additional functionality written in python to support data science and zero knowledge applications

Contributing 🌎

If you're interested in contributing and are unsure where to start, reach out to one of the maintainers:

  • dante (alexander-camuto)
  • jason (jasonmorton)

More broadly:

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed to Zkonduit Inc. under the terms and conditions specified in the CLA, which you agree to by intentionally submitting a contribution. In particular, you have the right to submit the contribution and we can distribute it under the Apache 2.0 license, among other terms and conditions.

No security guarantees

Ezkl is unaudited, beta software undergoing rapid development. There may be bugs. No guarantees of security are made and it should not be relied on in production.

About

ezkl is a library and command-line tool for doing inference for deep learning models and other computational graphs in a zk-snark (ZKML)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 96.7%
  • Python 1.9%
  • Solidity 1.4%