Blockchain-based File Integrity Verification System SHA-256 · Proof-of-Work · IPFS via Pinata · Multi-user Authentication · MetaMask Wallet Login
Built by Subham Mishra B.Tech CSE (AI/ML) — Centurion University of Technology and Management
BlockVerify lets you register any file (image, document, ML model) into a blockchain. Each file is hashed with SHA-256, mined into a block using Proof-of-Work, and stored on IPFS via Pinata. Anyone can later verify whether a file has been tampered with by checking its hash against the chain.
- 🔐 Multi-user login & signup — anyone can create an account
- 🦊 MetaMask wallet login — Sign-In with Ethereum on Sepolia Testnet
- 👤 Per-user file registry — each user sees only their own files
- ⛏ Proof-of-Work mining — difficulty 4 (hash must start with
0000) - 🔒 SHA-256 hashing — content-based, not filename-based
- 🌐 IPFS storage via Pinata — decentralized blockchain persistence
- ⬇ File download — download your registered files anytime
- 🗑 File deletion — remove files from your account
- 🛡 Admin panel — separate admin login with full user management
- 📊 Chain explorer — view all blocks with validity check
blockchain_iris_project/
│
├── app.py ← Flask routes only
├── blockchain.py ← Block + Blockchain classes with PoW
├── hash_utils.py ← SHA-256 hashing + file type detection
├── pinata_utils.py ← Pinata IPFS integration
├── train_model.py ← Iris model trainer
├── iris_model.joblib ← Trained ML model
├── requirements.txt ← Python dependencies
├── .env ← API keys (never commit this)
├── templates/
│ ├── index.html ← Main app HTML
│ └── admin.html ← Admin panel HTML
├── static/
│ ├── css/
│ │ ├── main.css ← Main app styles
│ │ └── admin.css ← Admin styles
│ └── js/
│ ├── main.js ← Main app JavaScript
│ └── admin.js ← Admin JavaScript
├── users.json ← Auto-created on first signup
├── uploaded_files/ ← Auto-created file storage
└── README.md
git clone https://github.com/subham23s/BLOCK-VERIFIER.git
cd BLOCK-VERIFIERpython -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # Linux/Macpip install -r requirements.txt- Create a free account at pinata.cloud
- Go to API Keys → Generate new key
- Copy your API Key and Secret Key
PINATA_API_KEY=your_pinata_api_key_here
PINATA_SECRET_KEY=your_pinata_secret_key_here
ADMIN_USERNAME=your_admin_username
ADMIN_PASSWORD=your_admin_password
python app.pyBrowser opens automatically at http://127.0.0.1:5000
- Open
http://127.0.0.1:5000 - Sign Up with username and password — or connect MetaMask wallet
- Register tab — drop any file to register it on the blockchain
- Verify tab — drop a file to check if it has been tampered with
- My Files tab — view, download, or delete your registered files
- Chain tab — explore all blocks in the blockchain
- Click Connect MetaMask Wallet on the login page
- MetaMask auto-switches to Sepolia Testnet
- Sign the challenge message (no ETH spent)
- First time — choose a display name
- Returning — logs in instantly
Login from the main page with admin credentials set in .env — automatically redirects to the admin panel at /admin.
Admin can:
- View all registered users and their files
- Delete user accounts
- Update Pinata API keys
- Change admin password
File Upload
↓
SHA-256 Hash (content-based fingerprint)
↓
Proof-of-Work Mining (find nonce so hash starts with "0000")
↓
Block added to Blockchain
↓
Chain saved to IPFS via Pinata (get CID)
↓
File stored in uploaded_files/<hash>/
↓
User's file list updated in users.json
Upload file
↓
Compute SHA-256 hash
↓
Search blockchain for matching hash
↓
✅ Found = File is intact
❌ Not found = File tampered or not registered
User accounts (username, hashed password, file list) are stored locally in users.json. This is ideal for college demos and small deployments. For large-scale public deployment, this can be migrated to Firebase Firestore.
| Layer | Technology |
|---|---|
| Backend | Python, Flask |
| Blockchain | Custom implementation (SHA-256 + PoW) |
| Storage | IPFS via Pinata |
| Frontend | HTML, CSS, Vanilla JS |
| Auth | Flask Sessions + SHA-256 + MetaMask SIWE |
| User Store | Local JSON file |
| ML Model | Scikit-learn (Iris dataset) |
| Method | Endpoint | Description |
|---|---|---|
| POST | /signup |
Create new account |
| POST | /login |
Login (redirects admin to /admin) |
| POST | /logout |
Logout and clear session |
| POST | /wallet/challenge |
Get challenge for MetaMask signing |
| POST | /wallet/verify |
Verify wallet signature |
| POST | /wallet/register |
Register new wallet user |
| POST | /register |
Register a file on blockchain |
| POST | /verify |
Verify file integrity |
| GET | /my_files |
Get logged-in user's files |
| GET | /download/<hash> |
Download a registered file |
| POST | /delete_file |
Remove file from account |
| GET | /chain |
Get full blockchain data |
| GET | /pinata_status |
Check Pinata connection |
| GET | /admin |
Admin panel |
| GET | /admin/users |
Get all users (admin only) |
| POST | /admin/config |
Update Pinata keys (admin only) |
venv/
.env
users.json
uploaded_files/
firebase_key.json
__pycache__/
*.joblib
latest_cid.txt
MIT License — © 2025 Subham Mishra