Skip to main content

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.

Non-Blocking Option for Python Methods

v0.1.0a14

If you've used Sindri's Python SDK (possibly by following along with our Python quickstart guide) then you may have noticed a pause when using the create_circuit and prove_circuit methods. Under the hood, these functions are submitting your circuit compile or prove job and polling until the status of the job is complete. While this abstraction is convenient for many cases, your application may have other tasks it can work on independently while Sindri's API processes these requests. For this reason, we added the wait argument to both create_circuit and create_proof.

If you'd like to utilize this "non-blocking" functionality, you can call the methods like so:

python snippet
import os
from sindri import Sindri
sindri = Sindri(os.getenv("SINDRI_API_KEY", ""))
proof_id = sindri.prove_circuit("my-circuit", '{"X": 2, "Y": 2}', wait=False)

The wait argument is assumed to be True if not found. Notice that we did not call create_circuit with wait=False in the code-block above. If we did, the proof would not properly execute because the circuit would not be ready by the time prove_circuit is called.

Extending Noir Version Support

Our initial Noir support was limited to v0.17.0. As the Noir documentation explicitly states:

Noir is in full-speed development. Things break fast, wild, and often.

This release extends our support to more of the latest stable Noir versions, including v0.17.0, v0.18.0, v0.19.4, v0.22.0, v0.23.0. You should indicate which version you are developing with when you upload your circuit to Sindri's API via the noirVersion field in your sindri.json manifest. While we recommend you choose the latest version available, it is more important to match the version of Noir you have installed locally - otherwise the proofs returned from Sindri might not be compatible with your local verifier or smart contract.

Specify your Main Circom File

Prior to this release, Circom developers had to potentially rewrite local circuits so that their main component definition was contained in a file called circuit.circom located in the root of their circuit upload. We have addressed this inconvenience so you can now organize your circuit workspace in more intuitive ways. Simply include the path to your main circom file in the circuitPath field of your sindri.json manifest. If the circuitPath field is not found, Sindri will assume you have opted to compile the old way: via a circuit.circom file at the root of your project.

An Example
Circuit Directory Structure
📦CIRCUIT-PROJECT
┣ 📂circomlib
┃ ┣ 📜aliascheck.circom
┃ ┣ 📜binsum.circom
┃ ┣ 📜bitify.circom
┃ ┣ 📜comparators.circom
┃ ┣ 📜compconstant.circom
┃ ┗ 📜gates.circom
┣ 📂my-code
┃ ┣ 📜game.circom
┃ ┗ 📜utils.circom
┗ 📜sindri.json

Introducing Sindri TypeScript SDK Library

file_type_typescript
v0.0.1-alpha.20

Sindri's TypeScript SDK is live! It contains all the functionality of our command line interface while bridging the gap towards production use cases.

After integrating our library into your project dependencies, compiling a circuit and creating a proof can be accomplished with virtually three lines of code!

snippet.js
sindri = require('sindri');
circuit = await sindri.createCircuit('.');
proof = await sindri.proveCircuit(circuit.circuit_id, '{"X": 2, "Y": 2}');

See the complete reference documentation for more details.

Circuit Tagging

v1.5.25

We've finalized support within the API for "circuit tagging."

Circuit development is generally an iterative process; in your initial design phase, you will repeatedly compile your circuit as a vital part of testing. In production, you may discover vulnerabilities in your circuit. Updating the circuit in Sindri will require recompiling the circuit. This leads to many compiled circuits from the same root project. You can now easily navigate through these circuits via tags.

The CLI documentation is the best reference to get started using tagged circuits. See the -t option here.

Introducing the Sindri Changelog

Evan Sangaline
Principal Software Engineer

This is the new home of announcements relating to new features and changes for the Sindri service. Be sure to check back frequently for the latest updates.