ConsentChain is a trustless, Web3-native application that shifts control of data privacy from central servers back to the user. It allows users to grant, manage, and automatically revoke data consent for third-party companies using time-bound smart contracts on the Ethereum blockchain.
- Time-Bomb Consent Logic: Consent is not permanent. Users set an exact duration (e.g., 30 days), and the smart contract automatically invalidates access the second the time expires without requiring an extra transaction.
- Immutable Company Registry: Companies must permanently register their identity (
name,privacyUrl) on-chain. This creates a transparent "Phone Book" of verified data consumers. - Granular Revocation: Users can manually revoke consent from a specific company at any time with a single transaction.
- Immersive UI: A high-contrast, dark-mode interface featuring dynamic "aura" aesthetics and glassmorphism, built on Next.js 16.
- Smart Contracts: Solidity, Hardhat
- Network: Ethereum (Sepolia Testnet)
- Frontend: Next.js (App Router, Turbopack), TypeScript, Tailwind CSS
- Web3 Integration: Wagmi, Viem, RainbowKit
The core logic is governed by ConsentV4.sol, which handles two primary mappings:
- The User Consent Vault:
mapping(address => mapping(address => Consent))Stores the boolean state and expiration timestamp of a user's consent to a specific company. - The Registry Billboard:
mapping(address => CompanyProfile)Stores the public profile of verified entities requesting data.
registerCompany(string, string): Onboards a new company to the protocol.giveConsent(address, uint256): Grants time-locked permission to a registered entity.checkConsent(address, address): Aviewfunction that checks both the boolean state and the time-bomb status.revokeConsent(address): Immediately destroys the consent record.
- Node.js (v18+)
- MetaMask or equivalent Web3 wallet funded with Sepolia ETH.
- Clone the repository:
git clone [https://github.com/yourusername/Project-Consent-Chain.git](https://github.com/yourusername/Project-Consent-Chain.git)