Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/pages/CRISP/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ coercion. CRISP mitigates these risks through:
## Project Structure

CRISP, whose implementation is available in the
[Interfold repository](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP), follows a
[Interfold repository](https://github.com/theinterfold/interfold/tree/main/examples/CRISP), follows a
modern structure with clear separation of concerns:

```
Expand All @@ -49,7 +49,7 @@ CRISP/

### Client Application

The [client](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP/client) is a React
The [client](https://github.com/theinterfold/interfold/tree/main/examples/CRISP/client) is a React
application built with TypeScript that provides the user a voting interface. It uses the CRISP
[SDK](/CRISP/introduction#javascript-sdk) and [server](/CRISP/introduction#coordination-server)
endpoints to deliver the following capabilities:
Expand All @@ -61,7 +61,7 @@ endpoints to deliver the following capabilities:

### Coordination Server

The [server](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP/server) is a
The [server](https://github.com/theinterfold/interfold/tree/main/examples/CRISP/server) is a
Rust-based coordination service that manages the E3 lifecycle and drives the same SDK from a
privileged wallet. It acts as a relayer and facilitator, handling blockchain interactions on behalf
of clients. However, clients can bypass the server entirely and interact directly with the
Expand All @@ -77,7 +77,7 @@ The server's key responsibilities include:

### FHE Program

The [FHE program](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP/program) is a
The [FHE program](https://github.com/theinterfold/interfold/tree/main/examples/CRISP/program) is a
Rust guest program that runs inside the RISC Zero zkVM to perform homomorphic addition on encrypted
votes (BFV ciphertexts). It computes the encrypted tally without decrypting individual votes,
ensuring voter privacy throughout the process.
Expand All @@ -89,21 +89,21 @@ tally results.

### Zero-knowledge Circuits

[Noir circuits](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP/circuits) provide
[Noir circuits](https://github.com/theinterfold/interfold/tree/main/examples/CRISP/circuits) provide
zero-knowledge proofs for vote validation before votes are accepted into the system. These circuits
verify that votes are correctly encrypted using BFV fully homomorphic encryption under a valid
public key, check that the voter's address is included in the eligibility Merkle tree, and ensure
votes conform to the expected structure and values. The circuits also support mask votes, allowing
anyone to submit zero votes to mask slot activity and reduce the risk of collusion and coercion.

For detailed documentation on how the circuit works, see the
[main circuit implementation](https://github.com/gnosisguild/interfold/blob/main/examples/CRISP/circuits/src/main.nr).
[main circuit implementation](https://github.com/theinterfold/interfold/blob/main/examples/CRISP/circuits/src/main.nr).

### Smart Contracts

The CRISP smart contracts implement the E3 program interface and handle the on-chain logic for
voting rounds. The main contract is
[CRISPProgram.sol](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol),
[CRISPProgram.sol](https://github.com/theinterfold/interfold/tree/main/examples/CRISP/packages/crisp-contracts/contracts/CRISPProgram.sol),
which orchestrates the entire voting process.

When a new voting round is initialized, the `validate()` function sets up round parameters and
Expand All @@ -119,15 +119,15 @@ corresponds to the correct input Merkle root, parameters hash, and ciphertext ou
`decodeTally()` decodes the encrypted results into readable yes and no vote counts.

The
[CRISPVerifier.sol](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP/packages/crisp-contracts/contracts/CRISPVerifier.sol)
[CRISPVerifier.sol](https://github.com/theinterfold/interfold/tree/main/examples/CRISP/packages/crisp-contracts/contracts/CRISPVerifier.sol)
contract is a Honk verifier generated from compiled Noir circuits that verifies zero-knowledge
proofs demonstrating votes are correctly encrypted using BFV fully homomorphic encryption under the
valid public key.

### JavaScript SDK

The
[CRISP SDK](https://github.com/gnosisguild/interfold/tree/main/examples/CRISP/packages/crisp-sdk) is
[CRISP SDK](https://github.com/theinterfold/interfold/tree/main/examples/CRISP/packages/crisp-sdk) is
a TypeScript library that abstracts away the complex cryptographic operations required for vote
submission and proof generation. It fetches round details from the coordination server, queries
token balances at snapshot blocks to verify eligibility, and generates Merkle proofs demonstrating
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/CRISP/running-e3.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Running an E3 Program
description: ''
description:
'Run a complete CRISP voting round — request an E3, submit votes, and verify election results'
---

import { Steps } from 'nextra/components'
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/CRISP/setup.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: 'Setup - CRISP'
description: ''
description:
'Install dependencies, configure your environment, and start the full CRISP stack locally'
---

import { Steps } from 'nextra/components'
Expand Down
10 changes: 3 additions & 7 deletions docs/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"index": {
"display": "hidden",
"title": "Home"
},
"-- Overview": {
"type": "separator",
"title": "Overview"
Expand Down Expand Up @@ -38,6 +34,9 @@
"type": "separator",
"title": "Getting Started"
},
"requirements": {
"title": "System Requirements"
},
"installation": {
"title": "Installation"
},
Expand Down Expand Up @@ -96,9 +95,6 @@
"ciphernode-operators": {
"title": "Ciphernode Operators"
},
"build-e3": {
"display": "hidden"
},
"-- Examples": {
"type": "separator",
"title": "Examples"
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/architecture-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ As a developer, you'll interact with:
For how DKG, threshold BFV, and ZK circuits (**C0–C7**) fit the protocol story, see
[Cryptography](/cryptography). For the `circuits/` tree, scripts, and toolchain, see
[Noir Circuits](/noir-circuits) and the repo’s
[`circuits/README.md`](https://github.com/gnosisguild/interfold/blob/main/circuits/README.md).
[`circuits/README.md`](https://github.com/theinterfold/interfold/blob/main/circuits/README.md).
4 changes: 2 additions & 2 deletions docs/pages/best-practices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Interfold.
fees.
- **Timing Windows**: Ensure `startWindow` leaves enough time for committee selection (a few blocks)
and `duration` matches the longest credible compute time plus buffer.
- **Custom Params**: Use `customParams` in `E3RequestParams` to tag jurisdiction, use case, or
feature toggles without redeploying contracts.
- **Custom Params**: Use `customParams` in the E3 request to tag jurisdiction, use case, or feature
toggles without redeploying contracts.

## Input Validation

Expand Down
33 changes: 23 additions & 10 deletions docs/pages/building-with-interfold.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ Each computation is tracked by an `E3` struct:
```solidity
struct E3 {
uint256 seed; // Random seed for committee selection
uint32[2] threshold; // [M, N] - M required out of N members
CommitteeSize committeeSize; // Committee size enum (Minimum, Micro, Small)
uint256 requestBlock; // Block when E3 was requested
uint256[2] inputWindow; // [start, end] timestamps for input acceptance
bytes32 encryptionSchemeId; // Encryption scheme identifier
IE3Program e3Program; // E3 Program contract address
bytes e3ProgramParams; // ABI-encoded program params
uint8 paramSet; // BFV encryption parameter set index
bytes customParams; // Arbitrary application-defined params
IDecryptionVerifier decryptionVerifier; // Verifier for decryption proofs
IPkVerifier pkVerifier; // Verifier for public key publication proofs
bytes32 committeePublicKey; // Hash of committee's shared public key
bytes32 ciphertextOutput; // Hash of encrypted output
bytes plaintextOutput; // Decrypted final result
Expand Down Expand Up @@ -103,7 +104,14 @@ function getE3(uint256 e3Id) external view returns (E3 memory e3);
function getE3Stage(uint256 e3Id) external view returns (E3Stage stage);

// Estimate the fee for an E3 request
function getE3Quote(E3RequestParams calldata params) external view returns (uint256 fee);
function getE3Quote(
CommitteeSize committeeSize,
uint256[2] calldata inputWindow,
IE3Program e3Program,
uint8 paramSet,
bytes calldata computeProviderParams,
bytes calldata customParams
) external view returns (uint256 fee);

// Get the decryption verifier for an encryption scheme
function getDecryptionVerifier(
Expand All @@ -127,21 +135,26 @@ function getTimeoutConfig() external view returns (E3TimeoutConfig memory config

### Request Flow

1. Users submit `E3RequestParams` containing thresholds, timing windows, program references, and
optional custom params.
1. Users submit the request parameters: committee size, timing windows, program references, BFV
parameter set, and optional custom params.

```solidity
function request(
E3RequestParams calldata requestParams
) external returns (uint256 e3Id, E3 memory e3);
CommitteeSize committeeSize,
uint256[2] calldata inputWindow,
IE3Program e3Program,
uint8 paramSet,
bytes calldata computeProviderParams,
bytes calldata customParams
) external returns (uint256 e3Id);
```

2. Contract validates the struct, estimates the fee, and stores an `E3` record seeded with a random
value derived from block entropy.
2. Contract validates the parameters, estimates the fee, and stores an `E3` record seeded with a
random value derived from block entropy.
3. The E3 program's `validate` hook returns the encryption scheme ID, which is persisted on the `E3`
struct.
4. Committee selection is delegated to the `ciphernodeRegistry` via `requestCommittee`.
5. `E3Requested(e3Id, requester, e3ProgramAddress)` is emitted for off-chain watchers.
5. `E3Requested(e3Id, e3, e3ProgramAddress)` is emitted for off-chain watchers.

## Committee and Ciphernode Management

Expand Down
14 changes: 7 additions & 7 deletions docs/pages/ciphernode-operators/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ stateDiagram-v2

Before operating a ciphernode, ensure you have:

| Requirement | Details |
| --------------- | ------------------------------------------------------------------------ |
| **FOLD Tokens** | At least `100 FOLD` for the license bond (check `licenseRequiredBond()`) |
| **Stablecoin** | USDC (or configured fee token) for tickets; minimum 1 ticket worth |
| **ETH** | Gas for transactions on your target network |
| **Hardware** | Linux/macOS, 4+ cores, 16GB+ RAM, stable internet with open UDP port |
| **Software** | Interfold CLI installed, WebSocket RPC endpoint |
| Requirement | Details |
| --------------- | ------------------------------------------------------------------------------------------ |
| **FOLD Tokens** | At least `100 FOLD` for the license bond (check `licenseRequiredBond()`) |
| **Stablecoin** | USDC (or configured fee token) for tickets; minimum 1 ticket worth |
| **ETH** | Gas for transactions on your target network |
| **Hardware** | Linux/macOS, 8+ cores, 32GB+ DDR5 RAM, 500GB+ NVMe SSD, stable internet with open UDP port |
| **Software** | Interfold CLI installed, WebSocket RPC endpoint |

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/ciphernode-operators/running.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The Interfold CLI provides the most control and is recommended for production de

```bash
# Quick install
curl -fsSL https://raw.githubusercontent.com/gnosisguild/interfold/main/install | bash
curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash

# Then install the CLI
interfoldup install
Expand Down
37 changes: 19 additions & 18 deletions docs/pages/computation-flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,21 @@ server, Compute Providers, or other network participants.
2. **Choose a Compute Provider**: Your program must align with the execution backend (e.g.,
[RISC Zero](https://www.risczero.com/) for [CRISP](/CRISP/introduction) or a custom FHE
coprocessor).
3. **Assemble `E3RequestParams`**:
- `threshold`: the CiCo size/threshold tuple (m/n) used for decryption security
3. **Assemble request parameters**:
- `committeeSize`: the committee size enum (`Minimum`, `Micro`, or `Small`)
- `inputWindow`: a two-element array `[start, end]` defining when inputs open and close
- `e3Program`, `e3ProgramParams`, `computeProviderParams`, and optional `customParams`
4. **Submit the Request**: Call `request` with the struct to publish the new computation.
- `e3Program`, `computeProviderParams`, and optional `customParams`
4. **Submit the Request**: Call `request` to publish the new computation.

```solidity
function request(
E3RequestParams calldata requestParams
) external returns (uint256 e3Id, E3 memory e3);
```

```solidity
struct E3RequestParams {
uint32[2] threshold;
uint256[2] inputWindow;
IE3Program e3Program;
bytes e3ProgramParams;
bytes computeProviderParams;
bytes customParams;
}
CommitteeSize committeeSize,
uint256[2] calldata inputWindow,
IE3Program e3Program,
uint8 paramSet,
bytes calldata computeProviderParams,
bytes calldata customParams
) external returns (uint256 e3Id);
```

The contract validates the parameters, transfers the required fee from the requester, creates an
Expand All @@ -48,7 +42,14 @@ server, Compute Providers, or other network participants.
You can estimate the fee before submitting by calling `getE3Quote`:

```solidity
function getE3Quote(E3RequestParams calldata requestParams) external view returns (uint256 fee);
function getE3Quote(
CommitteeSize committeeSize,
uint256[2] calldata inputWindow,
IE3Program e3Program,
uint8 paramSet,
bytes calldata computeProviderParams,
bytes calldata customParams
) external view returns (uint256 fee);
```

### Phase 2: Node Selection
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/compute-provider.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Compute Provider Setup'
description: ''
description: 'Choose and configure a compute provider (RISC Zero, SP1, Jolt) for your E3 program'
---

# Compute Provider (CP)
Expand Down Expand Up @@ -46,7 +46,7 @@ Select a CP that suits your needs. Options include:
- **Language Support**: Choose a CP that supports the programming languages you're comfortable with.

The Interfold provides a
[Compute Provider package](https://github.com/gnosisguild/interfold/tree/main/crates/compute-provider)
[Compute Provider package](https://github.com/theinterfold/interfold/tree/main/crates/compute-provider)
to simplify the integration, letting you focus on computation logic. More details can be found in
the [Writing the Secure Process](./write-secure-program.mdx) guide.

Expand Down
Loading
Loading