Privacy-Preserving Sealed-Bid Auctions on Blockchain
Built with Zama's fhEVM
Traditional blockchain auctions suffer from critical privacy issues:
- Front-running: Bots can see pending bids and outbid users
- Bid sniping: Last-second bids exploit transparent bid amounts
- Privacy leaks: All losing bids are permanently visible on-chain
- Trust issues: Users must trust centralized platforms for sealed-bid auctions
PolyBid leverages Fully Homomorphic Encryption (FHE) to create truly private, trustless sealed-bid auctions directly on the blockchain. Bid amounts remain encrypted throughout the entire auction lifecycle, with the smart contract computing the winner without ever decrypting losing bids.
Unlike commit-reveal schemes or zero-knowledge proofs, FHE allows:
- β Real-time bid validation (opening price checks) on encrypted values
- β On-chain winner determination without revealing any bid amounts
- β Permanent privacy for losing bidders (no reveal phase needed)
- β Trustless execution with no centralized components
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AuctionFactory.sol β
β β’ Creates new Auction contracts (Factory Pattern) β
β β’ Stores auction metadata (IPFS images, descriptions) β
β β’ Tracks all deployed auctions β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β deploys
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Auction.sol β
β β
β FHE Operations: β
β β’ submitBid(euint64 encryptedBid) - Store encrypted β
β β’ TFHE.max(bid1, bid2) - Compare without decryption β
β β’ amITheWinner() β ebool - Private winner check β
β β
β Privacy Features: β
β β’ ACL (Access Control Lists) for encrypted data β
β β’ Only bidder can decrypt their own bid status β
β β’ Winner revealed only after auction closes β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
User Input (plaintext bid)
β
βΌ
βββββββββββββββββββββββββββ
β Zama FHE SDK β
β β’ Client-side encrypt β
β β’ Generate proof β
βββββββββββββββββββββββββββ
β
βΌ
euint64 + proof
β
βΌ
βββββββββββββββββββββββββββ
β Smart Contract β
β β’ Validate proof β
β β’ Store encrypted bid β
β β’ Compare with TFHE β
βββββββββββββββββββββββββββ
- Encrypted Bidding: All bid amounts encrypted client-side using Zama's FHE SDK
- Anonymous Identities: Wallet addresses displayed as "Anon-XXXX" throughout the UI
- Private Winner Checks: Users can verify if they won without revealing their bid
- No Reveal Phase: Losing bids remain encrypted forever
- Responsive Design: Mobile-first UI with TailwindCSS
- Gmail-Style FAB: Floating Action Button for quick auction creation
- Real-time Updates: Live auction countdowns and bid notifications
- Smooth Animations: Framer Motion for polished interactions
- IPFS Integration: Decentralized image storage via Pinata
- Opening Price Enforcement: Bids validated against minimum price (encrypted)
- Deposit Locking: Bid amounts locked until auction closes
- Network Guards: Auto-switch to Sepolia testnet
- Input Sanitization: XSS protection and address validation
- Error Handling: User-friendly error messages for all edge cases
- Selling Tab: Track auctions you've created (Active/Pending/Ended)
- Buying Tab: Monitor your bids and check win status
- Wallet Integration: RainbowKit for seamless wallet connection
- Transaction History: Complete audit trail of all actions
Deployed on Sepolia Testnet
- Frontend: https://poly-bid.vercel.app/
- Factory Contract:
0x4168574D678D9f54C0B5FF7ddE388aF772310330 - Network: Sepolia (Chain ID: 11155111)
# Clone the repository
git clone https://github.com/Admuad/PolyBid.git
cd PolyBid
# Install dependencies
cd frontend && npm install
cd ../contracts && npm install
# Configure environment
cp frontend/.env.example frontend/.env.local
# Add your WalletConnect Project ID and Pinata keys
# Run frontend
cd frontend && npm run devVisit http://localhost:5173 and connect your wallet!
cd contracts
npm testTest Coverage:
- β Auction creation with opening price
- β Encrypted bid submission and validation
- β Winner determination using FHE comparisons
- β ACL permissions for encrypted data
- β Refund and withdrawal mechanisms
- β Edge cases (zero bids, expired auctions, etc.)
cd frontend
npm run lint
npm run build # Validates TypeScript compilationManual Testing Checklist:
- β Create auction with IPFS image upload
- β Submit encrypted bid above opening price
- β Update bid (increase amount)
- β Close auction and reveal winner
- β Check win status (FHE decryption)
- β Claim refund (losing bidders)
- β Withdraw proceeds (seller)
- β Mobile responsiveness (all breakpoints)
Seller creates an auction with:
- Item name, description, and image (stored on IPFS)
- Duration (minutes/hours/days)
- Opening price (minimum bid)
- 0.0001 ETH deposit (reward for auction closer)
Bidders:
- Enter bid amount in the UI
- Frontend encrypts the bid using Zama's FHE SDK
- Smart contract validates:
encryptedBid >= encryptedOpeningPrice - Bid amount locked as deposit
Anyone can close an expired auction:
- Contract computes
maxBid = TFHE.max(bid1, bid2, ...) - Winner determined without decrypting any bids
- Closer receives 0.0001 ETH reward
- Winner: Contacts seller to arrange item transfer
- Losers: Withdraw their bid deposits (refunds)
- Seller: Withdraws winning bid amount
Encrypted Bid Storage:
mapping(address => euint64) private bids; // Encrypted bid amounts
mapping(address => bool) public hasBid; // Public participation flagEncrypted Comparison:
function submitBid(einput encryptedAmount, bytes calldata inputProof) external payable {
euint64 bid = TFHE.asEuint64(encryptedAmount, inputProof);
// Compare encrypted bid with encrypted opening price
ebool isValid = TFHE.ge(bid, openingPrice);
require(TFHE.decrypt(isValid), "Bid below opening price");
bids[msg.sender] = bid;
TFHE.allow(bid, msg.sender); // ACL: bidder can decrypt their own bid
}Winner Determination:
function closeAuction() external {
euint64 maxBid = bids[bidders[0]];
for (uint i = 1; i < bidders.length; i++) {
maxBid = TFHE.max(maxBid, bids[bidders[i]]);
}
// Winner is determined, but maxBid value remains encrypted!
}Traditional sealed-bid auctions require a reveal phase, exposing all bids. PolyBid's FHE approach:
- Eliminates reveal phase entirely
- Protects bidder privacy permanently
- Enables trustless on-chain execution
- Prevents collusion and manipulation
| Layer | Technology | Purpose |
|---|---|---|
| Smart Contracts | Solidity 0.8.28 | Core auction logic |
| Zama fhEVM | Encrypted computation | |
| Hardhat | Development & testing | |
| Frontend | React 18 + TypeScript | UI framework |
| Vite | Build tool | |
| TailwindCSS | Styling | |
| Wagmi v2 + Viem | Blockchain interaction | |
| RainbowKit | Wallet connection | |
| Framer Motion | Animations | |
| Storage | IPFS (Pinata) | Decentralized images |
| Network | Sepolia Testnet | Deployment |
Original Tech Architecture (35%)
- Custom factory pattern for scalable auction deployment
- Unique FHE integration: encrypted opening price validation
- Novel ACL usage for privacy-preserving winner checks
- Not boilerplate - built from scratch with Zama primitives
Working Demo Deployment (15%)
- Live deployment on Sepolia testnet
- Fully functional end-to-end flow
- IPFS integration for production-ready UX
Testing (10%)
- Comprehensive Hardhat test suite
- Manual testing checklist (documented above)
- Edge case coverage (zero bids, expired auctions, etc.)
UI/UX Design (10%)
- Premium, modern interface with dark mode
- Mobile-responsive (tested on all breakpoints)
- Intuitive user flows with helpful error messages
- Smooth animations and loading states
Presentation Video (10%)
- Watch the Demo Video
- Walkthrough of create β bid β close β claim flow
- Explanation of FHE privacy benefits
Development Effort (10%)
- 7 development phases completed (see
task.md) - 50+ components and hooks
- Comprehensive error handling and validation
- Production-ready code quality
Business Potential (10%)
- Target Market: NFT auctions, real estate, procurement
- Competitive Advantage: Only truly private on-chain auctions
- Scalability: Factory pattern enables unlimited auctions
- Monetization: Transaction fees, premium features
- Roadmap: Multi-chain deployment, DAO governance, advanced auction types
- FHE-encrypted bidding
- Factory pattern deployment
- Profile dashboard
- IPFS integration
- Dutch auctions (descending price)
- Multi-item auctions (batch bidding)
- Auction templates (NFTs, real estate, etc.)
- Reputation system
- Multi-chain deployment (Polygon, Arbitrum)
- DAO governance for platform fees
- Mobile app (React Native)
- API for third-party integrations
We welcome contributions! Please see our Contributing Guidelines.
# Install dependencies
npm install
# Run tests
cd contracts && npm test
# Start local dev server
cd frontend && npm run dev
# Lint code
npm run lintThis project is licensed under the MIT License - see the LICENSE file for details.
- Zama for pioneering FHE technology and the fhEVM
- Polynomial for the branding inspiration
- Sepolia Testnet for reliable testing infrastructure
- Zama Developer Program for the opportunity to build confidential dApps
- X: @Adedir2
- GitHub: @Admuad
- Project: PolyBid Repository
- Discord: Join the Zama Discord and find me in #developer-program
Built with π using Zama's FHE technology
Making blockchain auctions private, fair, and trustless