Sunspot provides tools to prove and verify noir circuits on solana.
⚠️ Requires Noir 1.0.0-beta.13
Make sure you have Go 1.24+ and Solana tools installed.
# Clone the repository
git clone git@github.com:reilabs/sunspot.git
cd sunspot/go
# Build the binary
go build -o sunspot .You can move the binary to a directory already in your PATH (easiest):
sudo mv sunspot /usr/local/bin/Alternatively, you can create a bin folder in your home directory and add it to your PATH.
# Create a personal bin folder if you don’t have one
mkdir -p ~/bin
mv sunspot ~/bin/Then add this line to your shell configuration file:
-
For bash:
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile
-
For zsh (default on macOS):
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
Now you can run sunspot from anywhere:
sunspot --helpGNARK_VERIFIER_BIN must point to the verifier-bin crate directory in order for sunspot deploy to work.
To configure this, add the following line to your shell’s configuration file:
export GNARK_VERIFIER_BIN=/path/to/verifier-bin- bash (Linux): add the line to
~/.bashrc - bash (macOS): add the line to
~/.bash_profile - zsh: add the line to
~/.zshrc
After editing the file, reload your shell:
source ~/.bashrc # or ~/.bash_profile, ~/.zshrc depending on your shellNow GNARK_VERIFIER_BIN will be available in all future terminal sessions.
Reload your shell:
source ~/.bashrc # or ~/.zshrcAfter installing Sunspot, you can use it as a command-line tool for working with Noir circuits on Solana.
sunspot [command]| Command | Description |
|---|---|
compile |
Compile an ACIR file into a CCS file |
completion |
Generate the autocompletion script for the specified shell |
help |
Display help information about any command |
prove |
Generate a Groth16 proof and public witness from an ACIR file, a witness, CCS, and proving key |
setup |
Generate a proving key (pk) and verifying key (vk) from a CCS file |
verify |
Verify a proof and public witness with a verification key |
deploy |
Create a verifying solana program executable and keypair |
# Compile a Noir ACIR file into a CCS file
sunspot compile my_circuit.json
# Generate a proving and verifying key
sunspot setup my_circuit.ccs
# Create a Groth16 proof
sunspot prove my_circuit.json witness.gz my_circuit.ccs proving_key.pk
# Verify a proof
sunspot verify verifying_key.vk proof.proof public_witness.pw
# Create Solana verification program
sunspot deploy verifying_key.vk /path/to/verifier/bin/crateFor detailed information on each command:
sunspot [command] --helpThis project is organized as follows:
go/– Contains functionality to parse Noir circuits and witnesses and produces gnark outputs, also contains CLI functionality ingo/cmdsubdirectory.gnark-solana/– Provides functionality to verify gnark proofs on solana, a fuller description of this directory can be found here.noir-samples/– Example Noir projects used for unit and integration tests.testgen- Creates ACIR snippets to test parsing, does not produce semantically valid programs.
- Light Protocol
Our thanks goes to Light protocol, the original authors of the Groth16-solana repo, who published it under the Apache 2.0 License. We used this for inspiration for our own core Gnark verifier for both the error type definition and some of the core verifier functionality.