A privacy-preserving confession platform built with Fully Homomorphic Encryption (FHEVM) on Ethereum.
Share encrypted confessions anonymously on-chain with end-to-end encryption. Built using Zama's FHEVM technology for computation on encrypted data.
- Fully Encrypted: Client-side encryption using FHEVM before blockchain submission
- Anonymous: Pseudonymous wallet-based identity with permanent privacy
- Encrypted Voting: Upvote mechanism without revealing vote counts
- On-Chain: Deployed on Ethereum Sepolia testnet
- Modern UI: Responsive design with glassmorphism effects
- Cross-Platform: Compatible with mobile, tablet, and desktop browsers
web3-confessions/
├── contracts/ # Smart contracts (Hardhat)
│ ├── contracts/
│ │ └── ConfessionVault.sol
│ ├── test/
│ ├── scripts/
│ └── hardhat.config.ts
│
└── frontend/ # Next.js frontend
├── src/
│ ├── app/ # App Router pages
│ ├── components/ # React components
│ ├── lib/ # Utilities & FHEVM wrapper
│ └── store/ # Zustand state management
├── public/
└── tailwind.config.ts
- Node.js 18+ and npm
- MetaMask or compatible Web3 wallet
- Sepolia testnet ETH (get from faucet)
```bash git clone https://github.com/GadgetLeo/web3-confessions.git cd web3-confessions ```
```bash
npm install
cd contracts npm install
cd ../frontend npm install ```
```bash cd contracts cp .env.example .env ```
Edit `.env`: ```env SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY PRIVATE_KEY=your_private_key_here ETHERSCAN_API_KEY=your_etherscan_api_key ```
```bash cd ../frontend cp .env.example .env.local ```
Edit `.env.local`: ```env NEXT_PUBLIC_CONFESSION_VAULT_ADDRESS=0x... # Will be set after deployment NEXT_PUBLIC_CHAIN_ID=11155111 NEXT_PUBLIC_FHE_PUBLIC_KEY=your_fhe_public_key NEXT_PUBLIC_SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_KEY NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id ```
```bash cd contracts
npm run compile
npm test
npm run deploy:sepolia
npx hardhat verify --network sepolia <CONTRACT_ADDRESS> ```
The deployment script will automatically update the frontend's `.env.local` with the contract address.
```bash cd frontend
npm run dev ```
Open http://localhost:3000 in your browser.
- Connect your Web3 wallet (MetaMask)
- Click "Create Confession"
- Type your confession (10-500 characters)
- Click "Confess Anonymously"
- Approve the transaction in your wallet
- Your encrypted confession is now on-chain!
- Click the heart icon on any confession
- Approve the transaction
- Vote is added to the encrypted counter
- Home Feed: Browse all confessions
- Detail View: Click any confession for full view
- About Page: Learn how FHE works
- Solidity ^0.8.24
- Zama FHEVM - Fully Homomorphic Encryption
- Hardhat - Development environment
- OpenZeppelin - Security libraries
- Sepolia - Ethereum testnet
- Next.js 14 - React framework with App Router
- TypeScript - Type safety
- Wagmi + Viem - Ethereum interactions
- RainbowKit - Wallet connection UI
- Zustand - State management
- TailwindCSS - Styling
- Framer Motion - Animations
- fhevmjs - Client-side encryption
Fully Homomorphic Encryption (FHE) allows computations on encrypted data without decryption.
- Client-Side Encryption: Your confession is encrypted in your browser
- On-Chain Storage: Encrypted data is stored on the blockchain
- Encrypted Computation: Smart contract performs operations (like adding votes) on encrypted data
- Privacy Preserved: No one ever sees the plaintext—not even validators
Plaintext → [Encrypt] → Ciphertext → [On-Chain Computation] → Encrypted Result
↓
No Decryption Needed!
- `submitConfession(bytes encryptedMessage)` - Submit encrypted confession
- `upvote(uint256 confessionId, bytes encryptedOne)` - Upvote with encrypted increment
- `getConfession(uint256 id)` - Get confession data (encrypted)
- `getConfessionCiphertext(uint256 id)` - Get raw ciphertext
- `updateRateLimit(uint256 newCooldown)` - Change submission cooldown
- `togglePause()` / `emergencyPause()` - Pause/unpause contract
- `hasUserUpvoted(uint256 id, address voter)` - Check upvote status
- `getRemainingCooldown(address user)` - Get rate limit countdown
The UI follows a premium Web3 design language:
- Colors: Deep space backgrounds with purple-cyan gradients
- Glassmorphism: Frosted glass cards with backdrop blur
- Typography: Space Grotesk (headings), Inter (body)
- Animations: Smooth Framer Motion transitions
- Responsive: Mobile-first, scales to desktop
```bash
cd contracts npm test
npm run coverage ```
```bash
cd frontend npm run lint
npx prettier --write . ```
```bash
cd frontend npm run build npm start ```
Contracts are deployed to Sepolia testnet. See deployment guide.
- Push code to GitHub
- Import project in Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to `main`
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch: `git checkout -b feature/amazing-feature`
- Commit changes: `git commit -m 'Add amazing feature'`
- Push to branch: `git push origin feature/amazing-feature`
- Open a Pull Request
- Follow existing code patterns
- Use TypeScript strict mode
- Add comments for complex logic
- Run tests before submitting PR
- No Plaintext Storage: All sensitive data is encrypted
- Rate Limiting: Prevents spam submissions
- Audited Libraries: Uses OpenZeppelin standards
- Input Validation: Sanitizes all user inputs
MIT License - see LICENSE file for details
- Zama for FHEVM technology
- OpenZeppelin for security libraries
- Rainbow for wallet connection UI
- Vercel for frontend hosting
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Share your secrets securely.