zkRust 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:
To generate and submit proofs to Aligned using ZKRust, you need to have the following dependencies installed:
- Rust
- Foundry (Optional, needed only to create a local keystore to sign Ethereum transactions if you didn't already have one).
To generate and submit proofs to Aligned testnet using zkRust, you can follow the steps below:
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:
./install_aligned.sh
{% hint style="warning" %} When creating a new wallet keystore and private key please use strong passwords for your own protection. {% endhint %}
You can use cast to create a local keystore. If you already have one, you can skip this step.
cast wallet new-mnemonic
Then you can import your created keystore using:
cast wallet import --interactive <path_to_keystore.json>
Make sure to send at least 0.1 Holesky ETH to the address in the keystore. You can get Holesky ETH from the faucet
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:
zkrust prove-risc0 \
--submit-to-aligned \
--keystore-path <PATH_TO_KEYSTORE> \
examples/fibonacci
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:
zkrust prove-sp1 \
--submit-to-aligned \
--keystore-path <PATH_TO_KEYSTORE> \
examples/fibonacci
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.