How zero-abd/authlens works
Project Type and Purpose
• Full-stack blockchain-powered video authentication platform (“dApp”).
• React frontend (AuthLens-Frontend) for user interactions.
• Python FastAPI backend (backend/) for video chunk processing, hashing, blockchain calls and metadata storage.
• Solidity smart contract (contracts/VideoAuth.sol) deployed to Ethereum Sepolia via Hardhat/ignition.
• Purpose: split videos into 1-minute chunks, compute cryptographic hashes, store/check them on chain for tamper-proof verification and timestamping.
File Structure
• Top-level directories:
• AuthLens-Frontend/: React/TypeScript code, UI components, service layer.
• backend/: Python code (main.py, test_client.py), requirements.txt, local contract ABI (VideoAuth.json).
• contracts/: VideoAuth.sol.
• ignition/: TypeScript deployment modules using Hardhat-Ignition.
• db/: JSON files (ledger.json, remote_cameras.json) simulating/persisting chunk metadata.
• Config & scripts:
• hardhat.config.ts, package.json/tsconfig.json for Node/TypeScript build & deployment.
• FLOW_DIAGRAM.md hints at end-to-end flow.
• Test assets: test_videos/README.md.
Extract README Insights
• AuthLens uses Alchemy/Infura as RPC providers.
• MetaMask on frontend for transaction signing.
• FastAPI exposes three main endpoints: process-chunk, verify, range.
• Deployment via npx hardhat ignition deploy … --network sepolia.
• Local JSON DB used for quick range queries.
Main Components
a. User Layer
• Browser + MetaMask plugin (Sepolia wallet).
b. Presentation Layer
• React App (AuthLens-Frontend).
c. API Layer
• FastAPI Server (backend/main.py).
d. On-Chain Layer
• Ethereum Sepolia Network
• VideoAuth smart contract
e. Infrastructure & Tools
• Hardhat/Ignition (deployment)
• Alchemy/Infura RPC node
f. Data Storage
• Local JSON “DB” (db/ledger.json & db/remote_cameras.json)
Relationships and Data Flow
• User → React UI: video selection, “upload chunk”, “verify”, “fetch range”.
• React → FastAPI (HTTP/REST endpoints):
• POST /api/video/process-chunk: sends file + timestamps.
• POST /api/video/verify: sends file for on-chain check.
• GET /api/video/range: requests chunk metadata.
• FastAPI → Local JSON DB: read/write chunk metadata.
• FastAPI → Ethereum RPC (JSON-RPC via Web3/Ethers):
• sendTransaction(storeHash) with chunk hash.
• call verifyHash for existence check.
• Ethereum Node → Smart Contract: transactions and calls.
• Hardhat/Ignition (offline): deploys contract, produces ABI & deployed_addresses.json.
Architectural Patterns & Principles
• Clear separation of concerns: UI / API / blockchain storage.
• Stateless frontend; stateful backend with minimal local persistence.
• Eventual consistency: on-chain writes + off-chain metadata storage.
• Modular deployment: ignition modules isolate contract deployment logic.