Generating & submitting proofs of Rust code with ZKRust

zkRustarrow-up-right is a CLI tool to generate proofs of your rust code using a RISCV-zkVM's and submit them to Aligned to be verified with only one command. The following provers are supported:

Dependencies

To generate and submit proofs to Aligned using ZKRust, you need to have the following dependencies installed:

Generate & Submit proofs

To generate and submit proofs to Aligned testnet using zkRust, you can follow the steps below:

1. Install zkRust :

The zkRust executable can be installed directly via the command line via:

curl -L https://raw.githubusercontent.com/yetanotherco/zkRust/main/install_zkrust.sh | bash

or built by cloning the repo

git clone https://github.com/yetanotherco/zkRust
cd zkRust

and running the installation script:

2. Generate a keystore:

circle-exclamation

You can use cast to create a local keystore. If you already have one, you can skip this step.

Then you can import your created keystore using:

Make sure to send at least 0.1 Hoodi ETH to the address in the keystore. You can get Hoodi ETH from the faucetarrow-up-right

3. Generate and submit the proof with zkRust:

The zkRust repo has some predefined examples that can be used to generate a proof. You can find them in zkRust/examples. For example, to generate a proof of a fibonacci program with Risc0 or SP1 and submit it to aligned, run:

This command will generate a proof for the fibonacci example program and submit it to Aligned using the keystore provided for signing the transaction.

Take into consideration that the proof generation can take some time. Once the proof has been generated, a prompt will appear asking for the passphrase of your keystore and then send it to Aligned.

The same program can be proved using SP1 just changing the zkRust subcommand:

Caveats

For the moment, the Rust code that can be proven has some limitations:

  • Programs with user Input and Output to the vm code are not supported.

Last updated