Skip to content

Releases: 0xmozak/mozak-vm

Mozak VM v0.1.0

24 Oct 23:45
b21d4f4
Compare
Choose a tag to compare

v0.1.0

Summary

Mozak-VM is a ZK RISC-V virtual machine, which allow the execution of arbitrary programs that can be compiled down to RISC-V instructions to be provable and verifiable.

This is the first version of this VM. It is built with [Starky](https://github.com/0xPolygonZero/plonky2/tree/main/starky).

What’s Included

In this release we have

  • The runner: An executor that reads RISC-V instructions in [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) format, runs them and produces an execution trace.
  • A Starky based constraint system that can constrain and prove the execution trace produced by runner. This component is managed by the circuits crate.
  • A simple command-line interface (CLI) that allows proof generation from an ELF file and verification of proofs produced by the VM.
  • An optimised implementation of the Poseidon2 Hash function for the circuits

Usage

Writing Programs

Users have the capability to create what we term "guest programs" in the Rust programming language, which can subsequently be compiled into the ELF format.

As an illustration, consider a Fibonacci program:

#![no_main]
#![no_std]

use core::{assert, assert_eq};

fn fibonacci(n: u32) -> (u32, u32) {
    if n < 2 {
        return (0, n);
    }
    let (mut curr, mut last) = (1_u64, 0_u64);
    for _i in 0..(n - 2) {
        (curr, last) = (curr + last, curr);
    }
    ((curr >> 32) as u32, curr as u32)
}

pub fn main() {
    let (high, low) = fibonacci(40);
    assert!(low == 63245986);
    assert_eq!(high, 0);
    guest::env::write(&high.to_le_bytes());
}

guest::entry!(main);

For more examples, checkout the examples folder and its README.md file in the Mozak-VM repository.

Using the CLI

To get started using the CLI, follow these steps in order:

Clone the repository with the command: git clone https://github.com/0xmozak/mozak-vm

Install the CLI using Cargo with: cargo install --path ./mozak-vm/cli/

For guidance and available commands, run: mozak-cli --help

What’s Next

We have plans including:

  • Performance benchmarking of the VM
  • Evaluation of whether we should transition to Plonky3 proof system
  • Integration of the VM with mozak-node
  • Research into enhanced lookup argument methods
  • Auditing of the circuits

Changes

This marks the initial release of Mozak-VM