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 the collaboratively-developed Halo2 as a proof system.

The generated proofs can then be verified with much less computational resources, including on-chain (with the Ethereum Virtual Machine), in a browser, or on a device.

  • 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 ⚙️

The easiest way to get started is to try out a notebook.

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. The CLI is faster than Python, as it has less overhead. For even more speed and convenience, check out the remote proving service, which feels like the CLI but is backed by a tuned cluster.

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

In-browser EVM verifier

As an alternative to running the native Halo2 verifier as a WASM binding in the browser, you can use the in-browser EVM verifier. The source code of which you can find in the in-browser-evm-verifier directory and a README with instructions on how to use it.

building the project 🔨

Rust CLI

You can install the library from source

cargo install --locked --path .

ezkl now auto-manages solc installation for you.

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.

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:

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, 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.

no warranty

Copyright (c) 2024 Zkonduit Inc. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

ezkl-15.5.0-cp37-abi3-win_amd64.whl (11.9 MB view details)

Uploaded CPython 3.7+ Windows x86-64

ezkl-15.5.0-cp37-abi3-win32.whl (10.6 MB view details)

Uploaded CPython 3.7+ Windows x86

ezkl-15.5.0-cp37-abi3-musllinux_1_2_x86_64.whl (14.3 MB view details)

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

ezkl-15.5.0-cp37-abi3-musllinux_1_2_armv7l.whl (13.6 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

ezkl-15.5.0-cp37-abi3-musllinux_1_2_aarch64.whl (13.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

ezkl-15.5.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.1 MB view details)

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

ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.whl (11.7 MB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (22.1 MB view details)

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

File details

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

File metadata

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

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 30bf9db6f4c1c3e30d50bf64f49e7eac4702c7eef4cccc4bfb691d9493e1af88
MD5 a4ba9f7e3d0e3e5ccaaff706d4c0e2f3
BLAKE2b-256 ff69700db7849603ec20185dce4f0ad9384e9bb00437db2afa18d841c8f7cb12

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-win_amd64.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

File details

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

File metadata

  • Download URL: ezkl-15.5.0-cp37-abi3-win32.whl
  • Upload date:
  • Size: 10.6 MB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 85ca3199bbd3f305085a8aa3390ef3ab7be4c06b16f78b08f808cc9fb066c966
MD5 ad017e2c53ac331ed00460fae9ad0482
BLAKE2b-256 fe1dd00511047229e58bdfb8f46e0239e9c6cdbf34cd671a3e219451caa8b981

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-win32.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

File details

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

File metadata

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 89fb050cea5e85b8b310d1381fc323091a3e698bad939c30c2786c32729cb261
MD5 e2ec08e8711bbc5c3e5c3c85c13844f0
BLAKE2b-256 45e12c6e56e1a56a4de83984bb4dfac3f9665863a7980d817cabada19e4142ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-musllinux_1_2_x86_64.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

File details

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

File metadata

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 4768480dd5fdd26395f822683dd9806a6587131aedd0ecb2ba9e886d80b90d01
MD5 5327e0666e70bacbb0ed1c99cfc98dbc
BLAKE2b-256 7cc47a9814e05240edbe4dc317eb1e4789564435c82469df6a23d3daf9b1b40f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-musllinux_1_2_armv7l.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

File details

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

File metadata

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 69876d43fb6179852a1248bdaca167819f0cb5b5c77fe031fefa6e96338baac1
MD5 b57de7ebbf5b3190d114e56985c3aca2
BLAKE2b-256 7d4c72fc525d0758ffdf56cebea4346eb3c93e39f82d5582209cf17940e63ba7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-musllinux_1_2_aarch64.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

File details

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

File metadata

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37e42bb3f15991c48dcb2354625d782ffe65504a9017831605ca5df1b920b784
MD5 e5553ce9e202dc17042e0a5955130cf6
BLAKE2b-256 d08a808dcfcb9a8cfaded528198182d1838fa48191154639b3f1e680ee7af4ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

File details

Details for the file ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d1fd8d887eea984dcd906f4fbbe46cf8be2c367d2cde2d9ecb314c0a5e9d39f1
MD5 ca58b1977122364abca2d9836fdb5479
BLAKE2b-256 d918922ec6c469301919d9779f8cb6866dc5108802cd66738cb035be12c29846

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

File details

Details for the file ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 c4a4d6a2a7c1467c18410dafb6ac6b307dc22eed2cd2b64d9716764b6665b296
MD5 090ac93c20c43024918441d91c3a18e5
BLAKE2b-256 983dc27b202119169d11c84bf9e248ee854ff12652f46582fd7a4c04819a279e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezkl-15.5.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: pypi.yml on zkonduit/ezkl

Attestations:

Supported by

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