eVault
Blockchain-backed legal document storage.
Overview
A blockchain-powered application for tamper-proof storage of legal documents, built on IPFS and smart contracts. Built for Smart India Hackathon 2023.
eVault was a document vault for legal records, built for Smart India Hackathon 2023. The repo and the app's own interface call it Legal Ledger. It had a login and sign-up flow, a wallet-connect button, an upload page that stored files on IPFS, and a dashboard listing case records.
It was built as a team project. I worked on the frontend and some of the backend.
Why I built it
It was a hackathon entry. A legal record management systems in India face challenges around security, transparency and accessibility, and the team's aim was a blockchain-based eVault for legal records that could be securely stored and transparently shared.
I built it with a team from my college, and I was new to blockchain at the time. The juniors on the team guided me on that side, so most of my own work went into the frontend and backend.
Architecture and how it works
The project had two parts in one repository.
- Frontend: a Next.js app (pages router) in TypeScript, styled with Tailwind CSS and shadcn/ui components. Wallet connection used RainbowKit and wagmi on the Polygon Mumbai test network.
- Backend: an Express API in Node.js and TypeScript with sign-up, login and profile routes, backed by PostgreSQL. Requests were validated with yup, passwords were hashed with bcrypt, and sessions used JWT access and refresh tokens. Helmet, CORS and Winston logging were part of the setup.
- Storage: the upload page sent the file, name and description straight from the browser to NFT.Storage, which stored them on IPFS.
Workflow
- A visitor lands on the home page and signs up or logs in with an email and password.
- On login, the Express API returns tokens. A small Next.js API route saves them as httpOnly cookies, and the protected pages redirect to the login page when those cookies are missing.
- On the upload page, the user enters a case file name, a description and picks a file. The file goes to IPFS through NFT.Storage.
- The resulting IPFS metadata link is kept in the browser's local storage, and the dashboard shows records in a table of case name, description and a link to the file.
- A profile page and a wallet-connect button sit in the navigation.
Challenges and insights
The team's own README names two problems.
- Where to store files. The team had to decide how to store files on a blockchain-based stack, and weighed IPFS against another option.
- Making uploads private to a user. Even after a user logged out, anyone who had a file's hash could still retrieve the document. The team tried to work around this by manipulating metadata.
Some trade-offs of building against a deadline:
- Wallet connection and email-and-password login ran side by side.
- The dashboard's protected pages checked that login cookies existed before redirecting.
- Some pages, including the profile page, were still placeholders.
What I learned
- Hash-addressed storage is public by design, so "who can retrieve a document" has to be solved separately from "where it is stored."
- Combining a wallet-based layer with a conventional login, as the code shows, is a design decision that has to be made on purpose rather than left to overlap.
- Starting from boilerplate and moving fast is fine for a hackathon, but unfinished parts show up quickly in a demo.
If I started today (suggestions)
- Encrypt files in the browser before uploading, so the hash alone doesn't expose the document.
- Record which user owns which file hash in the database, and check ownership on every retrieval.
- Verify the JWT on the server before serving protected pages, not just check that a cookie is present.
- Treat the presentation as its own deliverable, with a demo script and a rehearsal.
Timeline and outcomes
We started on 8 September 2023, and the last was on 30 December 2023. The project ran from September to December 2023.
It didn't advance through the SIH rounds. My own read is that the implementation held up, but our presentation didn't. We spent our effort on the technology and not enough on how we presented it. I could have done more to guide my juniors on that, or worked on it with them. The repository is now archived.