Developed a blockchain-enabled secure file storage and transfer system using FastAPI, Streamlit, MongoDB, and IPFS, implementing AES-256-GCM encryption, SHA-256 hashing, and JWT authentication for secure file management.
SecureChain is a secure file storage and transfer application that combines Blockchain, IPFS (InterPlanetary File System), and AES-256 encryption to provide secure, decentralized, and tamper-resistant file sharing.
Instead of storing files directly on a centralized server, SecureChain encrypts files, uploads the encrypted data to IPFS, and stores the file metadata and integrity information in a blockchain-based transaction ledger.
- User Registration and Login
- JWT Authentication
- AES-256 File Encryption
- Secure File Upload
- IPFS Distributed Storage
- SHA-256 File Integrity Verification
- Blockchain Transaction Logging
- Secure File Download
- File Transfer Between Users
- MongoDB Database Integration
- FastAPI Backend
- Streamlit Frontend
- Streamlit
- HTML/CSS (Streamlit Components)
- FastAPI
- Python
- MongoDB
- Custom Blockchain Ledger
- IPFS (Kubo)
- AES-256 GCM
- SHA-256 Hashing
SecureChain/
│
├── backend/
│ ├── main.py
│ ├── auth.py
│ ├── db.py
│ ├── ipfs.py
│ └── blockchain/
│ └── chain.py
│
├── encryption/
│ └── aes.py
│
├── hashing/
│ └── sha256.py
│
├── frontend/
│ └── app.py
│
├── requirements.txt
├── README.md
└── .env
User
│
▼
Streamlit Frontend
│
▼
FastAPI Backend
│
├──────── Encrypt File (AES-256)
│
├──────── Generate SHA-256 Hash
│
├──────── Upload Encrypted File to IPFS
│
├──────── Store Metadata in MongoDB
│
└──────── Record Blockchain Transaction
Install the following software before running the project.
- Python 3.10 or later
- Git
- MongoDB Community Server
- IPFS Kubo
- Streamlit
- FastAPI
git clone https://github.com/<your-username>/SecureChain.git
cd SecureChainWindows
python -m venv .venvActivate
Command Prompt
.venv\Scripts\activatePowerShell
.venv\Scripts\Activate.ps1pip install -r requirements.txtStart MongoDB.
mongodOpen another terminal.
mongoshDownload and install IPFS Kubo.
Initialize IPFS.
ipfs initStart the daemon.
ipfs daemonWait until you see:
Daemon is ready
Create a file named .env.
Example:
MONGO_URI=mongodb://localhost:27017
SECRET_KEY=your_secret_key
ACCESS_TOKEN_EXPIRE_MINUTES=60uvicorn backend.main:app --reloadOpen
http://127.0.0.1:8000/docs
The FastAPI Swagger interface should load.
Open a new terminal.
streamlit run frontend/app.pyThe application opens in your browser.
Create a new account.
Example
Username: demo
Password: demo123
Login using your credentials.
A JWT access token is generated for authenticated requests.
Choose a file.
During upload SecureChain:
- Reads the file.
- Generates a SHA-256 hash.
- Encrypts the file using AES-256 GCM.
- Uploads the encrypted file to IPFS.
- Receives an IPFS CID.
- Stores metadata in MongoDB.
- Records the transaction in the blockchain ledger.
The upload response includes:
- Filename
- File Hash
- CID
- Block Hash
- Previous Hash
Provide:
- CID
- Encryption Key
- Nonce
- Authentication Tag
The system:
- Downloads encrypted data from IPFS.
- Decrypts the file.
- Verifies the SHA-256 hash.
- Returns the original file.
Enter:
- Receiver
- CID
- Encryption Key
- Nonce
- Tag
A blockchain transaction is recorded.
| Method | Endpoint | Description |
|---|---|---|
| POST | /register |
Register a user |
| POST | /login |
Login and receive a JWT |
| POST | /upload |
Upload an encrypted file |
| POST | /download |
Download and decrypt a file |
| POST | /transfer |
Transfer a file |
| GET | /transactions |
View blockchain transaction history |
username
password
type
user
filename
hash
cid
timestamp
previous_hash
block_hash
sender
receiver
filename
cid
timestamp
- AES-256 GCM Encryption
- SHA-256 Integrity Verification
- JWT Authentication
- Blockchain Audit Trail
- IPFS Distributed Storage
- Tamper Detection
- Smart Contract Integration
- MetaMask Authentication
- Role-Based Access Control
- AI-Based Threat Detection
- File Versioning
- Multi-Factor Authentication
- Email Notifications
- Cloud Deployment
- Docker Support
Add screenshots for:
- Login Page
- Dashboard
- Upload Screen
- Download Screen
- Blockchain Transactions
- MongoDB Collections
- FastAPI Swagger UI
Divakar V S
MCA (Cybersecurity)
Python Developer | Blockchain Enthusiast | AI & Secure Software Development
GitHub: https://github.com/Divakar-vs