🌍 Live Application: https://terraledger.pages.dev
TerraLedger is a decentralized application (DApp) designed to modernize land record management by replacing centralized, paper-heavy systems with a transparent, secure, and immutable blockchain ledger. Built on the Ethereum network and leveraging IPFS for decentralized storage, it automates property registration, eliminates intermediaries, and prevents data tampering.
Traditional land registries suffer from inefficiencies, lack of transparency, and vulnerability to data tampering. TerraLedger solves these issues by creating a single source of truth on the blockchain. By utilizing a hybrid storage model (Ethereum + IPFS), TerraLedger ensures absolute data immutability and high availability while remaining economically feasible.
- Immutable Records: Once registered, property data cannot be altered or deleted.
- Decentralized Security: Distributed ledger technology prevents single points of failure.
- Smart Contract Automation: Logic for registration and transfer is enforced by code, not clerks.
- Blockchain Layer: Solidity (v0.8.20), Ethereum Sepolia Testnet, OpenZeppelin AccessControl
- Decentralized Storage: InterPlanetary File System (IPFS) via Pinata API
- Development Framework: Hardhat, Chai
- Frontend Interface: React.js (v18.x) powered by Vite
- State & Theme Management: React Context API (with localStorage persistence + system theme detection)
- Web3 Interaction: Ethers.js (v6)
- Authentication & Roles: MetaMask (Wallet-based identity verification via custom live on-chain hooks)
- Hosting: Cloudflare Pages
TerraLedger eschews simple ownership models for OpenZeppelin’s AccessControl to accurately mirror real-world legal hierarchies:
- Chief Authority: Supreme administrative level. Can manage the network and assign or revoke Registrar roles via the upgraded Admin Dashboard (
RoleManagerinterface). - Land Registrar: The operational authority. Only personnel with this role can mint new land titles, approve property transfers, and submit document corrections.
- Property Owner / Citizen: Everyday users who can view assets, initiate transfers, and mathematically verify public records.
The Admin Dashboard (RoleManager) has been completely overhauled to offer a high-fidelity monitoring and control interface:
- Live Ecosystem Statistics: Displays real-time counts of total properties registered, pending transfers, and active Land Registrars.
- Dynamic Registrar Audits: Compiles a real-time table of active Land Registrars on-the-fly by parsing historic
RoleGrantedandRoleRevokedsmart contract events. - Direct Governance Tools: Allows the Chief Authority to grant new Registrar roles or revoke existing ones directly from the tables with intuitive inline actions and interactive, responsive feedback.
The application includes a premium styling system that allows users to toggle between vibrant, modern light and dark modes:
- Intelligent Default: Detects and respects the user's OS preference (
prefers-color-scheme) on initial load. - Persistent Preferences: Stores selection seamlessly in
localStorageso choices are remembered across sessions. - High-Fidelity Aesthetics: Leverages custom HSL-based CSS variables, frosted glass navigation menus, smooth transition micro-animations, and vibrant gradients to offer an immersive, premium user experience in both modes.
To maintain economic feasibility (gas optimization), heavy documents (PDFs/Images of physical land deeds) are kept off-chain, while their cryptographic proofs are stored on-chain. Documents are securely uploaded to the IPFS network, and the resulting Content Identifier (CID) is immutably stored in the smart contract's documentHash field.
TerraLedger allows anyone to mathematically verify a physical deed without trusting the government or the system itself:
- Local Hashing: The user selects a local file which is hashed entirely client-side using SHA-256.
- Remote Fetching & Comparison: The official document is fetched from IPFS using the on-chain CID and hashed. If the local hash matches the IPFS hash, the document is proven authentic and untampered.
Modern RPC nodes (such as Alchemy or Infura) enforce strict event query limitations, capping searches to a maximum block range (e.g., 50,000 blocks).
- Sequential Block Parsing: TerraLedger implements a custom
fetchEventsChunkedhelper (src/utils/chunkedProvider.js) to seamlessly query the blockchain in sequential block chunks. - Zero Query Failure: Ensures historical events (like transaction histories, role changes, and audit logs) load instantly and completely, regardless of the RPC provider constraints.
To eliminate the vulnerability of trusting client-cached data:
- Direct Hook-Based Validation: The
useWalletRoleshook continuously queries the Sepolia testnet to verify the active wallet's RBAC privileges directly on-chain. - Dynamic State Refresh: Replaces static state flags with live queries, ensuring instantaneous visual updates whenever a user changes MetaMask accounts or gets assigned a new role.
A dual-signature "Trustless Escrow" mechanism prevents unilateral fraudulent transfers:
- Transfer Request: The current owner securely flags the property as pending and designates a buyer's wallet address.
- Registrar Approval: An authorized Land Registrar must validate the request and formally finalize the ledger transition to the new owner.
Registrars can fix data-entry errors using the updatePropertyDocument function. This overwrites the IPFS CID and explicitly emits a PropertyDocumentUpdated event, creating an immutable on-chain audit trail of the correction.
To support citizens without crypto-wallets who wish to view public records, TerraLedger implements a dynamic fallback RPC mechanism:
- Unrestricted Public Node Routing: If MetaMask is unavailable, the application seamlessly routes through an unrestricted Public node, allowing massive historical queries without rate limits.
- Bulletproof Error Boundaries: Robust null-check handling across all screens prevents connection-related page crashes and handles wallet disconnections gracefully.
Every layout, screen, and component has been systematically overhauled for full mobile and tablet responsiveness:
- Fluid Layouts: Grids collapse, text scales dynamically (utilizing modern CSS rules like
clamp()), and navigation components collapse elegantly. - Target-Friendly Elements: Spacing, margins, and tap areas are designed to adapt flawlessly from 4K desktop screens down to 400px mobile devices.
The project is currently deployed live on the Ethereum Sepolia testnet.
- Visit the live site: terraledger.pages.dev
- Switch your MetaMask network to Sepolia.
- Note: You can view the transaction history and public records without connecting a wallet, thanks to the public RPC fallback mechanism.
-
Clone the repository:
git clone <repository-url> cd TerraLedger
-
Install dependencies:
npm install
-
Start the local Hardhat node:
npx hardhat node
-
In a new terminal, deploy the smart contracts to the local network:
npx hardhat ignition deploy ignition/modules/LandRegistryModule.js --network localhost
-
Start the frontend application:
npm run dev
- Anilabh Barua
- Rishikesh Verma
- Guided by: Dr. Satyajit Sarmah, Gauhati University