Skip to content

karnotxyz/proof-generator

Repository files navigation

Proof Generator

A proof generator for cairo programs.

Credits

This repository uses stone-prover under the hood to generate proofs and uses cairo-vm to run, compile. The bootloader is taken from bootloader repository. To know more about bootloading check this out

Overview

You can generate proofs for cairo programs here. There are 2 ways to genrate proofs:

  1. First bootloading the program and then proving the execution of the bootloader. This is the recommended way and generates smaller proofs. Check out a simple bootloader here
  2. Proving the execution of the program directly.

Installation

Run the following command to install the dependencies:

./install.sh
cargo build

Files

compiled.json: The compiled Cairo program. input.json: Input data for the Cairo program. public_input.json: Public inputs for the proof generation. private_input.json: Private inputs for the proof generation. trace.bin: Execution trace of the Cairo program. memory.bin: Memory dump of the Cairo program execution. proof.json: The generated STARK proof. pie.zip: Cairo PIE (Program Independent Executable) that can be generated by running the program and can be used re run the file in standardised way without inputs. This is only kept for reference/debugging purposes and not used for proof generation. cpu_air_prover_config.json: Configuration file for the CPU AIR prover(stone-prover). cpu_air_params.json: Parameters file for the CPU AIR prover(stone-prover).

Preparing a program

To checkout an example, check out the examples directory.

  1. Create a new cairo program to prove, e.g. dummy_snos.cairo.
  2. Create a corresponding input file, e.g. dummy_snos_input.json.
  3. Modify the examples/cpu_air_params.json and examples/cpu_air_config.json to fit your needs. Check out the stone-prover documentation to see how to generate these files.

Generating a proof

  • If you want to generate a proof after bootloading it, run:
make prove_with_bootloader CAIRO_PROGRAM=<path_to_cairo_file>
  • If you want to generate a proof for a program directly, run:
make prove_with_program CAIRO_PROGRAM=<path_to_cairo_file>
  • If you want to generate a PIE(Position Independent Executable) program, run:
make generate_pie CAIRO_PROGRAM=<path_to_cairo_file>
  • If you want to run the PIE program, run:
make run_pie CAIRO_PROGRAM=<path_to_cairo_file>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published