Skip to content

Week 4: Capstone & Production

Time estimate: ~10-12 hours (including capstone homework) | Difficulty: Advanced | Prerequisites: Week 1, Week 2, and Week 3 completed


What You'll Learn

This is the final week. You bring the earlier FHEVM patterns together in a production-shaped auction and then move from local mock testing to real deployment flows:

  • State machine design for auction lifecycle control
  • eaddress for hiding winner identity until reveal
  • FHE.gt() + FHE.select() for encrypted ranking
  • Incremental winner tracking without revealing losing bids
  • Deployment to Sepolia with hardhat deploy
  • Client-side encryption and decryption through the FHEVM runtime model
  • Security and operational checks before production deployment

What You'll Build

SealedBidAuction.sol — A sealed-bid auction where bids are encrypted, ranking happens under FHE, and only the revealed result becomes public.

Then you deploy it through Hardhat and extend the pattern into a Vickrey auction for the capstone homework.

Weekly Milestones

  • [ ] Lesson 1 — Understand sealed-bid auction design, phases, encrypted ranking, and the full SealedBidAuction.sol contract flow
  • [ ] Lesson 2 — Move from local mock mode to real deployment and verification with Hardhat
  • [ ] Capstone Homework — Extend the auction into a Vickrey (second-price) auction and pass the provided tests

Lessons

Lesson 1: Building a Sealed-Bid Auction ~90 min

Build the auction contract itself: encrypted bids, state transitions, encrypted highest-bid tracking, and selective reveal.

Lesson 2: From Mock to Mainnet — Deployment & Frontend ~60 min

Take the bootcamp contracts from Hardhat mock mode to localhost and Sepolia deployments, then connect that flow to real encrypted inputs and decryption.

Capstone Homework: Vickrey Auction ~6-8 hours

Extend the sealed-bid auction into a second-price auction that tracks the highest and second-highest bids under encryption.


Key Concepts This Week

ConceptDescription
eaddressEncrypted Ethereum address
FHE.asEaddress()Trivial encryption of a plaintext address
FHE.gt()Encrypted greater-than comparison
Phase enumEnforces auction lifecycle transitions
Incremental trackingUpdates winner state during bidding instead of at the end
Selective revealOnly reveal the final result, not the losing bids
createEncryptedInputClient-side encrypted input flow
hardhat deployDeployment automation for localhost and Sepolia
Silent-zero patternPrivacy-preserving failure handling

Ready? Start with Lesson 1: Building a Sealed-Bid Auction.

Built for the Zama Developer Program — Bounty Track