Blockchain-Based Decentralized Storage Design for Data Confidence Over Cloud-Native Edge Infrastructure
This project demonstrates a multi-step approach to securely store encrypted files, link their metadata on a private blockchain, and manage additional properties (e.g., attention/confidence labels) via a MongoDB-based service. It also includes a simple React front-end for uploading and retrieving files under specific rules. The project is based on Blockchain-Based Decentralized Storage Design for Data Confidence Over Cloud-Native Edge Infrastructure by Hannie Zang; Ho Kim; Jongwon Kim et al.
- Private Blockchain (Ganache + Smart Contract)
-
A local Ethereum-compatible blockchain using Ganache.
-
A
FileRegistrysmart contract storing minimal metadata on-chain (version, timestamp, hash reference, owner).
- Storage Backend (Node.js)
-
A Node/Express service that encrypts files and stores them either locally or on IPFS.
-
Exposes
/storeand/retrieveendpoints.
- Metadata Database (MongoDB)
-
Stores extended metadata (file location, access rights, attention/confidence labels).
-
A Node.js/Mongoose service providing CRUD on metadata.
- Front-End Demo (Vite + React + shadcn/ui)
- A basic React app to upload files with labels and retrieve them under the attention/confidence rule.
- Install Ganache:
npm install -g ganache
or download Ganache Desktop.
-
Start Ganache on
http://127.0.0.1:8545. -
Deploy the
FileRegistrycontract using Truffle or Hardhat:
truffle compile
truffle migrate --reset
- Install dependencies in
storage-service/:
cd storage-service
npm install
- blockchain.js references:
-
Ganache URL:
http://127.0.0.1:8545. -
Private Key: from an account in Ganache with enough ETH.
-
Contract Address: from the deployed
FileRegistry.
- Run the server:
node app.js
or
npm start
The service listens on http://localhost:3000.
-
Install MongoDB or use Mongo Atlas.
-
In
metadata-service/:
npm install
node app.js
or
npm start
- Environment:
-
Default connection is
mongodb://127.0.0.1:27017/metadata_db. -
Exposes endpoints like
GET /metadata/:fileId,POST /metadata.
- Install dependencies in
frontend/:
npm install
npm run dev
-
The app will run at
http://localhost:5173(default Vite). -
The front-end has:
-
A simple upload form pointing to
http://localhost:3000/store. -
A retrieval form pointing to
http://localhost:3000/retrieve/:fileId.
-
User selects a file in the front-end, provides
label,attention,confidence. -
The Front-End sends a
POST /storeto Storage Service. -
Storage Service:
-
Encrypts the file, stores it locally (or IPFS).
-
Calls the Metadata Service to save extended properties (label, dataLocation, etc.).
-
Calls the Blockchain (
FileRegistry) to store minimal references on-chain (fileId, version, hash).
- To Retrieve:
-
The front-end calls
GET /retrieve/:fileId. -
The storage service checks metadata, ensures
attention >= confidence, and if allowed, decrypts and returns the file.
- Upload with Postman or the React front-end:
curl -X POST -F "file=@test.pdf" \
-F "attention=Always" \
-F "confidence=Usually" \
http://localhost:3000/store
- Retrieve:
curl http://localhost:3000/retrieve/test.pdf --output test.pdf
or from the front-end retrieval form.