FHE-Powered Vendor Potential Rating System
A decentralized application that enables enterprises to assess vendor potential using Fully Homomorphic Encryption (FHE), ensuring complete data privacy while performing on-chain calculations.
Traditional vendor assessment systems require enterprises to expose sensitive business metrics (revenue, employee count, tax records) to third-party evaluators. This creates:
- Privacy risks: Confidential business data exposed during evaluation
- Trust issues: Reliance on centralized entities to handle sensitive information
- Compliance challenges: Difficulty meeting data protection regulations (GDPR, etc.)
VendorElect leverages Fully Homomorphic Encryption (FHE) to solve this problem:
- Client-side encryption: All sensitive data is encrypted in the browser before submission
- On-chain FHE computation: Smart contract performs rating calculations on encrypted data
- User-controlled decryption: Only the data owner can decrypt and view results
Result: Complete vendor assessment without ever exposing plaintext business data.
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Browser │────▶│ Smart │────▶│ Browser │
│ Encrypt │ │ Contract │ │ Decrypt │
│ 6 metrics │ │ FHE Calc │ │ Results │
└─────────────┘ └──────────────┘ └─────────────┘
| Indicator | Grade A | Grade B | Grade C |
|---|---|---|---|
| Registered Capital | >$10M | $3M-$10M | <$3M |
| Years in Business | 5+ years | 3-5 years | <3 years |
| Employee Count | 200+ | 50-200 | <50 |
| Annual Tax Payment | >$5M | $1M-$5M | <$1M |
| Annual Revenue | >$50M | $10M-$50M | <$10M |
| Litigation Record | None | - | Has Record |
- Grade A: ≥4 metrics at A-level AND no litigation record
- Grade B: ≥4 metrics at B-level or above AND no litigation record
- Grade C: All other cases
- Solidity 0.8.24 with FHEVM
- Zama FHEVM for FHE operations
- Hardhat for development & deployment
- Next.js 16 (App Router)
- TypeScript
- Tailwind CSS with custom Renaissance Glassmorphism theme
- wagmi + Web3Modal for wallet connection
- @zama-fhe/relayer-sdk for FHE encryption/decryption
VendorElect/
├── contracts/ # Smart contract
│ ├── src/
│ │ └── VendorElect.sol # Main FHE contract
│ ├── scripts/
│ │ └── deploy.ts # Deployment script
│ └── hardhat.config.ts
├── frontend/ # Next.js frontend
│ ├── src/
│ │ ├── app/ # Pages
│ │ ├── components/ # React components
│ │ └── lib/ # Utilities & FHE client
│ └── package.json
└── README.md
Contract Address: 0x635594B5C1cD97273139D0A4e03822EBDE122CE4
# Clone the repository
git clone https://github.com/jennahaaa/VendorElect.git
cd VendorElect
# Install contract dependencies
cd contracts
pnpm install
# Install frontend dependencies
cd ../frontend
pnpm install
# Run frontend
pnpm devcd contracts
pnpm testTest Results:
VendorElect
Deployment
✔ Should deploy successfully
✔ Should have correct initial state
✔ Should return 0 for rating count of new user
✔ Should return 0 for rating timestamp of new user
View Functions
✔ Should revert getOverallGrade when no rating submitted
✔ Should return tuple for getItemGrades (uninitialized)
Access Control
✔ Should allow any address to call view functions
FHE Operations (Integration Tests - Sepolia)
- submitAndCalculate - requires FHEVM network
- Grade calculation logic - requires FHEVM network
VendorElect - Rating Rules Documentation
✔ Documents indicator encoding
✔ Documents grading rules
✔ Documents FHE security model
10 passing (87ms)
2 pending
Test Coverage:
| Category | Tests | Status | Description |
|---|---|---|---|
| Deployment | 4 | ✅ Pass | Contract deployment & initial state verification |
| View Functions | 2 | ✅ Pass | getOverallGrade, getItemGrades return values |
| Access Control | 1 | ✅ Pass | Multi-user data isolation |
| Documentation | 3 | ✅ Pass | Rating rules & FHE security model |
- Connect Wallet: Click "Connect Wallet" and select your wallet (auto-switches to Sepolia)
- Select Indicators: Choose one tier (A/B/C) for each of the 6 business metrics
- Encrypt & Submit: Data is encrypted client-side and submitted to the blockchain
- Decrypt Result: Sign to authorize decryption and view your rating
VendorElect addresses a real market need in B2B vendor management:
- Target Market: Enterprise procurement departments, supply chain managers
- Use Cases:
- Pre-qualification screening
- Ongoing vendor risk assessment
- Compliance-friendly due diligence
- Revenue Model: SaaS subscription for enterprise deployments
- Scalability: Can extend to other confidential scoring systems (credit, insurance, etc.)
- All sensitive data encrypted using Zama's TFHE scheme
- No plaintext data ever touches the blockchain
- User-controlled decryption with EIP-712 signatures
- Contract verified on Etherscan
MIT License - see LICENSE for details.
- Zama for FHEVM technology
- Built for the Zama Developer Program