Welcome to the Hyperfridge RISC Zero component! The idea of hyperfridge is to create a bidirectional bridge to the TradFi world for blockchain applications, secured by Zero-Knowledge tech. This project is supported by Web3 Foundation and lets smart contracts and blockchain DApps "look inside" a bank account. For example, to react on the arrival of a FIAT payment and allow to send funds from a bank account using on-chain wallet. All automated, secure, and privacy-preserving. For more information take a look at our web3 grant application. Hyperfridge's vision is to create a ZK-based ledger to provide a trustless interfaces to TradFi so that anyone can "plug-in" their own bank-account into the Web3 world, similar as you can do it today with Stripe in the Web2 world, but open-sourced and fully trustless.
This repository consists of three modules - a host and guest program and a verifier tool which shows how to check the proofs. Look our testing guide to get an idea how it is used.
Check out our cryptographic overview, performance benchmarks, also the hyperfridge whitepaper.
As it builds upon Risc-Zero zkVM, make yourself familiar with this framework, otherwise it will be hard to understand what this crate is doing:
- The RISC Zero Developer Docs is a great place to get started.
- Example projects are available in the examples folder of
risc0
repository. - Reference documentation is available at https://docs.rs, including
risc0-zkvm
,cargo-risczero
, zkvm-overviewrisc0-build
, and others. - excerpt from Risc0 workshop at ZK HACK III.
First, make sure rustup is installed. The rust-toolchain.toml
file will be used by cargo
to
automatically install the correct version. To build and execute a quick integration test, use:
Second, make sure you have installed risc0
toolchain. Follow instructions from here.
RISC0_DEV_MODE=1 cargo test
This will create a STARK based on the provided test data. Check out our testing guide to run test and play with test data. Note that cargo test
will not invoke tests in methods/guest
due to the architecture of Risc-Zero framework - see testing guide how to run tests for the poofer.
To use this crate with your owen bank data, you will need to run a component, which connects with our banking backend and then prepare the input for the Hyperfridge zkVM component. You can use the ebics-java-client, but any EBICS client will do, as long as you get access to the XML files which are exchanged between your client and the banking server.
Open documentation in any module by:
cargo doc --no-deps --open
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:
cd host
# will show usage
RUST_LOG="executor=info" RISC0_DEV_MODE=1 cargo run
# will create a STARK on the test data
RUST_LOG="executor=info" RISC0_DEV_MODE=1 cargo run test
# add --verbose to see what is going on
RUST_LOG="executor=info" RISC0_DEV_MODE=1 cargo run --verbose test
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
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.
project_name
├── Cargo.toml
├── host
│ ├── Cargo.toml
│ └── src
│ └── main.rs <-- [Host code]
├── verifier
│ ├── Cargo.toml
│ └── src
│ └── main.rs <-- [Verifier code]
└── methods
├── Cargo.toml
├── build.rs
├── guest
│ ├── Cargo.toml
│ └── src
│ └── bin
│ └── method_name.rs <-- [Guest code]
└── src
└── lib.rs