Define Fully Homomorphic Encryption in your own words
Explain how FHEVM brings FHE to Ethereum
Identify 3+ real-world use cases for confidential computing
Describe the high-level FHEVM data flow: encrypt → compute → decrypt
Key Topics
What is Fully Homomorphic Encryption?FHE allows computation on encrypted data without ever decrypting it. Think of it as performing math on a locked safe — you can add, subtract, and calculate inside without ever seeing the contents.
Traditional encryption requires decryption before processing — exposing sensitive data. FHE eliminates this vulnerability entirely.
The Zama Protocol & FHEVMFHEVM is an EVM-compatible runtime that exposes FHE types and operations in smart contracts via the Zama Solidity library.The core flow:
Client encrypts input
Contract computes on ciphertexts
Contract marks values as publicly decryptable
Client performs off-chain decryption via the Relayer SDK
Client submits the cleartext + proof back on-chain for verification
Real-World Use Cases
Confidential Voting
Votes remain encrypted during voting. Only the final tally is revealed.
Sealed-Bid Auctions
Bidders submit encrypted bids. The contract determines the winner without revealing losing bids.
Private Token Transfers
Transfer amounts stay hidden while the contract validates balances.
Confidential DeFi
Lending protocols where positions and balances remain private.
Connect wallet to Sepolia and obtain test ETH from faucet
Step-by-Step Setup
Step 1: Install Node.js & npm
# Verify Node.js installationnode --version # Should show v18.x.x or higher# Verify npm installationnpm --version # Should show 9.x.x or higher# If using nvm (recommended):nvm install 18nvm use 18
Step 2: Clone the FHEVM Hardhat Template
# Clone the official FHEVM templategit clone https://github.com/zama-ai/fhevm-hardhat-template.gitcd fhevm-hardhat-template# Install dependenciesnpm install# Copy the example environment filecp .env.example .env
Step 3: Configure Environment Variables
.env
# .env file configurationMNEMONIC="your twelve word mnemonic phrase here"# OR use a private key:PRIVATE_KEY="0xYourPrivateKeyHere"
NEVER commit your .env file to git — it contains sensitive keys. Use a dedicated development wallet with testnet funds only.
Gas Optimization Tip: Always use the smallest type that fits your data — smaller types use less gas.
Homomorphic Operations
Arithmetic Operations
// Additioneuint32 sum = FHE.add(a, b);// Subtraction (WRAPS on underflow - see safe patterns)euint32 diff = FHE.sub(a, b);// Multiplicationeuint32 product = FHE.mul(a, b);
Comparison Operations
// Greater thanebool isGreater = FHE.gt(a, b);// Greater than or equalebool isGte = FHE.gte(a, b);// Less thanebool isLess = FHE.lt(a, b);// Equalityebool isEqual = FHE.eq(a, b);
Encrypted Ternary (FHE.select)
// Replaces if/else for encrypted conditionseuint32 result = FHE.select( condition, // ebool valueIfTrue, // euint32 valueIfFalse // euint32);
You cannot use regular if/else with encrypted conditions. Always use FHE.select() instead.
Access Control & Decryption (v0.9+)
FHE.allowThis() — Grants the contract permission to work with an encrypted valueFHE.allow(value, address) — Grants a specific address permission to decrypt a value privatelyFHE.makePubliclyDecryptable(value) — Marks a ciphertext so anyone can request its decryption off-chainSelf-Relaying Decryption Flow (v0.9+)
// Step 1 (on-chain): Mark value as publicly decryptableencryptedValue = FHE.makePubliclyDecryptable(encryptedValue);bytes32 handle = FHE.toBytes32(encryptedValue);emit ValueReadyForDecryption(handle);// Step 2 (off-chain, in frontend):// Client uses @zama-fhe/relayer-sdk to call publicDecrypt(handle)// This returns { cleartext, decryptionProof }// Step 3 (on-chain): Verify and use the decrypted resultfunction resolveCallback( bytes memory cleartexts, bytes memory decryptionProof) external { bytes32[] memory handlesList = new bytes32[](1); handlesList[0] = handle; FHE.checkSignatures(handlesList, cleartexts, decryptionProof); uint32 result = abi.decode(cleartexts, (uint32)); // Use the verified decrypted result...}
In v0.9+, there is no Oracle. The dApp client drives decryption off-chain and submits the proof back on-chain.
Given 5 scenarios, choose the appropriate FHEVM encrypted type and justify your choice in 1-2 sentences each.Example: “A user’s age (0-150)” → euint8 (max 255, cheapest gas)
4. Architecture Diagram
Draw (or write in mermaid syntax) the FHEVM architecture diagram from memory, labeling each component and data flow.