Getting Started

Build privacy-preserving smart contracts using Fully Homomorphic Encryption.

What is FHEVM?

FHEVM (Fully Homomorphic Encryption Virtual Machine) enables computations on encrypted data without decrypting it. This means smart contracts can process sensitive information (balances, votes, bids) while keeping the actual values hidden from everyone - including validators and node operators.

Key benefits:

  • Private state variables that remain encrypted on-chain

  • Confidential transactions without revealing amounts

  • Sealed-bid auctions where bids stay hidden until reveal

  • Private voting where individual votes are never exposed

Prerequisites

  • Node.js 18.0 or higher

  • npm 9.0 or higher

Verify your installation:

node --version  # Should be v18.x or higher
npm --version   # Should be 9.x or higher

Quick Start

No installation required. Select a template and start building.

Or specify directly:

Project Structure

After running create-labz, you get:

Running Tests

Tests run on a local FHEVM mock environment. You'll see encrypted operations being performed and verified.

Deployment

Deploy to Zama devnet:

For other networks, configure them in hardhat.config.ts.

Templates

Category
Examples

Basics

Counter, Add, Multiply, Bitwise, Boolean

Encryption

Single value, Multiple values

Decryption

User decrypt, Public decrypt

Access Control

FHE.allow, FHE.allowThis, FHE.allowTransient

Input Proofs

Proof validation patterns

Anti-Patterns

Common mistakes to avoid

Handles

Handle lifecycle, Symbolic execution

OpenZeppelin

ERC7984, Wrappers, Vesting, AMM

Advanced

Auction, Voting, Lottery, Poker, Dark Pool

Difficulty Levels

  • Beginner - Simple concepts, minimal code

  • Intermediate - Multiple FHE operations combined

  • Advanced - Complex patterns with decryption flows

Resources

Last updated