Getting Started with CRISP
This guide will walk you through the steps to set up and run CRISP locally. CRISP is a complete example of an E3 Program, built with a modern architecture that includes smart contracts, zero-knowledge circuits, frontend applications, and secure computation components.
Prerequisites
Before getting started, ensure you have installed:
- Rust (opens in a new tab)
- Foundry (opens in a new tab)
- RiscZero (opens in a new tab)
- NodeJS (opens in a new tab)
- pnpm (opens in a new tab)
- MetaMask (opens in a new tab)
- Noir toolchain (
nargo(opens in a new tab),bb(opens in a new tab))
Quick Start
The simplest way to run CRISP is:
# Install dependencies and build everything
pnpm dev:setup
# Start all services (Hardhat, contracts, ciphernodes, program server, coordination server, and UI)
pnpm dev:updev:up runs scripts/dev.sh, which:
- Starts the Hardhat node in
packages/crisp-contracts - Deploys all contracts (Enclave, CRISPProgram, verifiers, registries) via
scripts/crisp_deploy.sh - Starts ciphernodes using
enclave.config.yamlviascripts/dev_cipher.sh - Launches the program server via
scripts/dev_program.sh - Starts the coordination server (Rust) via
scripts/dev_server.shon port4000 - Starts the React client via
scripts/dev_client.shon port3000
All services run concurrently and will automatically restart if needed.
Additional Commands
# Recompile Noir circuits and generate verifiers
pnpm compile:circuits
# Open the interactive CLI to start voting rounds
pnpm cli
# Run end-to-end tests
pnpm test:e2eDeployed Contract Addresses
The contract addresses are automatically configured in enclave.config.yaml and the server .env
file. After running pnpm dev:up, the deployment logs will show the deployed contract addresses,
which are also saved in packages/crisp-contracts/deployed_contracts.json.
Using the Application
Once everything is running, you can:
- Navigate
http://localhost:3000for the client interface - Add the Hardhat private key to your wallet:
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 - Press
Connect Walletbutton and complete the association with your MetaMask account - Switch to
Hardhatlocal network (this will be handled automatically by the app. You just need to press on the connected account on the frontend and select the network. Then, complete the configuration on MetaMask pop-up). - Open a new terminal, run
pnpm cliand start a new E3 Round. - Refresh and interact with the round following the Client interface.
Configuration
Ciphernode Configuration
The enclave.config.yaml file in the CRISP root directory configures the ciphernode network. By
default, it runs in development mode with fake proofs for fast local development:
program:
dev: true # Uses fake zkVM proofs (fast for development)Boundless Configuration
For production-grade zero-knowledge proofs with Boundless (opens in a new tab), update
enclave.config.yaml:
program:
dev: false # Disable dev mode to use real proofs
risc0:
risc0_dev_mode: 0 # 0 = production (Boundless), 1 = dev mode
boundless:
rpc_url: 'https://sepolia.infura.io/v3/YOUR_KEY' # RPC endpoint
private_key: 'YOUR_PRIVATE_KEY' # Wallet with funds for proving
pinata_jwt: 'YOUR_PINATA_JWT' # Required for uploading programs to IPFS
program_url: 'https://gateway.pinata.cloud/ipfs/YOUR_CID' # Pre-uploaded program URL
onchain: true # true = onchain requests, false = offchainNote: For production proving with Boundless, you need:
- An RPC endpoint (e.g., Infura, Alchemy) with funds
- A private key with sufficient ETH/tokens for proof generation
- A Pinata JWT for uploading programs to IPFS (get one at pinata.cloud (opens in a new tab))
- Pre-uploaded program URL to avoid uploading the ~40MB program at runtime
Uploading Your Program to IPFS
When you make changes to the guest program in program/, you need to upload it to IPFS to get a
program URL:
-
First, configure your Pinata JWT in
enclave.config.yaml(as shown above) -
Build and upload your program:
# This compiles the guest program and uploads it to IPFS via Pinata enclave program upload -
The command will output an IPFS hash like
QmXxx.... Update yourenclave.config.yamlwith the full URL:program_url: 'https://gateway.pinata.cloud/ipfs/QmXxx...'
Important: Every time you modify the guest program code in
program/, you must rebuild and re-upload it to IPFS, then update theprogram_urlin your configuration. This ensures Boundless uses your latest program version.
Environment Variables
The pnpm dev:setup command automatically creates .env files for the server and client from the
.env.example templates. The server's .env file is automatically populated with contract
addresses after deployment.
Running Individual Components
While pnpm dev:up runs everything together, you can also run components separately:
# Start only the Hardhat node
cd packages/crisp-contracts && pnpm hardhat node
# Start only the ciphernodes (requires Hardhat running)
./scripts/dev_cipher.sh
# Start only the program server (requires ciphernodes)
./scripts/dev_program.sh
# Start only the coordination server (requires program server)
./scripts/dev_server.sh
# Start only the client (requires coordination server)
./scripts/dev_client.sh
# Run the CLI (requires all services)
pnpm cliNext Steps
Once you have completed the setup, you can proceed to Running an E3 Program to learn how to interact with CRISP and run voting rounds.