mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-29 02:13:08 +00:00
* feat(cl/noir): provide an ergonomic Noir api for use within Python. * Add a python wrapper over the bigger constraint * Add the Bigger wrapper * cl/noir: document the NargoConstraint wrapper api * rewrite Bigger constraint as a dataclass * WIP: Cl/executable spec (#93) * wip: executable spec * WIP: test_1_to_1_transfer * hack: Vacous hash function * crypto: make sure prf returns field elements, fix ECC math in pedcom * hack(crypto): mock up a hash_to_curve implementation * feat(cl/1to1_xfr): fungibility domain uses hash_to_curve * cl: add type checking to InnerNote * cl/ptx: get balance commitments working * cl/noir: mv noir_constraint wrapper into cl/constraints/... * cl/ptx-note-proofs: start data modelling input and outputs * cl/ptx: 1-to-1 test is passing, but still, not quite finished * cl: remove tx_output from 1-to-1 transfer * cl: remove unused classes * cl: testing the balance commitments * wip: cl * cl: split main.rs into crypto.rs and note.rs * cl: split balance test * cl: add nullifier module * cl: partial_tx; input; output * cl: output proof tests * cl: partial transactions can now be built and verified * drop python cl spec * cl: test partial transaction balance commitment * cl: reverse partial tx balance (inputs are neg, outputs are pos) * cl: bundle of ptx * cl: verify bundle isn't balanced with just one unbalanced partial tx * cl: swap out ExtendedPoint for SubgroupPoint * cl: integrate groth16 death constraint validation * add risc0 zone * refactor risc0 zone * fix zone PoC * Add separate bin for stark2snark conv * cl: rename Note to NoteWitness * cl: merkle proofs * cl: merkle tree helper to pad elements * cl: ptx root implemented via merkle roots over inputs and outputs * cl: move from Commitment::from_witness to Witness::commit() * cl: tests passing again * cl: turn data model into library * cl: partial tx can compute paths to inputs / outputs * cl: begin integrating zone into cl data modal * cl: integrate simple zone into CL data model * cl: add missing cl patches * cl: swap jubjub for accel k256 * cl: pre-compute balance unit point outside stark * switch balance commitment to linear combination * cl: pre-compute pederson blinding * fix risc0 patching * switch to curve25519-dalek * cl: drop blake2; print prover time --------- Co-authored-by: Giacomo Pasini <g.pasini98@gmail.com> --------- Co-authored-by: Giacomo Pasini <g.pasini98@gmail.com>
112 lines
4.3 KiB
Markdown
112 lines
4.3 KiB
Markdown
# RISC Zero Rust Starter Template
|
|
|
|
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 the [zkVM
|
|
Overview][zkvm-overview].
|
|
|
|
## Quick Start
|
|
|
|
First, make sure [rustup] is installed. The
|
|
[`rust-toolchain.toml`][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:
|
|
|
|
```bash
|
|
cargo run
|
|
```
|
|
|
|
This is an empty template, and so there is no expected output (until you modify
|
|
the code).
|
|
|
|
### Executing the project locally in development mode
|
|
|
|
During development, faster iteration upon code changes can be achieved by leveraging [dev-mode], we strongly suggest activating it during your early development phase. Furthermore, you might want to get insights into the execution statistics of your project, and this can be achieved by specifying the environment variable `RUST_LOG="[executor]=info"` before running your project.
|
|
|
|
Put together, the command to run your project in development mode while getting execution statistics is:
|
|
|
|
```bash
|
|
RUST_LOG="[executor]=info" RISC0_DEV_MODE=1 cargo run
|
|
```
|
|
|
|
### Running proofs remotely on Bonsai
|
|
|
|
_Note: The Bonsai proving service is still in early Alpha; an API key is
|
|
required for access. [Click here to request access][bonsai 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:
|
|
|
|
```bash
|
|
BONSAI_API_KEY="YOUR_API_KEY" BONSAI_API_URL="BONSAI_URL" cargo run
|
|
```
|
|
|
|
## How to create a project based on this template
|
|
|
|
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][dev-docs] is a great place to get started.
|
|
- Example projects are available in the [examples folder][examples] of
|
|
[`risc0`][risc0-repo] repository.
|
|
- Reference documentation is available at [https://docs.rs][docs.rs], including
|
|
[`risc0-zkvm`][risc0-zkvm], [`cargo-risczero`][cargo-risczero],
|
|
[`risc0-build`][risc0-build], and [others][crates].
|
|
|
|
## Directory Structure
|
|
|
|
It is possible to organize the files for these components in various ways.
|
|
However, in this starter template we use a standard directory structure for zkVM
|
|
applications, which we think is a good starting point for your applications.
|
|
|
|
```text
|
|
project_name
|
|
├── Cargo.toml
|
|
├── host
|
|
│ ├── Cargo.toml
|
|
│ └── src
|
|
│ └── main.rs <-- [Host code goes here]
|
|
└── methods
|
|
├── Cargo.toml
|
|
├── build.rs
|
|
├── guest
|
|
│ ├── Cargo.toml
|
|
│ └── src
|
|
│ └── method_name.rs <-- [Guest code goes here]
|
|
└── src
|
|
└── lib.rs
|
|
```
|
|
|
|
## Video Tutorial
|
|
|
|
For a walk-through of how to build with this template, check out this [excerpt
|
|
from our workshop at ZK HACK III][zkhack-iii].
|
|
|
|
## Questions, Feedback, and Collaborations
|
|
|
|
We'd love to hear from you on [Discord][discord] or [Twitter][twitter].
|
|
|
|
[bonsai access]: https://bonsai.xyz/apply
|
|
[cargo-risczero]: https://docs.rs/cargo-risczero
|
|
[crates]: https://github.com/risc0/risc0/blob/main/README.md#rust-binaries
|
|
[dev-docs]: https://dev.risczero.com
|
|
[dev-mode]: https://dev.risczero.com/api/generating-proofs/dev-mode
|
|
[discord]: https://discord.gg/risczero
|
|
[docs.rs]: https://docs.rs/releases/search?query=risc0
|
|
[examples]: https://github.com/risc0/risc0/tree/main/examples
|
|
[risc0-build]: https://docs.rs/risc0-build
|
|
[risc0-repo]: https://www.github.com/risc0/risc0
|
|
[risc0-zkvm]: https://docs.rs/risc0-zkvm
|
|
[rustup]: https://rustup.rs
|
|
[rust-toolchain]: rust-toolchain.toml
|
|
[twitter]: https://twitter.com/risczero
|
|
[zkvm-overview]: https://dev.risczero.com/zkvm
|
|
[zkhack-iii]: https://www.youtube.com/watch?v=Yg_BGqj_6lg&list=PLcPzhUaCxlCgig7ofeARMPwQ8vbuD6hC5&index=5
|