๐Ÿ”Create FHEVM Example CLI

The fastest way to bootstrap privacy-preserving dApps on FHEVM


โšก Quick Start

Get started in under 30 seconds with our interactive wizard:

npx create-fhevm-example
๐ŸŽฌ Watch the CLI in action โ€” scaffold a project in seconds!

๐ŸŽฏ What You Get

โšก Zero Configuration

Pre-configured hardhat.config.ts, FHE keys, network settings, and environment variables. Just run and build.

๐Ÿ“š 33+ Ready Examples

From "Hello World" counters to advanced blind auctions and confidential tokens. Each with full test coverage.

๐Ÿ”Œ Plug & Play

Create new projects OR inject FHE capabilities into your existing Hardhat projects with --add mode.


๐ŸŽฎ Three Powerful Modes

Choose the workflow that fits your needs:

1๏ธโƒฃ Single Example Mode

Perfect for: Learning a specific FHE concept step-by-step.

๐Ÿ“‹ What gets created?

A minimal, focused project with just one example:


2๏ธโƒฃ Category Bundle Mode

Perfect for: Exploring a domain like Gaming, OpenZeppelin, or Advanced patterns.

Available Categories:

Category
Examples
Description

๐ŸŽ“ Basic

11

Fundamentals: counters, encryption, decryption

๐Ÿ’ก Concepts

8

Access control, handles, input proofs, edge cases, anti-patterns

๐ŸŽฎ Gaming

4

Poker, lottery, rock-paper-scissors, blackjack

๐Ÿ›๏ธ OpenZeppelin

5

ERC7984, wrappers, swaps, vesting

๐ŸŽฏ Advanced

6

Blind auction, escrow, voting, KYC, payroll, order book


3๏ธโƒฃ Smart Injection Mode (--add)

Already have a project? Upgrade it to FHE in one command:

What happens:

  1. โœ… Detects your Hardhat configuration

  2. โœ… Adds @fhevm/solidity and @fhevm/hardhat-plugin

  3. โœ… Updates hardhat.config.ts with FHE imports

  4. โœ… Injects a sample contract and test of your choice

๐Ÿ”ง Adding FHE to an existing Hardhat project

โŒจ๏ธ CLI Options

Option
Description

--example <name>

Create a single example project

--category <name>

Create a category project

--add

Add FHEVM to existing Hardhat project

--target <dir>

Target directory for --add mode

--output <dir>

Output directory

--help

Show help message


๐Ÿ—๏ธ Project Structure

Every scaffolded project follows this clean, minimal structure:


๐ŸŽฌ Next Steps

After scaffolding, get your project running:

1

Install Dependencies

2

Compile Contracts

3

Run Tests

4

Start Building! ๐Ÿš€

Open contracts/ and start writing your privacy-preserving logic!


โ“ Frequently Asked Questions

Does this work with existing Hardhat projects?

Yes! Use the --add flag inside your project directory. The CLI will detect your Hardhat setup and inject FHE dependencies automatically.

Do I need to install anything globally?

No! Just use npx (comes with Node.js). The CLI runs directly without any global installation.

What Node.js version is required?

Node.js v20.0.0 or higher is required. We recommend using the latest LTS version.

Can I use this offline?

Yes! All example files are bundled in the package. Scaffolding works fully offline โ€” only npm install requires internet to download dependencies.

How do I run tests after scaffolding?

Simply run these commands in your new project:

What networks are supported?

Projects are pre-configured for:

  • Local (Hardhat Network with FHEVM mock)

  • Zama Devnet (Sepolia-based testnet)

You can add more networks in hardhat.config.ts.


๐Ÿ“š Learn More

๐Ÿ“– FHEVM Documentation

Deep dive into Fully Homomorphic Encryption on the blockchain. docs.zama.org/protocol/

๐Ÿ’ป GitHub Repository

Star us, report issues, or contribute! github.com/NecipAkgz/fhevm-example-factory

Need Help? Join the Zama Discord community for support and discussions!

Last updated