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
13 changes: 9 additions & 4 deletions docs/pages/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ description: 'Get up and running with your first E3 program'

# Quick Start

Get your first E3 program running on the Enclave Protocol! This guide assumes you have the [Enclave CLI installed](/installation).
Get your first E3 program running on the Enclave Protocol! This guide assumes you have the
[Enclave CLI installed](/installation).

## Prerequisites Check

Make sure you have the required software installed:

```bash
# Check versions
docker --version # Should be 25.0.6+
node --version # Should be 22.10.0+
pnpm --version # Should be 10.7.1+
rustc --version # Should be 1.86.0+
Expand All @@ -30,6 +30,7 @@ cd my-first-e3
```

This creates a complete E3 project with:

- **FHE computation logic** (`./program/`)
- **Smart contracts** (`./contracts/`)
- **Client application** (`./client/`)
Expand All @@ -44,7 +45,8 @@ First, compile your E3 program to build the Risc0 zkvm image:
enclave program compile
```

This builds the Risc0 zkvm image that will be deployed on the blockchain and used for verification of the final proof.
This builds the Risc0 zkvm image that will be deployed on the blockchain and used for verification
of the final proof.

## 3. Start the Development Environment

Expand All @@ -55,6 +57,7 @@ pnpm dev:all
```

This starts:

- Local Ethereum network (Hardhat)
- Deploys all the smart contracts to the local network
- Multiple ciphernodes for FHE processing
Expand All @@ -81,6 +84,7 @@ The default template includes a simple addition program that:
4. **Decrypts** and displays the result

Try it:

- Input two numbers in the web interface
- Click "Submit"
- Watch the encrypted computation happen!
Expand All @@ -103,4 +107,5 @@ Now that you have a working E3 program:
3. **Update the UI**: Customize the client in `./client/src/`
4. **Deploy**: Learn about production deployment

Ready to dive deeper? Continue with our [Hello World Tutorial](/hello-world-tutorial) for a step-by-step breakdown of building E3 programs from scratch.
Ready to dive deeper? Continue with our [Hello World Tutorial](/hello-world-tutorial) for a
step-by-step breakdown of building E3 programs from scratch.
196 changes: 113 additions & 83 deletions templates/default/README.md
Original file line number Diff line number Diff line change
@@ -1,144 +1,174 @@
# Enclave Protocol Template Setup
# Template

The Enclave Protocol Template provides a complete development environment for building and testing applications with Fully Homomorphic Encryption (FHE). This template enables local deployment and interaction with the Enclave protocol without requiring the core contracts to be copied.
The Enclave Protocol Template provides a complete development environment for building and testing applications with Fully Homomorphic Encryption (FHE). This template enables local deployment and interaction with the Enclave protocol without requiring the core contracts to be copied and avoiding complexities of specific programs (as zk circuits for CRISP).

## Prerequisites

Before getting started, ensure your development environment meets the following requirements:
Before getting started, ensure you have installed:

### Required Software
- [Rust](https://rust-lang.org/tools/install/)
- [NodeJS](https://nodejs.org/en/download)
- [RiscZero](https://dev.risczero.com/api/zkvm/install)
- [pnpm](https://pnpm.io)
- [Metamask](https://metamask.io)

**Docker** (tested with version 25.0.6 or later)
As system requirements:

```bash
docker --version
# Expected output: Docker version 25.0.6, build v25.0.6
```
- Linux/POSIX environment
- For Nix users: A Nix flake is included in the generated template

**Node.js** (version 22.10.0 or later)
## Quick Start

```bash
node --version
# Expected output: v22.10.0
```
### (optional) Install RISC Zero Toolchain

**pnpm** (version 10.7.1 or later)
Next, install `rzup` for the `cargo-risczero` toolchain.

```bash
pnpm --version
# Expected output: 10.7.1
```sh
# Install rzup
curl -L https://risczero.com/install | bash

# Install RISC Zero toolchain
rzup install cargo-risczero
```

**Rust** (version 1.86.0 or later)
Verify the installation was successful by running:

```bash
rustc --version
# Expected output: rustc 1.86.0 (05f9846f8 2025-03-31)
```sh
cargo risczero --version
```

### Optional Software
At this point, you should have all the tools required to develop and deploy an application with
[RISC Zero](https://www.risczero.com).

**tmux** (recommended for managing multiple processes)
### Install Metamask

```bash
tmux -V
# Expected output: tmux 3.4
```
You can add Metamask as an extension to your browser following the official
[documentation](https://metamask.io).

### System Requirements
### Install the Enclave CLI

- Linux/POSIX environment
- For Nix users: A Nix flake is included in the generated template
The easiest way to install the Enclave CLI is using our installer script:
`curl -fsSL https://raw.githubusercontent.com/gnosisguild/enclave/main/install | bash`

## Installation
Or if you prefer wget:
`wget -qO- https://raw.githubusercontent.com/gnosisguild/enclave/main/install | bash`

### 1. Install the Enclave CLI
This script will download and install enclaveup, which is the standalone installer for the Enclave CLI.

Install the Enclave CLI tool from the official repository:
Once you have `enclaveup` installed, you can manage your Enclave CLI installation:

```bash
cargo install --git https://github.com/gnosisguild/enclave --branch main e3-cli
# Install to ~/.local/bin (default)
enclaveup install

# Install to /usr/local/bin (requires sudo)
enclaveup install --system
```

### 2. Install wasm-pack
Running `enclaveup install` will install the latest version of the Enclave CLI.

Install wasm-pack for WebAssembly compilation:
After installation, verify that the Enclave CLI is working correctly:

```bash
cargo install wasm-pack
```
`enclave --help`

## Project Setup
You should see the help information for the Enclave CLI.

### Generate a New Project
### Create your Project

Create a new Enclave project using the CLI:
Generate a new E3 program from the default template:

```bash
enclave init myenclave
cd ./myenclave
enclave init my-first-e3
cd my-first-e3
```

Replace `myenclave` with your desired project name.
This creates a complete E3 project with:

### Project Structure
- **FHE computation logic** (`./program/`)
- **Smart contracts** (`./contracts/`)
- **Client application** (`./client/`)
- **Coordination server** (`./server/`)
- **Configuration** (`enclave.config.yaml`)

The generated project contains the following directories and files:
### Compile your E3 Program

| File/Directory | Description |
| ----------------------- | -------------------------------------------------- |
| `./client` | Client-side application |
| `./contracts` | Your contracts that interact with the protocol |
| `./deploy` | Your deploy scripts |
| `./enclave.config.yaml` | Configuration for the enclave CLI |
| `./program` | FHE computation code |
| `./scripts` | Scripts to run the project |
| `./server` | TypeScript server that coordinates the FHE process |
First, compile your E3 program to build the Risc0 zkvm image:

## Running the Development Environment
```bash
enclave program compile
Comment thread
0xjei marked this conversation as resolved.
```

### Start All Services
This builds the Risc0 zkvm image that will be deployed on the blockchain and used for verification of the final proof.

Launch the complete development stack with a single command:
If you want to avoid the proof or you have trouble with Risc0 zkvm installation, you can run it in dev mode (no proof).

```bash
pnpm dev:all
enclave program start --dev true
```

or, if you have `tmux` installed:
### Start the Development Environment

Launch all services with one command:

```bash
pnpm dev:all --tmux
pnpm dev:all
```

### What Happens Next
This starts:

- Local Ethereum network (Hardhat)
- Deploys all the smart contracts to the local network
- Multiple ciphernodes for FHE processing
- TypeScript coordination server
- FHE program server
- Frontend client application

**Wait for all services to start** (usually 30-60 seconds).

### Access Your Application

1. Open your browser to [http://localhost:3000](http://localhost:3000)
2. Import the local development private key: `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` (DO NOT USE IN PRODUCTION)
3. Configure MetaMask for local network development:
Comment thread
0xjei marked this conversation as resolved.
- Network: `http://localhost:8545`
- Chain ID: `31337`
4. Switch to the network.
Comment thread
0xjei marked this conversation as resolved.

### Test the FHE Computation

The default template includes a simple addition program that:

1. **Encrypts** two numbers on the client
2. **Computes** their sum using FHE (without decrypting)
3. **Returns** the encrypted result
4. **Decrypts** and displays the result

Try it:

The command will start multiple processes simultaneously:
- Input two numbers in the web interface
- Click "Submit"
- Watch the encrypted computation happen!

1. **Hardhat EVM Node** - Local Ethereum development network
2. **Enclave Ciphernodes** - Set of nodes for FHE processing
3. **TypeScript Coordination Server** - Manages FHE process coordination
4. **FHE Program Server** - Handles encrypted computation execution
5. **Frontend Application** - User interface for interaction
### What Just Happened?

### Process Management
You successfully ran a **Fully Homomorphic Encryption** computation where:

- **With tmux installed**: Your terminal will split into multiple panes, each showing logs from different services
- **Without tmux**: You'll see a stream of logs from all processes in a single terminal
- Your inputs were encrypted before leaving the browser
- The computation happened on encrypted data
- The result was computed without exposing your private inputs
- All coordination was handled by the Enclave protocol

### Accessing the Application
## Manual Start

1. **Wait for initialization**: Allow all processes to fully start and stabilize
2. **Open your browser**: Navigate to [http://localhost:3000](http://localhost:3000)
3. **Configure MetaMask**: Ensure MetaMask is installed and configured with a local network pointing to `http://localhost:8545`
If you prefer to install the Enclave CLI manually, please visit the dedicated section in the [documentation](https://docs.enclave.gg/installation#manual-installation).

## Next Steps

Once your development environment is running, you can:
Now that you have a working E3 program:

- Modify the FHE computation logic in the `./program` directory
- Update smart contracts in the `./contracts` directory
- Customize the client application in the `./client` directory
- Configure deployment scripts in the `./deploy` directory
1. **Explore the code**: Check out `./program/src/lib.rs` to see the FHE computation
2. **Modify the computation**: Try changing the addition to multiplication
3. **Update the UI**: Customize the client in `./client/src/`
4. **Deploy**: Learn about production deployment

For detailed usage instructions and API documentation, refer to the project's README.md file and the official Enclave Protocol documentation.
Ready to dive deeper? Continue with our [Hello World Tutorial](https://docs.enclave.gg/hello-world-tutorial) for a step-by-step breakdown of building E3 programs from scratch.
Loading