Skip to main content

Statement utilities

This page describes scripts for circuit developers and proof producers, prepare_statement.py and statement_tools.py.

Make sure you've signed up before continuing.

Building statements from circuits

Circuits are stored on Proof Market in the form of statements.

A statement contains the circuit and metadata describing this circuit.

Usage

Attach all additional metadata to circuits generated by the zkLLVM compiler before publishing them on Proof Market.

To see all parameters that can be passed to the script, run it with the -h option:

$ python3 prepare_statement.py -h

usage: prepare_statement.py [-h] -c CIRCUIT -o output_file_path -n NAME -t \
statement_type (--private | --public)

options:
-h, --help show this help message and exit
-c CIRCUIT, --circuit CIRCUIT
Path to a zkLLVM circuit (*.ll)
-o output_file_path, --output output_file_path
Output file
-n NAME, --name NAME Statement name that will be shown on Proof Market
-t statement_type, --type statement_type
Statement type: placeholder-zkllvm or placeholder-vanilla
--private Make a statement private: only accessible by ID
--public Make a statement public: visible on Proof Market

Please note that --private and --public parameters are mutually exclusive:

  • With --private, the statement will be accessible only by its ID. Use private statements for testing circuits in development and making experiments.
  • With --public, the statement will be openly listed on Proof Market.

Example

python3 prepare_statement.py -c arithmetics_example.ll -n arithmetic -t placeholder-zkllvm -o \
arithmetic.json --private

Statement examples can be found in ./example/statements/ directory.

Publishing statements

To publish a statement on Proof Market, use the statement_tools.py script.

See the building statements section above.

Usage

$ python3 statement_tools.py push -h

usage: statement_tools.py push [-h] --file FILE

options:
-h, --help show this help message and exit
--file FILE file

If successful, this command will return the following output with your statement's ID (key):

Statement from template.json was pushed with key 12345678.

Example

python3 statement_tools.py push --file arithmetic.json

Retrieving statements

Usage

python3 statement_tools.py get -h
usage: statement_tools.py get [-h] [--key KEY] [-o OUTPUT]

options:
-h, --help show this help message and exit
--key KEY statement key
-o OUTPUT, --output OUTPUT
output file

Examples

All statements can be retrieved from Proof Market like this:

$ python3 statement_tools.py get

[
{
"_key": "32326",
"createdOn": 1674120024409,
"definition": {
"proving_key": "; ModuleID = '.....",
"verification_key": "; ModuleID = '..."
},
"description": "toy circuit example with basic arithmetic operations",
"input_description": "a, b from Pallas curve base field",
"isPrivate": false,
"name": "arithmetic-example",
"sender": "root",
"type": "placeholder-zkllvm",
"updatedOn": 1674120024410,
"url": "https://github.com/NilFoundation/zkllvm",
"childs": []
},...
]

To retrieve a selected statement/circuit definition and its metadata uploaded upon the statement's publishing:

statement_tools.py get --key <key of the statement> -o <output file>

For example:

python3 statement_tools.py get --key=32292 -o=circuit_statement.json