This project implements a fullstack solution for a Blockchain-Based Order Tracking System, developed as part of Group 30 in the Intelligent and Smart Supply Chain Management System project.
It includes:
- Hyperledger Fabric (blockchain ledger)
- IPFS (for decentralized file storage)
- Django REST Framework (backend API)
- Angular (frontend for order interaction)
blocktrack/
βββ blocktrack_backend/ # Django API project
β βββ api/ # Views and IPFS utils
β βββ manage.py
β βββ requirements.txt
βββ blocktrack_frontend/ # Angular frontend app
β βββ src/app/create-order/ # Order creation UI
β βββ src/app/read-order/ # Read order UI
β βββ angular.json
βββ chaincode-order/ # Go chaincode
β βββ order.go
βββ scripts/ # Shell automation scripts
β βββ invoke_order.sh
βββ README.md
Before running this project, ensure you have:
- β Docker
- β Hyperledger Fabric Samples
- β
IPFS Desktop or run
ipfs daemon - β Python 3.10+
- β Go (for chaincode)
- β Node.js + Angular CLI (for frontend)
git clone https://github.com/IASSCMS/Order-Tracking-BlockTrack.git
cd blocktrackFrom your Fabric samples directory:
curl -sSL https://bit.ly/2ysbOFE | bash -s -- -d -s
cd ./test-network
β Note: Adjust
-ccpif needed to point to yourchaincode-orderdirectory.
To make setup easier, weβve included a shell script: scripts/setup_chaincode.sh
- Brings down any existing Fabric network
- Starts the test network with 2 organizations (Org1 + Org2)
- Packages the chaincode
- Installs it on both peers
- Approves chaincode definition for both orgs
- Commits chaincode
- Ready for backend integration!
chmod +x scripts/setup_chaincode.sh
./scripts/setup_chaincode.sh
π Make sure you're inside the test-network directory before running the script.
---
### 3. Start IPFS
Run either:
```bash
# Option A
Open IPFS Desktop
# Option B
ipfs daemoncd blocktrack_backend
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
python manage.py runserverYou can use a script for invoking blockchain:
chmod +x scripts/invoke_order.shThe Django view will run this script with proper environment to interact with peer CLI.
cd blocktrack_frontend
npm install
ng serveOpen your browser at: http://localhost:4200
To start the database, use the provided docker-compose.yaml file:
cd blocktrack_backend
sudo docker-compose up -dThis will start the PostgreSQL database required for the backend.
Ensure the following environment variables are set for the backend:
DATABASE_NAME=blocktrack_db
DATABASE_USER=blocktrack_user
DATABASE_PASSWORD=securepassword
DATABASE_HOST=localhost
DATABASE_PORT=5432
SECRET_KEY=your_secret_key_here
DEBUG=True
ALLOWED_HOSTS=*Run the dummy.py as follows:
# On Linux/MacOS
python manage.py shell < dummy.py
# On Windows
python manage.py shell < dummy.pyRun the django app and visit /swagger to view the swagger-UI docs
| Route | Function |
|---|---|
/create-order |
Upload + register |
/read-order |
Search order ID |
Body: form-data
| Key | Type | Value |
|---|---|---|
| order_id | Text | order901 |
| status | Text | Packed |
| timestamp | Text | 2025-05-02T22:00:00Z |
| document | File | upload any file |
- Returns the blockchain order details in JSON.
Chaincode functions:
CreateOrder(ctx, id, status, timestamp, docHash)
ReadOrder(ctx, id)Each order is stored like:
{
"ID": "order901",
"Status": "Packed",
"Timestamp": "2025-05-02T22:00:00Z",
"DocumentHash": "Qm..."
}- Files uploaded in Create Order go to IPFS.
- CID is stored on blockchain.
- You can access documents at:
https://ipfs.io/ipfs/<CID>- Developed by Group 30 β Blockchain-Based Order Tracking
- Part of Group H: Intelligent and Smart Supply Chain Management System
- Frontend + Backend + Chaincode fully working