Skip to main content

Support for PSE Fork of Halo2

We have broadened our coverage over the Halo2 ecosystem by integrating the PSE fork of Halo2. If you have previously utilized Sindri's API for Axiom v0.2.2 or Axiom v0.3.0 circuits, you will find that many of the requirements are the same. In particular, here is an example sindri.json file that specifies the required fields for the PSE v0.3.0 framework.

sindri.json
{
"$schema": "https://sindri.app/api/v1/sindri-manifest-schema.json",
"name": "my-circuit",
"circuitType": "halo2",
"className": "my_rust_package::MyCircuit",
"degree": 8,
"halo2Version": "pse-v0.3.0",
"packageName": "my_rust_package"
}

Compatible circuits must implement the Circuit trait and provide definitions for the following two functions.

pub fn from_json(json_loc: &str) -> (MyCircuit<Fr>, Vec<Vec<Fr>>) {
// Construct a circuit by loading a JSON file from the path argument
// Also send back the concrete instances which should be passed
// to create_proof
}

pub fn keygen_circuit() -> MyCircuit<Fr> {
// Construct an empty or default circuit for key generation
}

You should expect broader curve coverage in the future! But for now, Fr above, must be the scalar field for BN254.

Check out some example circuits in the sindri-resources repository to get started creating proofs via the PSE fork of Halo2. You can also use the Sindri CLI init command to create a minimal PSE-halo2 template to work from.

Support for PlonK in Gnark

Until recently, Groth16 was Sindri's only supported proving scheme when targeting the gnark framework. Today, we're pleased to announce support for the PlonK proving scheme with full GPU acceleration in gnark versions v0.9.0 and above. All you need to do to use PlonK as a proving backend is to set the provingScheme to plonk in your sindri.json manifest file, like so:

sindri.json
{
"$schema": "https://sindri.app/api/v1/sindri-manifest-schema.json",
"circuitStructName": "MyCircuit",
"circuitType": "gnark",
"curve": "bn254",
"gnarkVersion": "v0.9.0",
"name": "my-circuit",
"packageName": "mypackage",
"provingScheme": "plonk"
}

PlonK is particularly well-suited for situations where you need to write a large number of different circuits implementing separate business logic flows. The fact that it supports a universal trusted setup makes it easy to manage securely deploying many circuits compared to Groth16 (which requires circuit-specific trusted setups). For example, our friends over at Maya Labs are using Gnark PlonK circuits with Sindri to provably verify the integrity and trustworthiness of digital media.

You can check out Consensys' guide on proving schemes and curves to learn more about the tradeoffs between Groth16 and Plonk!

Streamlining Python SDK Imports

v0.1.0a17

Previous to this release, your import of the Sindri API client in a python script looked something like this:

from sindri.sindri import Sindri

As a small act of service, we've simplified that to

from sindri import Sindri

No need to update your existing code, as the old version version still works!

Cloning Public Circuits

v0.0.1-alpha.42

This release of Sindri's CLI allows you to share and learn from public circuits. Specifically, any version tag of any circuit marked as a public project can be downloaded via the sindri clone command.

All of the circuits in our sindri-resources database are public projects and are available to clone. Try something like:

sindri clone sindri/decision-tree:public

Prove via Public Circuits and Streamlining Proof Lists

Prove via Public Circuits

This release of the API allows you to prove from circuits that have previously been compiled from any other user or team, as long as they are marked public.

All of the circuits in our sindri-resources database are public projects and are available to clone. Try something like:

prove sindri/multiplier2:public '{"X":7, "Y": 3}'

Streamlining Proof Lists

Previously, when you requested a list of proofs from a circuit, the API sent back one bulk response containing all of the details for all proofs. For an older circuit that has built up many proofs over time, this can cause sluggish behavior while your application receives and processes all that data.

As of this release, the proof detail endpoint is the only place where you can retrieve the full data for a proof (including the proof and public fields). You can still incorporate logic into your application that retrieves all of the proofs for a single circuit; you'll just have to separate that process into two steps:

  1. Request all of the proofs for a specific circuit
  2. Loop over the proof_id field and request the proof details for each

Create Proofs via the CLI

v0.0.1-alpha.39

Circuit writing is a lot like coding in a compiled language - you can encounter both compile time and runtime errors. Our CLI already enabled you to easily initialize a circuit project and deploy to the Sindri platform via the sindri deploy command. This utility allows you to quickly find compile time errors and address them. The newest release of the CLI can help uncover runtime errors via the sindri proof create command. Running end-to-end compilation through proving tasks in the same command line interface allows you to ensure your proving input is properly formatted and that your circuit behaves like you expect it to.

As an added bonus, you can use this new functionality to quickly benchmark against various circuits and frameworks without context-switching or relying on verbose scripts.

This section in the CLI Quickstart shows you how its done!

Retrieve Smart Contract Artifacts

v0.1.0a17

We added methods to our python SDK that will streamline smart contract development alongside your ZK-app! In particular, you can now retrieve smart contract solidity code for compiled circuits for most frameworks. Within Circom, you can also retrieve the outputs from a proof pre-formatted as calldata.

To see these methods in action, check out Rollkit's zkML Tutorial.

Smart Contracts and Noir JSON Input

EthGlobal's Hackathon gave us invaluable insights - inspiring the following two new features:

Solidity Proof Verifier Smart Contract

Feedback: Co-developing a smart contract verifier alongside a zk-app [backed by Sindri's API] needs to involve fewer intermediate steps.

Many frameworks will generate smart contract code which can verify proofs tied to your specific circuit and verifying key. Previously, Sindri has offered guidance on integrating those contracts within your Sindri workflow. This new release streamlines that process by offering an endpoint to retrieve a solidity smart contract verifier for Circom, Noir, and Gnark circuits! Note that you must use bn254 with your Gnark circuit to enable this functionality. Furthermore, Halo2 verifiers are still under construction.

The easiest way to get started utilizing this feature is via the Python SDK (you'll need release v0.1.0a17 or newer).

Python SDK Smart Contract Generation
import os
from sindri import Sindri
sindri = Sindri(os.getenv("SINDRI_API_KEY", ""))
circuit_id = "" # Fill in the name of your compiled circuit here!
smart_contract_code = sindri.get_circuit_smart_contract_verifier(circuit_id)
with open("Verifier.sol", "w") as f:
f.write(smart_contract_code)

JSONified Noir Proof Inputs

Feedback: Requiring Noir circuits to have TOML-formatted proof inputs, while every other framework accepts JSON, inhibits rapid development.

We updated the Sindri API proof-create endpoint to accept JSON-serialized inputs for any framework (TOML input for Noir is still fine!) This allows you to send the Prover.toml file to Sindri while you are developing your Noir circuit locally, but then use JSON-strings in production (avoiding the common "gotchas" surrounding the string parsing of a newline character). For more on Noir support see our Sindri x Nargo work.

A Unified Sindri + Nargo CLI DevEx

v0.0.1-alpha.35

A few days ago, we announced the Sindri CLI's incorporation of Trail of Bit's useful command line tool Circomspect for Circom devs. For Noir devs, we are proud to introduce the integration of Nargo commands via the Sindri CLI. You can now access two circuit writing toolkits via a single library install! An example of one possibility that opens up is featured below:

Create a circuit with the Sindri CLI and analyze it with Nargo
npm install -g sindri@latest
sindri init noir-circuit # Go through the Q&A to produce a Noir circuit
cd noir-circuit
sindri x nargo info

Note that there are a number of nargo versions available. The sindri x nargo suite will choose the version matching your noirVersion field in the sindri.json manifest of your circuit directory. If that isn't found (maybe you have not started writing it), the latest available version of Nargo is used. For the full set of commands available, check out the reference docs.

A Unified Sindri + Circomspect CLI DevEx

v0.0.1-alpha.32

This is the first of a number of enhancements to the CLI intended to ease frustration while writing circuits via the incorporation of key open-source libraries. Our initial integration builds in the Trail of Bits' Circom analysis tool: Circomspect. Previously, you could use sindri init to create a handful of circuits in different frameworks that are built from scratch via templates. That functionality allows you to quickly get started writing Circom circuits by filling in the essentials. With this new integration, you can use sindri x circomspect to analyze your circuit while its under development.

See the corresponding blog post for an in-depth description and a demo! For the full set of commands available, check out the reference docs.