### Quick Start Commands Source: https://docs.theinterfold.com/CRISP/setup Commands to install dependencies, build the project, and start all required services including Hardhat, contracts, and servers. ```bash # Install dependencies and build everything pnpm dev:setup # Start all services (Hardhat, contracts, ciphernodes, program server, coordination server, and UI) pnpm dev:up ``` -------------------------------- ### Compile circuits for CRISP example Source: https://docs.theinterfold.com/noir-circuits Example entrypoint script for compiling circuits in the CRISP project. ```bash cd examples/CRISP ./scripts/compile_circuits.sh ``` -------------------------------- ### Start Node Source: https://docs.theinterfold.com/ciphernode-operators/running Commands to start the node in the foreground or manage multiple nodes using the supervisor. ```bash # Start in foreground with verbose logging interfold start -v # Or use the node supervisor for multiple nodes interfold nodes up --detach interfold nodes ps # Check status interfold nodes logs cn1 # View logs interfold nodes down # Stop all nodes ``` -------------------------------- ### Install rzup Source: https://docs.theinterfold.com/compute-provider Installs rzup, the RISC Zero toolchain installer. Follow the instructions provided by the installer. ```bash curl -L https://risczero.com/install | bash ``` -------------------------------- ### Start the development environment with pnpm dev:all Source: https://docs.theinterfold.com/quick-start Launches all local services: Hardhat Ethereum network, smart contract deployment, ciphernodes, coordination server, FHE program server, and frontend client. Wait 30-60 seconds for all services to start. ```bash pnpm dev:all ``` -------------------------------- ### Install and configure nargo toolchain Source: https://docs.theinterfold.com/noir-circuits Use the noirup script to install the Noir version manager, set the path, and install the pinned compiler version. ```bash curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash export PATH="$PATH:$HOME/.nargo/bin" # installer writes this to your shell profile, not this shell noirup -v v1.0.0-beta.26 # NOIR_TOOLCHAIN in .github/workflows/ci.yml nargo --version ``` -------------------------------- ### Verify Interfold installation Source: https://docs.theinterfold.com/installation Run the help command to confirm the CLI is installed and working. ```bash interfold --help ``` -------------------------------- ### Install RISC Zero toolchain with rzup Source: https://docs.theinterfold.com/compute-provider Runs rzup to install the RISC Zero toolchain. Execute after installing rzup. ```bash rzup ``` -------------------------------- ### Install SDK and React packages Source: https://docs.theinterfold.com/sdk Install the TypeScript SDK and optional React hooks using pnpm. ```shell pnpm add @interfold/sdk # TypeScript SDK pnpm add @interfold/react # React hooks (optional) ``` -------------------------------- ### Install Interfold CLI via wget Source: https://docs.theinterfold.com/installation Use the wget installer script to download and install interfoldup. ```bash wget -qO- https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash ``` -------------------------------- ### Install Rust and Foundry Source: https://docs.theinterfold.com/compute-provider Installs Rust and Foundry, prerequisites for setting up RISC Zero with Boundless. Run these commands in a terminal and follow any prompts. ```bash # Install Rust curl https://sh.rustup.rs -sSf | sh # Install Foundry curl -L https://foundry.paradigm.xyz | bash ``` -------------------------------- ### Install Interfold CLI Source: https://docs.theinterfold.com/ciphernode-operators/running Use these commands to download and install the Interfold CLI tool. ```bash # Quick install curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash # Then install the CLI interfoldup install ``` -------------------------------- ### Install React Hook Helpers Source: https://docs.theinterfold.com/setting-up-server Install the Interfold SDK and React hook helpers for React applications. ```bash pnpm add @interfold/sdk @interfold/react ``` -------------------------------- ### Run the Ciphernode container Source: https://docs.theinterfold.com/ciphernode-operators/running Start the container with the required volume mounts for configuration, secrets, and persistent data. ```bash docker run -d \ --name ciphernode \ --restart unless-stopped \ --stop-timeout 300 \ -v $(pwd)/config.yaml:/home/ciphernode/.config/interfold/config.yaml:ro \ -v $(pwd)/secrets.json:/run/secrets/secrets.json:ro \ -v ciphernode-data:/home/ciphernode/.local/share/interfold \ -p 9091:9091/udp \ "$CIPHERNODE_IMAGE" ``` -------------------------------- ### Build Interfold binary from source Source: https://docs.theinterfold.com/installation Use cargo to build and install the binary from the local source. ```bash cargo install --locked --path ./crates/cli --bin interfold -f ``` -------------------------------- ### Server Logs for E3 Computation Source: https://docs.theinterfold.com/CRISP/running-e3 Example server logs showing vote submission, computation start and completion, and ciphertext publishing. ```text [2024-10-22 11:59:12] [handlers.rs:95] - Vote Count: 1 [2024-10-22 11:59:12] [handlers.rs:101] - Starting computation for E3: 0 Prove function execution time: 2 minutes and 37 seconds [2024-10-22 12:01:49] [handlers.rs:109] - Computation completed for E3: 0 [2024-10-22 12:01:49] [handlers.rs:110] - RISC0 Output: Risc0Output { result: ComputeResult } ... [2024-10-22 12:01:49] [handlers.rs:111] - Publishing ciphertext... ``` -------------------------------- ### Set Up Credentials Source: https://docs.theinterfold.com/ciphernode-operators/running Configure your encryption password, network keypair, and wallet private key for node operations. ```bash # Set encryption password (encrypts local keystore) interfold password set # Generate or set network keypair (for libp2p) interfold net keypair generate # Or import an existing key: # interfold net keypair set --net-keypair 0x... # Set your wallet private key (for on-chain transactions) interfold wallet set --private-key 0xYourPrivateKey ``` -------------------------------- ### Install Interfold CLI via curl Source: https://docs.theinterfold.com/installation Use the curl installer script to download and install interfoldup. ```bash curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash ``` -------------------------------- ### Initialize SDK with viem clients Source: https://docs.theinterfold.com/sdk Sets up the InterfoldSDK using viem public and wallet clients for the Sepolia chain. Pass contract addresses from environment variables and set thresholdBfvParamsPresetName to match the target E3's parameters. ```typescript import { InterfoldSDK, InterfoldEventType, RegistryEventType } from '@interfold/sdk' import { createPublicClient, createWalletClient, http, custom } from 'viem' import { sepolia } from 'viem/chains' const publicClient = createPublicClient({ chain: sepolia, transport: http(import.meta.env.VITE_RPC_URL), }) const walletClient = createWalletClient({ chain: sepolia, transport: custom(window.ethereum), }) const sdk = new InterfoldSDK({ publicClient, walletClient, contracts: { interfold: import.meta.env.VITE_INTERFOLD_ADDRESS, ciphernodeRegistry: import.meta.env.VITE_REGISTRY_ADDRESS, feeToken: import.meta.env.VITE_FEE_TOKEN_ADDRESS, }, chain: sepolia, // Match the parameter set selected by the target E3. thresholdBfvParamsPresetName: 'INSECURE_THRESHOLD_512', }) ``` -------------------------------- ### Initialize Configuration Source: https://docs.theinterfold.com/ciphernode-operators/running Run this command to generate the initial configuration file at ~/.config/interfold/interfold.config.yaml. ```bash interfold ciphernode setup ``` -------------------------------- ### Start the coordination server Source: https://docs.theinterfold.com/tutorials/deploy-to-testnet Runs the development server with pnpm. The server connects to Sepolia via WebSocket and listens for E3 events. ```bash pnpm dev:server ``` -------------------------------- ### Install TypeScript SDK Source: https://docs.theinterfold.com/setting-up-server Install the Interfold SDK for TypeScript/JavaScript applications using pnpm. ```bash pnpm add @interfold/sdk ``` -------------------------------- ### Launch CRISP CLI Source: https://docs.theinterfold.com/CRISP/running-e3 Launches the CRISP CLI from the example root. Use this to access the interactive menu for initializing a new E3 round. ```bash pnpm cli ``` -------------------------------- ### Verify RISC Zero installation Source: https://docs.theinterfold.com/compute-provider Verifies that the RISC Zero toolchain was installed successfully by checking the version. ```bash cargo risczero --version ``` -------------------------------- ### Initialize a new E3 project with interfold init Source: https://docs.theinterfold.com/hello-world-tutorial Creates a new E3 project named 'hello-world-e3' and navigates into it. Requires the Interfold CLI to be installed. ```bash interfold init hello-world-e3 cd hello-world-e3 ``` -------------------------------- ### Install Interfold CLI using interfoldup Source: https://docs.theinterfold.com/installation Install the latest version of the Interfold CLI to the default directory or system-wide. ```bash # Install to ~/.local/bin (default) interfoldup install # Install to /usr/local/bin (requires sudo) interfoldup install --system ``` -------------------------------- ### Example output for unregistered operator Source: https://docs.theinterfold.com/ciphernode-operators/registration Example output from the status command when the operator is not yet registered. It shows the operator key, bond owner as 'not configured', and registration/active flags as false. ```text Ciphernode status on mainnet: Operator key: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 Bond owner: not configured Registered: false Active: false Exit pending: false Ticket balance: 0 (0 available) Ciphernode bond: 0 Pending exits: tickets=0, bond=0 Requirements: minTickets=1, ticketPrice=1000 tFOLD, ciphernodeBond=32000 FOLD ``` -------------------------------- ### Configure .env for Sepolia Source: https://docs.theinterfold.com/tutorials/deploy-to-testnet Set the RPC URLs, private key, chain ID, and existing contract addresses in your .env file. ```bash # Sepolia RPC (WebSocket required for event listening) WS_RPC_URL=wss://eth-sepolia.g.alchemy.com/v2/YOUR_KEY HTTP_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY # Deployer private key (has Sepolia ETH) PRIVATE_KEY=0x... # Chain CHAIN_ID=11155111 # Deployed Interfold contract addresses (Sepolia) INTERFOLD_ADDRESS=0x3E856E24c7a95d0e04d387f847DA6FA9f6F6c20C CIPHERNODE_REGISTRY_ADDRESS=0x374F4542eC634d5437Dd65020781A9D9Df9c2AB8 FEE_TOKEN_ADDRESS=0xC35B783cA97710be47Fc81D10dADc895EfcD865c ``` -------------------------------- ### Fetching historical and live randomness provider events Source: https://docs.theinterfold.com/sdk To join history to a live watcher without overlap, read through a fixed head and start the watcher at the next block. The SDK rejects a conflicting explicit start block instead of silently dropping it. ```typescript const historicalHead = await sdk.getPublicClient().getBlockNumber({ cacheTime: 0 }) const logs = await sdk.getHistoricalRandomnessProviderEvents( provider, RandomnessProviderEventType.RANDOMNESS_FULFILLED, providerDeployBlock, historicalHead, ) await sdk.onRandomnessProviderEvent( provider, RandomnessProviderEventType.RANDOMNESS_FULFILLED, handleFulfillment, historicalHead + 1n, ) ```