Skip to main content

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.