Welcome to the RISC Zero Rust Starter Template! This template is intended to give you a starting point for building a project using the RISC Zero zkVM. Throughout the template (including in this README), you'll find comments labelled TODO
in places where you'll need to make changes.
To better understand the concepts behind this template, check out our Structure of a zkVM Application explainer.
TODO: Replace this README with a README for your project
TODO: Verify whether the included
.gitignore
,LICENSE
, andrust-toolchain
files are appropriate to your project
First, make sure rustup is installed. This project uses a nightly version of Rust. The rust-toolchain
file will be used by cargo
to automatically install the correct version.
To build all methods and execute the method within the zkVM, run the following command:
cargo run
This is an empty template, and so there is no expected output (until you modify the code).
Note: The Bonsai proving service is still in early Alpha; an API key is required for access. Click here to request access.
If you have access to the URL and API key to Bonsai you can run your proofs
remotely. To prove in Bonsai mode, invoke cargo run
with two additional
environment variables:
BONSAI_API_KEY="YOUR_API_KEY" BONSAI_API_URL="BONSAI_URL" cargo run
Search this template for the string TODO
, and make the necessary changes to implement the required feature described by the TODO
comment. Some of these changes will be complex, and so we have a number of instructional resources to assist you in learning how to write your own code for the RISC Zero zkVM:
- The RISC Zero Developer Docs is a great place to get started.
- Example projects are available in the examples folder of this repository.
- Reference documentation for our Rust crates is available at [docs.rs], including the RISC Zero zkVM crate, the cargo risczero crate, the RISC Zero build crate, and others (the full list is available at [https://github.com/risc0/risc0/blob/main/README.md]).
- Our main repository.
We welcome contributions to documentation and code via PRs and GitHub Issues on our main repository or any of our other repositories.
For a walk-through of how to build with this template, check out this excerpt from our workshop at ZK HACK III.