Skip to main content

No project description provided

Project description


:thought_balloon:

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"

Notebook

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

Notebook

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

Notebook

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.

  • If you have any questions, we'd love for you to open up a discussion topic in Discussions. Alternatively, you can join the ✨EZKL Community Telegram Group💫.

  • For more technical writeups and details check out our blog.

  • To see what you can build with ezkl, check out cryptoidol.tech where ezkl is used to create an AI that judges your singing ... forever.


getting started ⚙️

Python

Install the python bindings by calling.

pip install ezkl

Or for the GPU:

pip install ezkl-gpu

Google Colab Example to learn how you can train a neural net and deploy an inference verifier onchain for use in other smart contracts. Notebook

More notebook tutorials can be found within examples/notebooks.

CLI

Install the CLI

curl https://raw.githubusercontent.com/zkonduit/ezkl/main/install_ezkl_cli.sh | bash

https://user-images.githubusercontent.com/45801863/236771676-5bbbbfd1-ba6f-418a-902e-20738ce0e9f0.mp4

For more details visit the docs.

Build the auto-generated rust documentation and open the docs in your browser locally. cargo doc --open

building the project 🔨

Rust CLI

You can install the library from source

cargo install --locked --path .

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.

building python bindings

Python bindings exists and can be built using maturin. You will need rust and cargo to be installed.

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

GPU Acceleration

If you have access to NVIDIA GPUs, you can enable acceleration by building with the feature icicle and setting the following environment variable:

export ENABLE_ICICLE_GPU=true

GPU acceleration is provided by Icicle

To go back to running with CPU, the previous environment variable must be unset instead of being switch to a value of false:

unset ENABLE_ICICLE_GPU

NOTE: Even with the above environment variable set, icicle is disabled for circuits where k <= 8. To change the value of k where icicle is enabled, you can set the environment variable ICICLE_SMALL_K.

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/ezkljs typescript and javascript tooling to help integrate ezkl into web apps

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.

NOTE: Because operations are quantized when they are converted from an onnx file to a zk-circuit, outputs in python and ezkl may differ slightly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ezkl-9.1.0-cp37-abi3-win_amd64.whl (9.8 MB view details)

Uploaded CPython 3.7+Windows x86-64

ezkl-9.1.0-cp37-abi3-win32.whl (8.9 MB view details)

Uploaded CPython 3.7+Windows x86

ezkl-9.1.0-cp37-abi3-musllinux_1_2_x86_64.whl (15.2 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ x86-64

ezkl-9.1.0-cp37-abi3-musllinux_1_2_armv7l.whl (14.2 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARMv7l

ezkl-9.1.0-cp37-abi3-musllinux_1_2_aarch64.whl (14.5 MB view details)

Uploaded CPython 3.7+musllinux: musl 1.2+ ARM64

ezkl-9.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.1 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

ezkl-9.1.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (15.6 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ i686

ezkl-9.1.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (20.7 MB view details)

Uploaded CPython 3.7+macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

ezkl-9.1.0-cp37-abi3-macosx_10_7_x86_64.whl (10.9 MB view details)

Uploaded CPython 3.7+macOS 10.7+ x86-64

File details

Details for the file ezkl-9.1.0-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: ezkl-9.1.0-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 9.8 MB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f561242195ffd96a83a983b04b654a1671ee5f9177ba18661101ef370fb2ee85
MD5 e4fcf129822923b44effe7aea2311e2d
BLAKE2b-256 bd7d6655c8415dbcb65daf2c5d48eb260456cbc88cd06e76b0a7f4f8cd454a45

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-win32.whl.

File metadata

  • Download URL: ezkl-9.1.0-cp37-abi3-win32.whl
  • Upload date:
  • Size: 8.9 MB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 3c93e1cdb20eb5f10c4ce9bb80108f7dc69978b836efc7c786606275115df953
MD5 6c6a1de928f173cc11362ae32ea1f87b
BLAKE2b-256 1df91323625dae737377f780575968f63f5c740c0277362a6f1463fb8e6cb770

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: ezkl-9.1.0-cp37-abi3-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 15.2 MB
  • Tags: CPython 3.7+, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c7274405448d3ed6413fe62ee7647e1787f73b3148f62d720aa26a744a06aa13
MD5 2cd390611790b6bd52318c6f991dcc69
BLAKE2b-256 852258e4d933de421f4e306af2a51633549bdf6bb28c408009c9e50082e7ec7c

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-musllinux_1_2_armv7l.whl.

File metadata

  • Download URL: ezkl-9.1.0-cp37-abi3-musllinux_1_2_armv7l.whl
  • Upload date:
  • Size: 14.2 MB
  • Tags: CPython 3.7+, musllinux: musl 1.2+ ARMv7l
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 a0e44bc564a290393a8d47493159cc87fcdc135ba8c9b260a3c3c56f71242c19
MD5 26318596fdb6e61b8fd5d050e0651d97
BLAKE2b-256 4c88ab2fa5cea5d32b41f63f5f04fbf09069ff7d4ab9c28fe2e1d0e341aa6473

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f8ad895dd57e095af5a690833dfdfc4f98ab78844efe2589979f0598b5388b30
MD5 9e175734f5a3702fa3f8881d684d80c8
BLAKE2b-256 871ef81b035ff1b167f42c8e6a9b60f4af52c14302d2dcc719c1e2cd9f949644

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 df5013a5f037fc6eeda8e9824cfc0bcfc87523dc0957f4e1ec85215c399080ab
MD5 b84405f5e7a4586897b32de7f0498753
BLAKE2b-256 4d87bc60e64727333b403e32194a3ef9a7a3c08e104f9032bd822263335b2cd7

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 634496af6ed13fc5f6a8c44f1b3598b8b36961ad17e6550718eedb9601213950
MD5 24cb2f3fc2bcadf0bf7fa3852d1fc0f5
BLAKE2b-256 32de7f992d04b60fbd0eefa2763270ed2559d24926f338044bea0f763e19b3dd

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ad33d05b98ddf1636cea3088cd833ccd1b61ce266c1f53cf751c2ed8af86bd07
MD5 7350869b1327bc6c88aaee57cd322f03
BLAKE2b-256 3188b2e0ff8b93db388ae00b38fd01fbd2aa67f003379de3270821d84e9b354a

See more details on using hashes here.

File details

Details for the file ezkl-9.1.0-cp37-abi3-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: ezkl-9.1.0-cp37-abi3-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 10.9 MB
  • Tags: CPython 3.7+, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for ezkl-9.1.0-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 63d6389544a6f85682181584ef0145870c506216efd999d60e94726059627004
MD5 4c88bfc847af6a4a97e4c32559511f50
BLAKE2b-256 71760800d48df7724d024174fb87c812ed7d70ed71a24f796001c6246bacc6d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page