Skip to content

darknight0847/Blockchain_based_land_management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Digital Vault - Phase 1

Blockchain-Based Land Registry System

A private, permissioned blockchain MVP for secure digital land titles using Hyperledger Fabric.


🏗️ Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    Clerk Web Interface                       │
│              (React + TailwindCSS + shadcn/ui)              │
└───────────────────────┬─────────────────────────────────────┘
                        │ HTTPS/JWT
┌───────────────────────▼─────────────────────────────────────┐
│                   Backend API Server                         │
│              (Node.js + Express + Fabric SDK)               │
└───────────────────────┬─────────────────────────────────────┘
                        │ gRPC
┌───────────────────────▼─────────────────────────────────────┐
│              Hyperledger Fabric Network                      │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │   Registry   │  │   Surveyor   │  │   Auditor    │     │
│  │  Authority   │  │     Node     │  │     Node     │     │
│  │  (Peer+CA)   │  │  (Peer+CA)   │  │  (Peer+CA)   │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐  │
│  │         TitleContract Smart Contract                  │  │
│  │  - mintTitle()                                        │  │
│  │  - updateStatus()                                     │  │
│  │  - viewTitle()                                        │  │
│  │  - transferTitle()                                    │  │
│  └──────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘

🎯 Features

Blockchain Layer

  • Private Permissioned Network: Hyperledger Fabric 2.5
  • Role-Based Access Control (RBAC):
    • Registry Authority: Mint and manage titles
    • Surveyor: Verify GPS coordinates
    • Auditor: Read-only access
  • Smart Contract: TitleContract with complete CRUD operations
  • Immutable Ledger: Tamper-proof record storage

Digital Title Structure

{
  "propertyID": "UUID",
  "gpsCoordinates": {
    "lat": "12.9716",
    "long": "77.5946"
  },
  "ownerID": "verifiedID",
  "ownerName": "John Doe",
  "area": "2500 sqft",
  "status": "Active | Under_Transfer | Revoked",
  "timestamp": "2025-11-01T11:25:53+05:30",
  "signature": "hash",
  "surveyorVerified": true,
  "documents": []
}

Clerk's Web Interface

  • Secure Authentication: JWT-based with role management
  • Dashboard: Overview of all titles and recent activity
  • Title Management: Create, view, update, and transfer titles
  • GPS Verification: Interactive map with coordinate validation
  • Search & Filter: Advanced querying capabilities
  • Audit Trail: Complete transaction history

🚀 Quick Start

Prerequisites

  • Docker 20.10+
  • Docker Compose 2.0+
  • Node.js 18+
  • npm or yarn

Installation

  1. Clone and Navigate
cd c:\Users\Dev Patel\Desktop\INTER_R2
  1. Install Dependencies
# Backend
cd backend
npm install

# Frontend
cd ../frontend
npm install
  1. Start Blockchain Network
cd ../blockchain
./network.sh up
  1. Deploy Smart Contract
./network.sh deployCC
  1. Start Backend API
cd ../backend
npm run dev
  1. Start Frontend
cd ../frontend
npm run dev
  1. Access Application

Default Credentials

Registry Authority:
  Username: admin@registry.vault
  Password: admin123

Surveyor:
  Username: surveyor@vault.com
  Password: surveyor123

Auditor:
  Username: auditor@vault.com
  Password: auditor123

📁 Project Structure

INTER_R2/
├── blockchain/                 # Hyperledger Fabric network
│   ├── network.sh             # Network management script
│   ├── docker-compose.yml     # Container orchestration
│   ├── configtx.yaml          # Channel configuration
│   ├── crypto-config.yaml     # Certificate generation
│   ├── chaincode/             # Smart contracts
│   │   └── title-contract/    # TitleContract implementation
│   └── organizations/         # Network organizations
├── backend/                   # Node.js API server
│   ├── src/
│   │   ├── controllers/       # Request handlers
│   │   ├── middleware/        # Auth, validation
│   │   ├── routes/            # API endpoints
│   │   ├── services/          # Blockchain interaction
│   │   └── utils/             # Helpers
│   ├── tests/                 # Unit & integration tests
│   ├── package.json
│   └── .env.example
├── frontend/                  # React web interface
│   ├── src/
│   │   ├── components/        # UI components
│   │   ├── pages/             # Route pages
│   │   ├── services/          # API clients
│   │   ├── hooks/             # Custom hooks
│   │   └── utils/             # Utilities
│   ├── public/
│   ├── package.json
│   └── tailwind.config.js
├── kubernetes/                # K8s deployment configs
│   ├── namespace.yaml
│   ├── blockchain-deployment.yaml
│   ├── backend-deployment.yaml
│   └── frontend-deployment.yaml
├── docs/                      # Documentation
│   ├── ARCHITECTURE.md
│   ├── API.md
│   ├── SMART_CONTRACT.md
│   └── DEPLOYMENT.md
├── scripts/                   # Utility scripts
│   ├── setup.sh
│   ├── demo-transaction.js
│   └── test-all.sh
└── README.md

🧪 Testing

Run All Tests

npm run test:all

Unit Tests

# Backend
cd backend
npm test

# Smart Contract
cd ../blockchain/chaincode/title-contract
npm test

Integration Tests

cd backend
npm run test:integration

Demo Transaction

node scripts/demo-transaction.js

🔒 Security Features

  1. TLS Encryption: All network communication encrypted
  2. JWT Authentication: Secure API access with token expiration
  3. Role-Based Access Control: Granular permissions
  4. Digital Signatures: All transactions cryptographically signed
  5. Immutable Audit Log: Complete transaction history
  6. Environment Variables: Sensitive data in .env files
  7. Certificate-Based Identity: Fabric CA for identity management

📚 API Documentation

Authentication

POST /api/auth/login
Content-Type: application/json

{
  "email": "admin@registry.vault",
  "password": "admin123"
}

Mint Title

POST /api/titles
Authorization: Bearer <token>
Content-Type: application/json

{
  "gpsCoordinates": {"lat": "12.9716", "long": "77.5946"},
  "ownerID": "OWNER123",
  "ownerName": "John Doe",
  "area": "2500 sqft"
}

View Title

GET /api/titles/:propertyID
Authorization: Bearer <token>

Update Status

PATCH /api/titles/:propertyID/status
Authorization: Bearer <token>
Content-Type: application/json

{
  "status": "Under_Transfer"
}

Full API documentation: docs/API.md


🐳 Docker Deployment

Using Docker Compose

docker-compose up -d

Using Kubernetes

kubectl apply -f kubernetes/

📊 Monitoring & Logs

View Blockchain Logs

docker logs -f peer0.registry.vault.com

View Backend Logs

docker logs -f digital-vault-backend

View All Services

docker-compose logs -f

🛠️ Development

Environment Variables

Create .env files in backend and frontend directories:

backend/.env

PORT=5000
NODE_ENV=development
JWT_SECRET=your-secret-key-change-in-production
JWT_EXPIRE=24h
FABRIC_NETWORK_PATH=../blockchain/network
CHANNEL_NAME=landregistry
CHAINCODE_NAME=titlecontract

frontend/.env

VITE_API_URL=http://localhost:5000
VITE_MAP_API_KEY=your-map-api-key

🤝 Contributing

This is an MVP for Phase 1. Future phases will include:

  • Public blockchain integration
  • Mobile application
  • Advanced analytics
  • Multi-signature approvals
  • Document storage (IPFS)

📄 License

MIT License - See LICENSE file for details


🆘 Troubleshooting

Network Won't Start

cd blockchain
./network.sh down
docker system prune -a
./network.sh up

Smart Contract Deployment Failed

./network.sh deployCC -ccn titlecontract -ccp ./chaincode/title-contract -ccl javascript

Port Already in Use

# Change ports in docker-compose.yml and .env files

📞 Support

For issues and questions, please refer to the documentation in the docs/ directory.


Built with ❤️ for secure land registry management

Releases

No releases published

Packages

 
 
 

Contributors

Languages