Create a NextJS app with FHEVM SDK integration
npm install create-fhevm-nextjsA CLI to create a Next.js app with FHEVM SDK integration.
> ✨ Updated for FHEVM 0.9.1: This package now uses FHEVM 0.9.1 with the new self-relaying decryption pattern, decryptMultipleHandles support, ZamaEthereumConfig, FHE.checkSignatures, and updated contract addresses on Sepolia testnet.
``bash`
npx create-fhevm-nextjs my-app
cd my-app
npm install
npm run dev
Before deploying contracts, you need to set up your environment variables:
`bash`
cd hardhat
touch .env
`envYour wallet mnemonic (12 or 24 words)
MNEMONIC=your wallet mnemonic phrase here
$3
- Visit https://infura.io
- Sign up for a free account
- Create a new project
- Copy your project API key$3
`bash
Deploy to Sepolia testnet
npm run deploy:sepolia
`What you get
- Complete React application with FHEVM SDK integration
- Bundled FHEVM SDK (no external dependencies)
- Beautiful Zama-branded UI
- TypeScript support
- Tailwind CSS styling
- Working FHEVM operations (encryption, decryption, contract interactions)
- Three Complete FHE Contracts for testing on Sepolia testnet:
- FHECounter: Encrypted counter with increment/decrement
- ReviewCardsFHE: Encrypted rating system with public decryption
- SimpleVoting: Encrypted voting system with tally reveal
- Public decryption demo with hardcoded ciphertexts
- Ready-to-use React hooks
- Complete Hardhat development environment with:
- All three FHE smart contracts
- Deployment scripts for Sepolia testnet
- Contract testing utilities
- TypeScript support for contracts
- Universal FHEVM SDK (FHEVM 0.9.1) with utilities for:
- FHEVM initialization
- Encrypted inputs creation
- User decryption with EIP-712 signing
- Public decryption flows
-
decryptMultipleHandles for batch decryption with proofs
- Self-relaying decryption pattern for contract callbacksDeployed FHE Contracts (FHEVM 0.9.1)
The generated app includes pre-deployed FHE Contracts on Sepolia testnet for testing:
- FHECounter Contract:
0x7A14b454D19A4CB4c55E0386d04Eb0B66e6717EC (FHEVM 0.9.1)
- ReviewCardsFHE Contract: 0xf80A030984a0AB6111B6e60973A6c16C668ede7a (FHEVM 0.9.1)
- SimpleVoting Contract: 0x4189777Eb42f68Ce959E498a171e328BfDA90C46 (FHEVM 0.9.1)
- Network: Sepolia testnet (Chain ID: 11155111)
- Features:
- Get encrypted count from contract
- Increment/decrement with encrypted inputs
- User decryption with EIP-712 signing
- Public decryption with decryptMultipleHandles
- Self-relaying decryption pattern for voting talliesFeatures
- ✅ Self-contained: No need to install FHEVM SDK separately
- ✅ Cross-platform: Works on Windows, Mac, Linux
- ✅ Zero configuration: Works out of the box
- ✅ Production ready: Includes all necessary files and configurations
- ✅ Beautiful UI: Zama design system with Tailwind CSS
- ✅ Real FHEVM operations: Actual encryption/decryption functionality
- ✅ Live contract: Pre-deployed FHE counter for immediate testing
- ✅ Complete development environment: Includes Hardhat for smart contract development
Smart Contract Development
The generated app includes a complete Hardhat development environment with all necessary files for FHEVM smart contract development:
$3
`
hardhat/
├── contracts/
│ ├── FHECounter.sol # FHE Counter smart contract
│ ├── ReviewCardsFHE_uint32.sol # FHE Rating system contract
│ └── SimpleVoting_uint32.sol # FHE Voting system contract
├── deploy/
│ └── deploy.ts # Deployment script for all contracts
├── hardhat.config.js # Hardhat configuration (JavaScript)
├── package.json # Hardhat dependencies
└── tsconfig.json # TypeScript configuration
`$3
`bash
Navigate to the hardhat directory
cd hardhatInstall dependencies
npm installCompile contracts
npm run compileStart local hardhat node
npm run chainDeploy to hardhat network
npm run deploy:hardhatDeploy to Sepolia testnet (requires INFURA_API_KEY)
npm run deploy:sepolia
``- Node.js 16 or higher
- npm or yarn
MIT