Lita Docs
  • Introduction
    • Getting Started
  • Quick Start
    • Tutorial: Rust via Docker
    • Installation & System Requirements
    • Valida Compiler Toolchain
      • Rust Usage
      • C Usage
      • WASM Usage
      • Rust API
      • Client-side API
    • Valida zk-VM
  • ADVANCED USAGE
    • zk-VM: Advanced Usage
    • Using the Rust Toolchain
    • Using LLVM libc
  • Architecture
    • Overview
    • Proving System: Plonky3
      • Future Directions
    • Valida zk-VM
      • Technical Design: VM
      • Technical Design: Prover
      • GitHub Link
    • LLVM-Valida Compiler
      • Technical Design
      • GitHub Link
    • Benchmarks
      • Fibonacci (vs. RISC Zero)
      • Fibonacci (vs. SP1)
      • Fibonacci (vs. Jolt)
      • Fibonacci (Rust vs. C)
      • SHA-256 (vs. RISC Zero)
      • SHA-256 (vs. SP1)
      • SHA-256 (vs. Jolt)
  • Core Concepts
    • zk-VM
    • Proofs: Classical, Probabilistic, Succinct, and ZK
    • Evaluating zk-VMs
    • ZK-VM Design Tradeoffs
    • Valida Design Considerations
  • Contributing
    • Overview
    • Early Access Program
Powered by GitBook
On this page
  • Usage Instructions for Rust
  • Rust library functions, etc.
  1. Quick Start
  2. Valida Compiler Toolchain

Rust Usage

PreviousValida Compiler ToolchainNextC Usage

Last updated 2 months ago

Usage Instructions for Rust

For examples of how to build a Rust program which compiles and runs on Valida, see . You can use any of these examples as a starting point for developing your own programs using the Valida toolchain. Here are steps for doing so:

  1. Clone the project template:

git clone https://github.com/lita-xyz/fibonacci.git

Basing your project on the project template is not needed unless you require pseudo-random number functions to be available. If that is not the case, then you can replace the above with cargo new fibonacci.

  1. cd into the project template:

cd fibonacci
  1. Enter the Valida shell or the Docker toolchain shell, following the instructions specific to your selected .

  2. Build the project:

cargo +valida build --release
  1. Run the code:

valida run --fast target/valida-unknown-baremetal-gnu/release/fibonacci log

If your program requires the pseudo-random number support included in the valida_rs crate, you need the following boilerplate:

valida_rs::entrypoint!main(main);

fn main() {
    ...
}

If you do not require random number support, then you don't need any boilerplate in the main.rsmodule.

Rust library functions, etc.

See for more information on how to write Rust programs to run on Valida.

lita-xyz/rust-examples on Github
installation method
USAGE: Using the Rust toolchain