A command-line and HTTP server application performing a recursive verification of a zero-knowledge proof using WHIR.
go run cmd/cli/main.go [flags]--configPath to the JSON configuration file containing verifier circuit parameters (default:../noir-examples/poseidon-rounds/params_for_recursive_verifier)--r1csPath to the R1CS JSON file describing the constraint system of the inner circuit (default:../noir-examples/poseidon-rounds/r1cs.json)--ccsOptional path to store the constraint system object of the verifier circuit (default: empty, don't serialize)--pkOptional path to load the Proving Key (PK) that will be used to generate proof for the verifier circuit. If not provided, PK will be generated unsafely (default: empty, generate own key)--vkOptional path to load the Verifying Key (VK) that will be used to prove the verifier circuit. If not provided, VK will be generated unsafely (default: empty, generate own key)
Start the HTTP server:
go run cmd/server/main.goThis repository provides an HTTP API for verifying proofs.
http://localhost:3000 (when running locally)
GET /api/v1/ping
Returns a simple health check response.
Response:
pong
POST /api/v1/verify
Generic endpoint for verifying proofs with trusted setup keys vk/pk generated by server.
Request:
Send a multipart/form-data POST request with the following fields:
config(required): JSON configuration file containing verifier circuit parametersr1cs(required): R1CS JSON file describing the constraint system of the inner circuitr1cs_url(optional): Publicly exposed url for downloading r1cs file. Takes precedence over r1cs file if both provided.pk_url(optional): Publicly exposed url for downloading proving keyvk_url(optional): Publicly exposed url for downloading verifying key
Response:
- Success (200):
Verification successful - Error (400): Error message describing the failure
The server is configured with the following settings:
- Port: 3000
- Read Timeout: 10 minutes (for file uploads)
- Write Timeout: 5 minutes (for responses)
- Idle Timeout: 90 minutes (total connection time)
- Body Limit: 2GB (total size for params and R1CS files)
- CORS: Enabled with permissive settings
curl -X POST \
-F "config=@params_for_recursive_verifier" \
-F "r1cs=@r1cs.json" \
http://localhost:3000/api/v1/verifyThe API returns appropriate HTTP status codes:
- 200: Verification successful
- 400: Bad request (missing files, verification failed, etc.)
- 500: Internal server error
- config: Must be a valid JSON file containing verifier circuit parameters
- r1cs: Must be a valid R1CS JSON file describing the constraint system