Skip to content

deeksha006/Land-Registration-System-with-Blockchain

Repository files navigation

🏠 Land Registration System with Blockchain

A decentralized land registration system built on Ethereum blockchain that ensures transparent, secure, and immutable property ownership records.

πŸ“‹ Table of Contents

✨ Features

  • πŸ” Secure Property Registration: Blockchain-based immutable property records
  • πŸ‘₯ Multi-Role System: Separate interfaces for users and revenue officers
  • πŸ“„ Document Management: Upload and store property documents using GridFS
  • πŸ’° Property Trading: Built-in marketplace for property buying/selling
  • πŸ” Ownership Verification: Transparent ownership history and verification
  • ⚑ Real-time Updates: Live transaction status and property state changes
  • πŸ›‘οΈ Smart Contract Security: Automated ownership transfer with built-in validations

πŸ› οΈ Technology Stack

Frontend

  • HTML5/CSS3/JavaScript: User interface
  • Bootstrap: Responsive design framework
  • Web3.js: Blockchain interaction

Backend

  • Python Flask: Web application framework
  • MongoDB: Database for off-chain data storage
  • GridFS: File storage system for documents

Blockchain

  • Solidity: Smart contract development
  • Truffle: Development framework
  • Ganache: Local blockchain for testing
  • Web3.py: Python blockchain integration

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Users Portal  β”‚    β”‚ Revenue Portal  β”‚    β”‚   Blockchain    β”‚
β”‚   (Port 5000)   β”‚    β”‚   (Port 5001)   β”‚    β”‚   (Port 8545)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                      β”‚                      β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      MongoDB           β”‚
                    β”‚    (Port 27017)        β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Prerequisites

Before running this project, make sure you have the following installed:

  • Node.js (v14.0.0 or higher)
  • Python (v3.8 or higher)
  • MongoDB (v4.4 or higher)
  • Git
  • MetaMask browser extension

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/deeksha006/Land-Registration-System-with-Blockchain.git
cd Land-Registration-System-with-Blockchain

2. Install Python Dependencies

pip install -r python_package_requirements.txt

3. Install Node.js Dependencies

npm install -g truffle ganache-cli
cd Smart_contracts
npm install

4. Install and Setup MongoDB

  • Download and install MongoDB from official website
  • Start MongoDB service on localhost:27017

5. Install Ganache (Choose one)

Option A: Ganache GUI (Recommended)

Option B: Ganache CLI

npm install -g ganache-cli

βš™οΈ Configuration

1. Ganache Setup

2. Update Configuration Files

The system is pre-configured for local development. Key configuration files:

  • Revenue/config.json: Revenue department settings
  • Smart_contracts/truffle-config.js: Blockchain network configuration

3. MetaMask Setup

  1. Install MetaMask browser extension
  2. Add custom network:

🎯 Usage

1. Start MongoDB

Ensure MongoDB is running on localhost:27017

2. Start Ganache

Using Ganache GUI:

  • Open Ganache and start your workspace

Using Ganache CLI:

ganache-cli -p 8545 -d

3. Deploy Smart Contracts

cd Smart_contracts
truffle migrate --reset

4. Start Applications

Users Portal:

python Users/app.py

Access at: http://localhost:5000

Revenue Portal:

python Revenue/app.py

Access at: http://localhost:5001

πŸ“œ Smart Contracts

Contract Overview

Contract Purpose Address
Users User registration and management Auto-deployed
Property Property details and state management Auto-deployed
LandRegistry Land ownership mapping Auto-deployed
TransferOwnerShip Property transfer and sales Auto-deployed

Key Functions

  • registerUser(): Register new users
  • addProperty(): Add property to blockchain
  • verifyProperty(): Revenue officer verification
  • makePropertyAvailable(): List property for sale
  • requestToBuy(): Initiate purchase request
  • transferOwnership(): Complete ownership transfer

πŸ”— API Endpoints

Users Portal (Port 5000)

  • GET /: Home page
  • GET /register: User registration page
  • GET /dashboard: User dashboard
  • POST /uploadPropertyDocs: Upload property documents
  • GET /availableToBuy: View properties for sale

Revenue Portal (Port 5001)

  • GET /: Revenue officer login
  • GET /dashboard: Revenue dashboard
  • POST /verifyProperty: Verify property details
  • GET /allProperties: View all registered properties

πŸ”„ Workflow

Property Registration Process

  1. User Registration: Users register on the platform
  2. Property Submission: Users submit property details and documents
  3. Revenue Verification: Revenue officers verify property authenticity
  4. Blockchain Recording: Verified properties are recorded on blockchain
  5. Marketplace Listing: Approved properties can be listed for sale
  6. Ownership Transfer: Secure transfer of ownership through smart contracts

User Roles

  • Property Owners: Register and manage their properties
  • Buyers: Browse and purchase available properties
  • Revenue Officers: Verify and approve property registrations

πŸ§ͺ Testing

Run Smart Contract Tests

cd Smart_contracts
truffle test

Manual Testing Steps

  1. Register a new user
  2. Add a property with documents
  3. Verify property as revenue officer
  4. List property for sale
  5. Complete a property purchase transaction

πŸ“ Project Structure

Land-Registration-System-with-Blockchain/
β”œβ”€β”€ Users/                          # User portal application
β”‚   β”œβ”€β”€ app.py                     # Flask application
β”‚   β”œβ”€β”€ web/                       # Frontend files
β”‚   β”‚   β”œβ”€β”€ templates/             # HTML templates
β”‚   β”‚   └── static/                # CSS, JS, images
β”‚   └── Property_Docs/             # Uploaded documents
β”œβ”€β”€ Revenue/                        # Revenue department portal
β”‚   β”œβ”€β”€ app.py                     # Flask application
β”‚   β”œβ”€β”€ config.json                # Configuration file
β”‚   β”œβ”€β”€ templates/                 # HTML templates
β”‚   β”œβ”€β”€ static/                    # Static files
β”‚   └── utility/                   # Helper functions
β”œβ”€β”€ Smart_contracts/                # Blockchain contracts
β”‚   β”œβ”€β”€ contracts/                 # Solidity contracts
β”‚   β”‚   β”œβ”€β”€ Users.sol              # User management
β”‚   β”‚   β”œβ”€β”€ Properties.sol         # Property management
β”‚   β”‚   β”œβ”€β”€ LandRegistry.sol       # Land registry
β”‚   β”‚   └── TransferOfOwnership.sol # Ownership transfer
β”‚   β”œβ”€β”€ migrations/                # Deployment scripts
β”‚   β”œβ”€β”€ build/                     # Compiled contracts
β”‚   └── truffle-config.js          # Truffle configuration
β”œβ”€β”€ python_package_requirements.txt # Python dependencies
β”œβ”€β”€ deploy_contracts.bat           # Contract deployment script
└── README.md                      # Project documentation

βœ… Recent Fixes (2025-07-22)

Fixed Issues:

  1. Bootstrap Integrity Errors - Removed incorrect SHA-384 hashes
  2. Contract Details 500 Errors - Fixed file paths for Smart_contracts
  3. JavaScript JSON Parsing - Added comprehensive error handling
  4. Python 3.9 Compatibility - Created app_simple.py versions without web3 conflicts
  5. Missing Login Endpoints - Added proper FormData handling for Revenue portal
  6. File Upload Issues - Enhanced document upload functionality

Python 3.9 Compatibility:

If you encounter TypeError: unhashable type: 'list' errors with web3/aiohttp:

  • Use Users/app_simple.py instead of Users/app.py
  • Use Revenue/app_simple.py instead of Revenue/app.py
  • These simplified versions avoid the typing module conflicts

Current Working Setup:

  • Users Portal: python app_simple.py (Port 5001)
  • Revenue Portal: python app_simple.py (Port 5002)
  • MongoDB: localhost:27017
  • Ganache: localhost:8545 (Chain ID: 1337)

🚨 Troubleshooting

Common Issues

1. Port Already in Use

# Kill process using port
netstat -ano | findstr :8545
taskkill /PID <PID> /F

2. Contract Deployment Failed

  • Ensure Ganache is running
  • Check network configuration in truffle-config.js
  • Verify sufficient ETH in deployment account

3. MongoDB Connection Error

  • Start MongoDB service
  • Check connection string in application files

4. MetaMask Connection Issues

  • Verify custom network settings
  • Import Ganache account using private key
  • Reset MetaMask account if needed

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Ethereum Foundation for blockchain technology
  • Truffle Suite for development tools
  • MongoDB for database solutions
  • Flask community for web framework

πŸ“ž Support

For support and questions:


⭐ If you found this project helpful, please give it a star!

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •