Skip to content

Repository files navigation

⛓️ Blockchain File Storage

Python Flask Blockchain P2P

A decentralized peer-to-peer file storage system built on blockchain technology — ensuring file immutability, integrity, and confidentiality through cryptographic proof-of-work.

🐛 Report Bug · 💡 Request Feature


📋 Table of Contents

  • About
    • Features
      • How It Works
        • Tech Stack
          • Getting Started
            • Usage
              • Research Background
                • Limitations


                • 🔍 About

                  This project addresses the security vulnerabilities of centralized file storage by implementing a blockchain-based decentralized alternative. Files stored in this system benefit from the immutability and tamper-proof nature of blockchain — unauthorized modifications require consensus from the entire peer network, making silent alterations effectively impossible.

                  Originally developed as an undergraduate research project exploring blockchain's potential beyond cryptocurrency.


                  ✨ Features

                  • ⛓️ Blockchain Backbone — Each file storage operation forms a cryptographically linked block
                    • 🔨 Proof-of-Work (PoW) — Mining algorithm requiring hash values with 3 leading zeros (difficulty level 3)
                    • 🌐 P2P Network — Multiple peers participate in validating and storing data
                    • 🔒 Immutability — Once stored, files cannot be silently modified without full network consensus

                    • 🛡️ Data Integrity — Cryptographic hashes guarantee file authenticity

                    • ⚙️ How It Works

                      1. User uploads a file
                              │
                              ▼
                      2. File is hashed and packaged into a candidate block
                              │
                              ▼
                      3. Peer solves PoW puzzle (hash must start with "000")
                              │
                              ▼
                      4. Valid block is broadcast to all network peers
                              │
                              ▼
                      5. Peers validate and append to their local chains
                              │
                              ▼
                      6. File is now immutably stored across the network
                      

                      🛠️ Tech Stack

                      Layer Technology
                      Backend Python 3 · Flask
                      P2P Communication peer.py — custom peer networking
                      Frontend HTML / CSS
                      Consensus Proof-of-Work (custom implementation)
                      Version Control Git

                      🚀 Getting Started

                      Prerequisites

                    • Python 3.8+
                    • All dependencies listed in requirements.txt

                    • Installation

                    • git clone https://github.com/grammerpro/BlockchainFileStorage.git
                      cd BlockchainFileStorage
                      pip install -r requirements.txt

                      Running the Network

                      # Terminal 1 — Start the peer node
                      python peer.py
                      
                      # Terminal 2 — Start the web application
                      python run_app.py

                      Open the web interface in your browser and use it to upload, store, and retrieve files.


                      🔧 Usage

                      Once both processes are running, the Flask web interface allows you to:

                      1. Upload a file — Triggers the PoW mining process
                        1. View the blockchain — Inspect the chain of blocks and their hashes
                          1. Verify file integrity — Confirm a file hasn't been tampered with by checking its block hash


                          2. 📚 Research Background

                          3. This project was built to explore the following research question:

                          4. How can blockchain technology be leveraged to develop a secure and efficient file storage system, considering data integrity, accessibility, and cost-effectiveness?

                            Key findings from user surveys and analysis:

                          5. Users expressed significantly higher perceived security confidence with blockchain storage vs. centralized alternatives
                          6. The PoW mining mechanism successfully prevented unauthorized block insertions in testing

                          7. The decentralized model eliminates single points of failure inherent in cloud-only storage

                          8. ⚠️ Limitations

                          9. Scalability — PoW consensus is computationally intensive at scale; production systems would require optimized consensus mechanisms (PoS, PBFT)
                          10. Network Size — Tested on a small peer group; real-world performance with large networks is untested

                          11. Storage Efficiency — Full blockchain replication across peers increases storage footprint

                          12. 📄 License & Contact

                            Released under the MIT License.

                            Vardhan · vardhana1209@gmail.com · github.com/grammerpro

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages