Rule Zer0 is a decentralized platform designed to revolutionize traffic rule enforcement by creating a self-sustaining rewards and fines ecosystem. By combining blockchain, AI, and Web3 technologies, Rule Zer0 encourages drivers to follow traffic rules and penalizes those who don't, fostering safer roads and responsible driving.
The frontend is built using Scaffold-ETH 2.
- Deployed on Base Sepolia testnet at contract address:
0x5FbDB2315678afecb367f032d93F642f64180aa3
- Supports:
- User management via Anon Aadhaar (sign-in with Aadhaar Card or Driver's License).
- Storing violations, rewards, and payment statuses.
- Automated reward distribution.
- Fine payments and reward redemption.
- Automates Vehicle Traffic Violation Reporting:
- Uses object detection to trace vehicles on a camera feed
- Reports traffic violations to the smart contract
- Galadriel is an AI agent that analyzes data from the smart contract, including violations and user behavior.
- The agent generates:
- Responses based on violation patterns of each driver.
- Reward amounts specific to each driver.
- Updates to user points in the smart contract based on predefined reward distribution rules.
- Provides end-to-end support for:
- Viewing traffic violations.
- Paying fines using:
- Coinbase Wallet for UPI-to-crypto transactions.
- Any other on-chain wallet.
- Checking points and exchanging them for rewards.
- Viewing the leaderboard based on driver points.
- Searching for user profiles.
-
User Registration
Users sign in using Anon Aadhaar (via Aadhaar Card or Driver's License). -
Violations & Penalties
When a traffic rule is violated, the violation is reported and logged in the smart contract. -
Reward System
The AI agent (Galadriel) evaluates user behavior and determines rewards based on the following rules:- Less Violations Recently ➡️ Slightly More Rewards.
- Improved Frequent Defaulters ➡️ Bonus Rewards.
- Consistent Good Drivers ➡️ Average Rewards.
- Frequent Violators ➡️ No Rewards.
- Increased Violation Frequency ➡️ Low Rewards.
- Unpaid Fines ➡️ Rewards Capped at 8%.
-
Payment of Fines
Fines can be paid using:- Coinbase Wallet (UPI-to-crypto).
- On-platform wallet for direct payments.
-
Reward Redemption
Users can view and redeem their rewards for:- Blockchain currency.
- Alternative incentives (e.g., coupons, discounts).
- Clearing fines with reward points.
-
🪪 Anon Aadhaar Sign-In
- Secure, decentralized login using Aadhaar Card or Driver's License.
-
🚦 Violation Tracking
- Real-time logging and display of traffic violations.
-
💰 Fine Payments
- Pay fines seamlessly with crypto or UPI via Coinbase Wallet.
-
🏆 Rewards System
- Earn rewards for responsible driving.
- Exchange points for incentives or use them to clear fines.
-
📈 Leaderboard
- Compete with other drivers and track your performance.
-
🔍 Profile Search
- Search and view driver profiles and violation history.
- Frontend: Scaffold-ETH 2 with NextJS and RainbowKit UI
- Backend: Hardhat (Smart Contract Development)
- Blockchain: Solidity, Base Sepolia Testnet
- AI: Python-based automation with Galadriel AI agent and OpenCV/Ultralytics
- Wallet Integration: Metamask, Coinbase Wallet
- Identity Verification: Anon Aadhaar for Aadhaar and Driving Licence Verification
- Node.js (v14+)
- Hardhat
npm install --save-dev hardhat
- Python (for AI automation script)
- Coinbase Wallet for transactions.
-
Clone the repository:
git clone https://github.com/imApoorva36/Truce-ETHIndia-24.git cd Truce-ETHIndia-24
-
Install dependencies:
yarn install
-
Deploy the contract to Base Sepolia:
yarn deploy --network baseSepolia
-
Start the frontend:
yarn start
-
Open the app in your browser:
http://localhost:3000
-
Install Python dependencies:
pip install web3 opencv-python ultralytics openai
-
Run the AI automation script:
python yolotrack1.py
The rewards are distributed based on these principles:
-
Recent Improvement:
More rewards for drivers showing improvement. -
Consistent Violators:
Zero rewards for continuous defaulters. -
Good Drivers:
Average rewards for consistently good drivers. -
Unpaid Fines:
Rewards capped if fines are unpaid.python caller.py
This project is licensed under the MIT License.