PetraVM is a general-purpose virtual machine that is succinctly verifiable using the Binius proof system. The PetraVM execution model and instruction set are designed specifically for efficient proving with Binius. The VM is intended to handle several use cases simultaneously:
The VM consists of a basic instruction set and optional instruction set extensions. The arithmetization of the machine enables the prover and verifier to only handle the ISA extensions used by an agreed-upon program.
The full machine specification can be found here.
Documentation is still incomplete and will be improved over time. You can go through the PetraVM book for explanations on the zkVM design and architecture.
PetraVM's full instruction set is divided into five categories:
Prover support for the full instruction set is a work in progress, tracked below.
The VM will also define a minimal ISA tailored for efficient recursion.
Expansion to include RAM-related instructions is kept for future work.
Note: In PetraVM, variables refer to addresses in VROM (Value ROM, a write-once memory region). Instructions operate on values at these addresses unless specified as "immediate" operations.
Note: Check out our instruction set test suite for a complete overview of supported instructions and their usage.
B32_MUL - 32-bit binary field multiplicationB32_MULI - 32-bit binary field multiplication with immediateB128_ADD - 128-bit binary field additionB128_MUL - 128-bit binary field multiplicationADD - Integer additionADDI - Integer addition with immediateSUB - Integer subtractionMUL - Signed multiplicationMULI - Signed multiplication with immediateMULU - Unsigned multiplicationMULSU - Signed × unsigned multiplicationAND - Bitwise ANDANDI - Bitwise AND with immediateOR - Bitwise ORORI - Bitwise OR with immediateXOR - Bitwise XORXORI - Bitwise XOR with immediateSLL - Shift left logicalSLLI - Shift left logical with immediateSRL - Shift right logicalSRLI - Shift right logical with immediateSRA - Shift right arithmeticSRAI - Shift right arithmetic with immediateSLT - Set if less than (signed)SLTI - Set if less than immediate (signed)SLTU - Set if less than (unsigned)SLTIU - Set if less than immediate (unsigned)SLE - Set if less than or equal (signed)SLEI - Set if less than or equal immediate (signed)SLEU - Set if less than or equal (unsigned)SLEIU - Set if less than or equal immediate (unsigned)LDI.W - Load immediate wordMVV.W - Move word between addressesMVV.L - Move 128-bit value between addressesMVI.H - Move immediate half-wordJ - Jump to label or address
JUMPI - Jump to immediate addressJUMPV - Jump to address in variableBNZ - Branch if not zeroCALLI - Call function at immediate addressCALLV - Call function at variable addressTAILI - Tail call to immediate addressTAILV - Tail call to variable addressRET - Return from functionFP - Dump current FP valueLW/SW - Load/Store wordLB/SB - Load/Store byteLBU - Load byte unsignedLH/SH - Load/Store halfwordLHU - Load halfword unsignedThe project includes several example programs that demonstrate the capabilities of PetraVM:
# Calculate and prove the 10th Fibonacci number
RUSTFLAGS="-C target-cpu=native" cargo run --release --example fibonacci -- -n 10
# Run Collatz conjecture for starting value 7
RUSTFLAGS="-C target-cpu=native" cargo run --release --example collatz -- -n 7
The project is actively developed. Many instructions are already supported by the prover, with new instructions and additional features added regularly.
assembly: zkVM assembly DSL, parser and program executorprover: Circuit definition and proof generationLicensed under Apache 2.0. See LICENSE.
The PetraVM project is a collaboration between several teams and welcomes community contributions. Please open issues or pull requests for bugs, features, or improvements. See the CONTRIBUTING document for guidelines.
The initial development is led by Polygon and Irreducible.
We reserve the right to close issues and PRs deemed unnecessary or not bringing sufficient interest.
Rust
98.3%
Python
1.4%
PetraVM is a general-purpose virtual machine that is succinctly verifiable using the Binius proof system. The PetraVM execution model and instruction set are designed specifically for efficient proving with Binius. The VM is intended to handle several use cases simultaneously:
The VM consists of a basic instruction set and optional instruction set extensions. The arithmetization of the machine enables the prover and verifier to only handle the ISA extensions used by an agreed-upon program.
The full machine specification can be found here.
Documentation is still incomplete and will be improved over time. You can go through the PetraVM book for explanations on the zkVM design and architecture.
PetraVM's full instruction set is divided into five categories:
Prover support for the full instruction set is a work in progress, tracked below.
The VM will also define a minimal ISA tailored for efficient recursion.
Expansion to include RAM-related instructions is kept for future work.
Note: In PetraVM, variables refer to addresses in VROM (Value ROM, a write-once memory region). Instructions operate on values at these addresses unless specified as "immediate" operations.
Note: Check out our instruction set test suite for a complete overview of supported instructions and their usage.
B32_MUL - 32-bit binary field multiplicationB32_MULI - 32-bit binary field multiplication with immediateB128_ADD - 128-bit binary field additionB128_MUL - 128-bit binary field multiplicationADD - Integer additionADDI - Integer addition with immediateSUB - Integer subtractionMUL - Signed multiplicationMULI - Signed multiplication with immediateMULU - Unsigned multiplicationMULSU - Signed × unsigned multiplicationAND - Bitwise ANDANDI - Bitwise AND with immediateOR - Bitwise ORORI - Bitwise OR with immediateXOR - Bitwise XORXORI - Bitwise XOR with immediateSLL - Shift left logicalSLLI - Shift left logical with immediateSRL - Shift right logicalSRLI - Shift right logical with immediateSRA - Shift right arithmeticSRAI - Shift right arithmetic with immediateSLT - Set if less than (signed)SLTI - Set if less than immediate (signed)SLTU - Set if less than (unsigned)SLTIU - Set if less than immediate (unsigned)SLE - Set if less than or equal (signed)SLEI - Set if less than or equal immediate (signed)SLEU - Set if less than or equal (unsigned)SLEIU - Set if less than or equal immediate (unsigned)LDI.W - Load immediate wordMVV.W - Move word between addressesMVV.L - Move 128-bit value between addressesMVI.H - Move immediate half-wordJ - Jump to label or address
JUMPI - Jump to immediate addressJUMPV - Jump to address in variableBNZ - Branch if not zeroCALLI - Call function at immediate addressCALLV - Call function at variable addressTAILI - Tail call to immediate addressTAILV - Tail call to variable addressRET - Return from functionFP - Dump current FP valueLW/SW - Load/Store wordLB/SB - Load/Store byteLBU - Load byte unsignedLH/SH - Load/Store halfwordLHU - Load halfword unsignedThe project includes several example programs that demonstrate the capabilities of PetraVM:
# Calculate and prove the 10th Fibonacci number
RUSTFLAGS="-C target-cpu=native" cargo run --release --example fibonacci -- -n 10
# Run Collatz conjecture for starting value 7
RUSTFLAGS="-C target-cpu=native" cargo run --release --example collatz -- -n 7
The project is actively developed. Many instructions are already supported by the prover, with new instructions and additional features added regularly.
assembly: zkVM assembly DSL, parser and program executorprover: Circuit definition and proof generationLicensed under Apache 2.0. See LICENSE.
The PetraVM project is a collaboration between several teams and welcomes community contributions. Please open issues or pull requests for bugs, features, or improvements. See the CONTRIBUTING document for guidelines.
The initial development is led by Polygon and Irreducible.
We reserve the right to close issues and PRs deemed unnecessary or not bringing sufficient interest.
Rust
98.3%
Python
1.4%