Skip to content

usherlabs/zkaf-r0

Repository files navigation

WIP: ZK Attestation Framework - by Usher Labs

Supported platforms

  • Linux x86-64

Docker must operate on a compatible OS to work. Apple Silicon: Is not compatible even with --platform linux/amd64.

Prerequisites

  • RUST: The RISC Zero zkVM requires Rust, so start by installing Rust and rustup if you don't already have it. Please note that you will need to follow the recommended Rust installation instructions that use rustup rather than any of the alternative Rust installation options, as RISC Zero depends on the rustup tool specifically.

  • CUDA If you intend to run this GPU in order to reduce proof generation time, then you would need to install the required dependencies. Instructions on how to install and validate your installation of the dependencies on ubuntu can be found here.

Next, install the cargo risczero tool and use its install command to install the toolchain by running:

cargo install cargo-binstall
cargo binstall cargo-risczero
cargo risczero install

If this is successful, it will finish by printing the message

The risc0 toolchain is now ready to use.

You can verify the toolchain was installed correctly by running

rustup toolchain list --verbose | grep risc0

which should list risc0 along with its path.

Generating the data.

cd zkaf-r0
cargo build --release

The process for generating a proof for a tlsn proof can be broken down as showed below:

Generating the TLS proof:

After a TLS proof for a tweet has been generated, it is then placed in the fixtures directory here.

Generating ZK private inputs:

Following the previous step, a build script which can be found here is used to validate TLS Proof's Session and then generates the inputs to the zk circuit.

struct ZkParam {
    header: SessionHeader,
    substrings: SubstringsProof,
}

Proof Generation

A proof can either be verified on a CPU or on a GPU.

GPU-based

To generate a zkProof using GPU acceleration, we first confirm we have installed CUDA as directed in the prerequisites. CUDA is a feature flag included at the end of the Cargo.toml file of the host directory.

[features]
cuda = ["risc0-zkvm/cuda"]

The proof can be generated by running cargo run --release -F cuda at the root of the project.

CPU-based

The proof can be generated by running cargo run --release at the root of the project.

Note: Running the proof generation process on a CPU can be time-consuming so it can be run in dev mode by RISC0_DEV_MODE=1 cargo run --release at the root of the project

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published