15 releases (breaking)

0.11.0 Nov 5, 2024
0.9.1 Apr 4, 2024
0.8.0 Feb 27, 2024
0.7.0 Oct 11, 2023
0.1.0 Nov 16, 2021

#485 in Cryptography

Download history 1983/week @ 2024-08-19 1503/week @ 2024-08-26 781/week @ 2024-09-02 1321/week @ 2024-09-09 1607/week @ 2024-09-16 1246/week @ 2024-09-23 999/week @ 2024-09-30 876/week @ 2024-10-07 922/week @ 2024-10-14 879/week @ 2024-10-21 169/week @ 2024-10-28 1663/week @ 2024-11-04 264/week @ 2024-11-11 838/week @ 2024-11-18 892/week @ 2024-11-25 878/week @ 2024-12-02

2,890 downloads per month
Used in 16 crates (4 directly)

MIT license

1MB
14K SLoC

Miden verifier

This crate contains a light-weight verifier which can be used to verify proofs of program execution generated by Miden VM.

While Miden crate also contains verifier functionality, if a project needs only to verify proofs generated by Miden VM, this crate may be more appropriate to rely on.

Usage

This crate exposes a verify() function which can be used to verify proofs of program execution. The function takes the following parameters:

  • program_info: ProgramInfo - a structure containing the hash of the program to be verified (represented as a 32-byte digest), and the hashes of the kernel procedures used to execute the program.
  • stack_inputs: StackInputs - a list of the values with which the stack was initialized prior to the program's execution.
  • stack_outputs: StackOutputs - a list of the values returned from the stack after the program completed execution.
  • proof: ExecutionProof - the proof generated during program execution.

Stack inputs are expected to be ordered as if they would be pushed onto the stack one by one. Thus, their expected order on the stack will be the reverse of the order in which they are provided, and the last value in the stack_inputs is expected to be the value at the top of the stack.

Stack outputs are expected to be ordered as if they would be popped off the stack one by one. Thus, the value at the top of the stack is expected to be in the first position of the stack_outputs, and the order of the rest of the output elements will also match the order on the stack. This is the reverse of the order of the stack_inputs.

The function returns Result<u32, VerificationError> which will be Ok(security_level) if verification passes, or Err(VerificationError) if verification fails, with VerificationError describing the reason for the failure.

Verifying execution proof of a program basically means the following:

If a program with the provided hash is executed against some secret inputs and the provided public inputs, it will produce the provided outputs.

Notice how the verifier needs to know only the hash of the program - not what the actual program was.

Crate features

Miden verifier can be compiled with the following features:

  • std - enabled by default and relies on the Rust standard library.
  • no_std does not rely on the Rust standard library and enables compilation to WebAssembly.
    • Only the wasm32-unknown-unknown and wasm32-wasip1 targets are officially supported.

To compile with no_std, disable default features via --no-default-features flag.

License

This project is MIT licensed.

Dependencies

~8–33MB
~499K SLoC