-
Granular Chunking Dynamically divides files into at least 50 segments for fine-grained verification.
-
Secure Hashing Encodes each chunk in Base64 and hashes with SHA-256 for consistent, tamper-proof digests.
-
Merkle Tree Construction Recursively concatenates and hashes pairs of chunk hashes to compute a single Merkle root.
-
REST API
POST /uploadβ Accepts file upload, returns Merkle JSON and root hashPOST /verifyβ Accepts original file + Merkle JSON, returns verification report
-
Automatic Download Client-side download of generated Merkle JSON immediately after upload.
-
Detailed Reports Displays root match status, corrupted-chunk count, and corruption percentage.
-
CORS Enabled Seamless frontend-backend communication.
merkle-backend/
βββ index.js # Express server with file handling & Merkle logic
βββ MerkleTree.js # Merkle tree implementation
βββ uploads/ # Stored files & Merkle JSON outputs
merkle-frontend/
βββ src/
β βββ App.js # React component for upload & verification UI
βββ package.json # Frontend dependencies & scripts
- Node.js v14+
- npm (Node Package Manager)
- Git (optional)
cd path/to/merkle-backend
npm install
node index.jsServer runs on port 4000 by default.
cd path/to/merkle-frontend
npm install
npm startApp runs on port 3000 by default.
- Click Upload & Generate.
- File is chunked, hashed, and Merkle tree is built.
- Downloadable Merkle JSON appears; Merkle root is displayed.
-
Select Original File and Merkle JSON.
-
Click Verify.
-
View report:
- Root match (βοΈ / β)
- Corrupted chunks count
- Corruption percentage
-
Chunking: Ensures β₯50 chunks, even for small files.
-
Hashing: Base64-encode then SHA-256 hash each chunk.
-
Tree Build: Pairwise concatenate hashes; if odd, duplicate last.
-
API Endpoints:
/uploadhandles file β returns JSON + root/verifyhandles file + JSON β returns verification data
-
Static Hosting:
uploads/served for JSON retrieval. -
CORS: Configured in
index.js.
expressmultercorscrypto(built-in)
- React (via Create React App)
- Fetch API (native)
- Run
npm installin bothmerkle-backend/andmerkle-frontend/. - Confirm backend is listening on port 4000.
- Inspect browser console & server logs for errors.
- Verify correct file + Merkle JSON pairing.
MIT License. Contributions welcomeβplease open issues or PRs!