Your records are scattered. The jargon is confusing. You're scared to upload them anywhere. MediVault fixes all three β privately, permanently, on-chain.
π Live App Β Β·Β
"The only Zero Cup project where your encryption key never leaves your device β and the only working health vault with a live smart contract on 0G Mainnet implementing ERC-7857 iNFT."
| Item | Details |
|---|---|
| π MediVaultRegistry Contract | 0x4E3D3450dc98D3022Ac299D0Ed7AFf80Bd58FA4f |
| π€ Standard | ERC-7857 Agentic iNFT β 0G Docs |
| π Network | 0G Mainnet β Chain ID 16661 |
| π Block Explorer | View on chainscan.0g.ai |
| β½ Live Health Endpoint | /api/og/health β live block + node count |
| β Record Verifier | /verify β 4-check root hash verification |
Every MediVault user mints an ERC-7857 Intelligent NFT (iNFT) on
MediVaultRegistry. Your vault is a full Agentic ID β encrypted metadata anchored on 0G Mainnet, verifiable by anyone, owned by no one but you.
ERC-7857 is 0G Labs' flagship standard for Intelligent NFTs with private encrypted metadata. MediVault is the first healthcare application of ERC-7857:
| ERC-7857 Feature | MediVault Healthcare Use |
|---|---|
dataHash β encrypted metadata hash |
Keccak256 of your AES-256 encrypted health record set on 0G Storage |
sealedKey β key sealed to owner pubkey |
Your AES-256 vault key encrypted with your wallet's ECIES public key. Stored on-chain. |
oracle β TEE/ZKP proof verifier |
MediVault oracle verifies re-encryption proofs (TEE-backed, bypassable in demo) |
authorizeUsage() β grant access without transfer |
Patient grants doctor wallet access with a new sealedKey scoped to their pubkey β no ownership change |
revokeUsage() β revoke access |
Patient instantly revokes a doctor's decryption key on-chain |
clone() β wallet migration |
Patient migrates vault to new wallet with oracle-verified re-encryption |
transfer() β oracle-verified ownership transfer |
Full wallet transfer with TEE/ZKP proof of correct metadata re-encryption |
// Grant a doctor access to your vault (no ownership transfer)
mediVaultRegistry.authorizeUsage(
tokenId,
doctorWallet,
abi.encode(sealedKeyForDoctor, expiry, recordScope)
);
// Doctor retrieves their sealed key
bytes memory permissions = mediVaultRegistry.getExecutorPermissions(tokenId, doctorWallet);
(bytes memory sealedKey, uint256 expiry, bytes32[] memory scope) = abi.decode(permissions, (bytes, uint256, bytes32[]));
// Doctor decrypts with their private key β reads shared recordsUpload any medical document β AI explains it in plain language β AES-256 encrypted in your browser β stored permanently on 0G
Every record is verifiable on-chain β 4 live checks against 0G Network: chain live β Β· file found β Β· hash valid β Β· explorer confirmed β
π Try it yourself: medivault-ecru.vercel.app/verify
|
Landing Page Hero β "Your health history, cryptographically yours" |
Vault Dashboard All records, encrypted & indexed on 0G-KV |
|
AI Summary Plain-language explanation via 0G Compute |
Doctor Sharing + QR ERC-7857 authorizeUsage β ECIES-encrypted share + emergency QR card |
|
Landing |
Vault |
AI Summary |
QR Scanner |
π² MediVault is a PWA β install it from your browser on iOS or Android. No app store. No account. Just your wallet.
Medical records are the most important documents a person owns β yet they're the worst managed.
| Pain point | Reality today |
|---|---|
| π Scattered | Spread across clinic portals, PDFs, emails, and paper printouts |
| π΅ Confusing | Written in dense medical jargon most patients can't parse |
| π° Risky to store | Uploading to Google Drive or a random app means trusting a company forever |
| π« Unshareable | No secure, instant way to hand a record to a new doctor |
| π Owned by others | Hospitals and labs hold your data β you just get access when they feel like it |
Every year, patients arrive at emergency rooms unable to recall their medications, allergies, or prior diagnoses β because their records are scattered across systems they don't control.
MediVault is a self-sovereign health vault. Connect your MetaMask wallet β that's your identity, your key, your vault.
π‘ Unlike generic document tools or clinical scribes β MediVault is 100% patient-owned. No doctor, no hospital, no company can access your records. Only your wallet key decrypts them β unless you explicitly call
authorizeUsage()to grant access.
Upload any document β AI explains it in plain language
β AES-256 encrypted in your browser
β Stored on 0G Network permanently
β ERC-7857 iNFT minted β yours forever
| Step | Action | What happens |
|---|---|---|
| 1οΈβ£ | Connect wallet | MetaMask signs a fixed message β MediVault derives a deterministic AES-256 key in your browser. The key never leaves your device. |
| 2οΈβ£ | Upload a document | Drop any PDF, image, or lab report. pdf-parse + tesseract.js OCR handles all formats client-side. |
| 3οΈβ£ | AI explains it | 0G Compute returns a plain-language summary, extracts conditions / medications / allergies / red flags, and flags anything urgent. |
| 4οΈβ£ | Encrypt & store | AES-256 ciphertext uploaded to 0G Storage. Merkle root hash indexed in 0G-KV. Your server never sees plaintext. |
| 5οΈβ£ | Mint ERC-7857 iNFT | MediVaultRegistry mints an Agentic iNFT β dataHash anchors your encrypted vault, sealedKey stores your vault key on-chain, sealed to your wallet pubkey. |
| Feature | Details |
|---|---|
| Wallet-native identity | Connect MetaMask β AES-256 key derived in-browser from wallet signature. Zero passwords. Zero email. Zero accounts. |
| Client-side AES-256 encryption | Every file is encrypted in your browser before upload. 0G Storage only ever receives ciphertext β the server has zero knowledge of your health data. |
| ERC-7857 sealedKey on-chain | Your vault's AES-256 key is sealed to your ECIES public key and stored in the iNFT β you can always recover it from your wallet. |
| ECIES doctor sharing | Share any record to a doctor's wallet address with Elliptic Curve Integrated Encryption. Only the recipient's private key can open it β zero server relay. |
authorizeUsage() doctor access |
Grant a doctor on-chain access via ERC-7857. Their sealed key is scoped to specific records and an expiry. Revokable instantly. |
| No recovery by design | Your wallet = your vault. No backdoor, no admin override. This is a feature, not a bug. |
| Rate-limited APIs | Hybrid in-process + KV-backed rate limiter on all public endpoints to prevent abuse. |
| Feature | Details |
|---|---|
| Plain-language summaries | Dense lab panels and discharge summaries decoded into clear, human-readable explanations via 0G Compute β never a centralised cloud. |
| Smart extraction | Automatically extracts conditions, medications, allergies, dosages, and red flags from every uploaded document. |
| Urgency flagging | AI highlights anything that needs immediate attention β abnormal lab values, drug interactions, critical findings. |
| "Explain like I'm 5" toggle | Switch any summary to the simplest possible explanation. Great for patients without medical backgrounds. |
| Multi-language support | AI summaries available in multiple languages β your health data explained in the language you understand. |
| Vault-wide AI chat | Ask questions across your entire record history. "What medications have I been prescribed?" β AI cites the exact source document. |
| Feature | Details |
|---|---|
| Multi-format support | PDFs, images (JPG/PNG), scanned prescriptions, lab reports, discharge summaries β all handled with OCR + PDF parsing. |
| Health timeline | Chronological view of all your medical events across all uploaded records. See your entire health history at a glance. |
| Lab trend charts | Visualize lab values (blood sugar, cholesterol, haemoglobin, etc.) over time with reference range overlays. |
| Content-address deduplication | Re-upload the same document and MediVault recognises it by content hash β auto-merges, no duplicates, no wasted 0G storage. |
| Tamper-proof integrity | Every record has a Merkle root hash verifiable against 0G at any time. One click proves your record is unaltered. |
| Vault index on-chain | Record index anchored to 0G-KV β your entire vault can be rebuilt trustlessly from on-chain state. No server required. |
| Feature | Details |
|---|---|
| Emergency QR card | One-tap QR with blood type, allergies, and critical medications β scannable by any doctor, saveable to your phone lock screen. |
| Doctor handoff summary | One-click printable summary of your entire medical history β structured for healthcare providers, ready for any appointment. |
| Tamper-proof certificates | Generate a shareable certificate proving a record exists, is unaltered, and is anchored to 0G β verifiable by anyone, no account needed. |
| Consent ledger | Every share event is written to an immutable, hash-chained audit trail on 0G β who accessed what, and when. Forever. |
| Received records inbox | Doctors and family members can send ECIES-encrypted records directly to your wallet. Delivered to your received tab. |
| Feature | Details |
|---|---|
| Root hash verifier | Visit /verify β enter any record root hash β 4 live checks against 0G Network: chain live, file found, hash valid, explorer link. |
| On-chain vault proof | MediVaultRegistry.getVaultByAddress(wallet) returns root hash, record count, timestamps β verifiable by anyone. |
| ERC-7857 agent data | MediVaultRegistry.getAgentData(tokenId) returns dataHash, sealedKey, oracle β full iNFT metadata on-chain. |
| Selective disclosure proofs | Share cryptographic proof of a single field (e.g. "I am vaccinated") without revealing the full record. Verifiable by anyone at /verify. |
| 0G Health endpoint | GET /api/og/health β live JSON showing 0G chain block, storage node count, indexer status. |
| Feature | Details |
|---|---|
| PWA β install from browser | Add MediVault to your home screen on iOS or Android directly from the browser. No app store. Instant install. |
| Offline access | Service worker caches the app shell. Previously viewed records accessible from local encrypted cache even without internet. |
| QR scanner (mobile) | Scan shared health QR codes directly from the mobile app. Fixed to work with iOS Safari β using jsqr for cross-browser compatibility. |
| Mobile-first design | Responsive layout designed for one-hand use. Every feature accessible on a 375px screen. |
Every feature in MediVault depends on a specific 0G primitive. Remove 0G and the product cannot exist.
| What MediVault needs | 0G primitive | Without 0G |
|---|---|---|
| Permanent, censorship-resistant encrypted storage | 0G Storage β AES-256 ciphertext + Merkle root | No vault β nowhere to store ciphertext |
| Decentralised AI inference (no cloud snooping) | 0G Compute β OpenAI-compatible, TEE-backed | No AI summaries without trusting a centralised API |
| Tamper-proof record index per wallet | 0G-KV β key-value store keyed by wallet address | No trustless vault rebuild across devices |
| Immutable consent + share audit trail | 0G Chain β on-chain event log | No verifiable proof of who accessed what |
| Agentic iNFT with private encrypted metadata | ERC-7857 + MediVaultRegistry on 0G Mainnet | No Agentic ID β no on-chain sealed key recovery |
flowchart TD
U(["π€ User + MetaMask"]) -->|"sign fixed message"| K(["π AES-256 key β browser only"])
U -->|"upload document"| P(["π Parse + OCR"])
P -->|"pdf-parse / tesseract.js"| AI(["π§ 0G Compute"])
AI --> EX(["Extraction: conditions, meds, allergies, flags"])
EX --> ENC(["π Encrypt AES-256 in browser"])
P --> ENC
K --> ENC
ENC -->|"ciphertext only"| S(["0G Storage"])
S --> IDX(["0G-KV index"])
IDX -->|"Merkle root + dataHash + sealedKey"| REG(["π MediVaultRegistry\nERC-7857 iNFT\n0G Mainnet"])
IDX -->|"any device, any time"| V(["β
Vault"])
S -->|"ERC-7857 authorizeUsage()"| D(["π©ββοΈ Doctor's wallet"])
V -->|"share event"| CL(["0G Chain β consent ledger"])
Your wallet private key
β
βΌ
sign(fixedMessage) βββ AES-256 key βββ encrypts every record
β
ECIES-sealed to wallet pubkey
β
stored on-chain in ERC-7857 sealedKey
β
NEVER recoverable without your wallet
| Property | Guarantee |
|---|---|
| Zero-knowledge server | API routes process only ciphertext. Plaintext never touches the backend. |
| No recovery by design | Lose your wallet β lose your vault. No admin backdoor. This is the point. |
| ERC-7857 sealedKey | Your AES-256 key is sealed on-chain. Recoverable only by your wallet β not by MediVault, not by 0G, not by anyone. |
| Doctor access via oracle | authorizeUsage() grants a new sealed key scoped to one doctor's pubkey. Revokable instantly with revokeUsage(). |
| ECIES sharing | ethers.SigningKey.computePublicKey + SDK ECIES header. Only the recipient's private key decrypts. |
| Merkle root verification | Every record hash verifiable on-chain. Tampering is cryptographically impossible. |
| Soul-bound iNFT | Standard ERC-721 transfers blocked. Only ERC-7857 transfer() with oracle proof allowed. |
- MetaMask browser extension
- Node.js 18+
- A 0G Compute API key
git clone https://github.com/salch-cred/medivault
cd medivault
npm install
cp .env.example .env.local
# fill in your API keys (see Environment Variables below)
npm run dev
# β http://localhost:3000| Field | Value |
|---|---|
| Network name | 0G Mainnet |
| RPC URL | https://evmrpc.0g.ai |
| Chain ID | 16661 |
| Currency symbol | OG |
| Block explorer | https://chainscan.0g.ai |
Get free gas at faucet.0g.ai.
Server-side (secret β never exposed to browser):
| Variable | Description |
|---|---|
AI_API_KEY |
0G Compute Router API key |
AI_BASE_URL |
0G Compute base URL (default: https://router-api.0g.ai/v1) |
AI_MODEL |
Model ID served by 0G Compute |
Client-side (NEXT_PUBLIC_*):
| Variable | Description |
|---|---|
NEXT_PUBLIC_ZG_RPC_URL |
https://evmrpc.0g.ai |
NEXT_PUBLIC_ZG_INDEXER_RPC |
https://indexer-storage-turbo.0g.ai |
NEXT_PUBLIC_ZG_CHAIN_ID |
16661 |
NEXT_PUBLIC_ZG_FLOW_CONTRACT |
0G flow contract address |
NEXT_PUBLIC_ZG_KV_NODE_URL |
0G-KV node URL |
NEXT_PUBLIC_APP_URL |
Your deployed URL |
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID |
From cloud.reown.com |
NEXT_PUBLIC_MEDIVAULT_REGISTRY |
0x4E3D3450dc98D3022Ac299D0Ed7AFf80Bd58FA4f |
| Layer | Technology | Why |
|---|---|---|
| Framework | Next.js 14 (App Router) | SSR + API routes in one deploy |
| Blockchain | 0G Mainnet (chain 16661) via ethers v6 | Native 0G integration |
| Smart Contract | MediVaultRegistry β ERC-7857 Agentic iNFT on 0G Mainnet |
Agentic ID with encrypted metadata, doctor access, oracle verification |
| Storage | @0gfoundation/0g-storage-ts-sdk |
Decentralised ciphertext storage |
| AI inference | 0G Compute Router (OpenAI-compatible) | TEE-backed, no centralised cloud |
| Wallet | MetaMask + Web3Modal / WalletConnect | Universal Web3 wallet support |
| Encryption | AES-256 (v1) + ECIES (v2) via 0G SDK | Industry-standard, browser-native |
| OCR | tesseract.js (client-side) |
Scan handwritten prescriptions |
| PDF parsing | pdf-parse (server-side) |
Extract text from lab reports |
| QR scanning | jsqr (cross-browser, iOS Safari safe) |
No native API dependency |
| UI | Tailwind CSS + shadcn/ui + Framer Motion | Fast, accessible, animated |
| PWA | Service Worker + Web App Manifest | Offline-first, installable |
- Wallet-native identity + AES-256 client-side encryption
- 0G Storage upload + 0G-KV index
- 0G Compute AI summaries + smart extraction
- ECIES doctor sharing
- Emergency QR card + QR scanner (mobile fixed)
- Consent ledger on-chain
- PWA β installable, offline-ready
- Health timeline + lab trend charts
- Vault-wide AI chat
- Deployed on 0G Mainnet (chain 16661)
-
/verifyβ dual-tab verifier: root hash live check + selective disclosure proof token -
AGENTS.mdβ AI-readable project context -
SPEC.mdβ full product specification and architecture (500+ lines) -
PITCH.mdβ competition pitch document - GitHub topic tags for discoverability (9 tags)
- ERC-7857 Agentic iNFT β
MediVaultRegistryon 0G Mainnet0x4E3D3450dc98D3022Ac299D0Ed7AFf80Bd58FA4f - ERC-7857 v2 redeployed with
IAgentOracle,authorizeUsage(),revokeUsage(),clone(),ReentrancyGuard
- Shareable verified health record card (
/card/[hash]) with social preview - Selective-disclosure ZK proofs β prove one fact without revealing the full record
- MCP server β
@medivault/mcp-serverfor AI agent integrations - Lab value trend alerts β AI-triggered notifications for abnormal changes
- Native mobile app (React Native) with on-device camera capture
- 0G DA anchoring for ultra-low-cost bulk record archiving
- TEE oracle deployment for production ERC-7857 proof verification
MIT β see LICENSE
β οΈ MediVault explains and organizes your records. It is not medical advice. Always consult a qualified clinician.
Built with β€οΈ by Sahil & Sal for the 0G Zero Cup 2026
π Live App Β Β·Β








.png)
