Skip to content

nadaamd/XRPL-Hackathon

Repository files navigation

MediFi on XRPL

Blockchain-based medical payments for patients who need care now, but cannot pay everything upfront.

MediFi is an XRPL-powered healthcare financing prototype that lets patients pay medical bills in installments while hospitals receive instant full payment through a liquidity provider layer.


🏥 Problem

In many developing countries, patients delay or skip treatment because of one simple barrier: upfront payment.

  • Healthcare costs are often too high to pay in a single transaction.
  • Families may have income, but not enough immediate liquidity.
  • Hospitals still need full settlement before delivering care.
  • Traditional credit access is slow, expensive, or unavailable.

💡 Solution

MediFi bridges that gap with a decentralized payment flow on XRPL:

  • Patients repay medical expenses in installments without interest.
  • Hospitals receive instant full payment.
  • Liquidity providers cover the upfront cost.
  • Borrowing eligibility is protected with Zero-Knowledge Proofs.
  • Identity is verified through the project’s IUD verification layer.

✨ Key Features

  • Patient installment payments with no interest.
  • Instant hospital settlement through XRPL-integrated payment logic.
  • Liquidity provider funding system for upfront treatment coverage.
  • Secure identity verification (IUD) before financing is approved.
  • Zero-Knowledge Proof flow for borrowing eligibility.
  • Vault system for fund management and controlled settlement.

🏗️ Architecture

The project is split into a web app, an API layer, and a ZK prover pipeline that handles private eligibility checks.

Patient Browser (Next.js / React)
        |
        v
Frontend UI + Identity Flow (IUD)
        |
        v
Backend API (Node.js / Express)
        |
        +--> XRPL Integration (payments, settlement, ledger checks)
        |
        +--> ZK Prover (RISC Zero zkVM)
        |
        +--> Vault / Liquidity Orchestration
        |
        v
Hospitals receive instant settlement
Liquidity providers absorb the upfront cost
Patients repay over time

Main layers

  • Frontend: React / Next.js interface for patients, hospitals, and liquidity providers.
  • Backend: API and business logic, including XRPL transaction orchestration.
  • XRPL: Payment rails for settlement and repayment tracking.
  • Vault mechanism: Manages liquidity and treatment funding flows.
  • ZK Proof layer: Generates and verifies proof of eligibility without exposing private data.

🔄 How It Works

  1. Patient logs in to the MediFi app.
  2. Identity verification (IUD) confirms the patient profile.
  3. ZK Proof validation checks borrowing eligibility privately.
  4. Liquidity provider funds the treatment amount.
  5. Hospital gets paid instantly in full.
  6. Patient repays over time in smaller installments.

🛠️ Tech Stack

  • XRPL for payment orchestration and settlement.
  • TypeScript for frontend and backend logic.
  • React / Next.js for the user interface.
  • Node.js / Express for the API layer.
  • RISC Zero zkVM for Zero-Knowledge Proof generation and verification.
  • xrpl SDK for ledger and payment integration.
  • zod and standard validation tooling for input safety.

⚙️ Installation & Setup

1) Clone the repository

git clone <your-repo-url>
cd <repo-folder>

2) Install JavaScript dependencies

pnpm install

3) Configure environment variables

Create a .env file at the repository root. You can start from .env.example and fill in your values.

cp .env.example .env

Minimum required variables:

PORT=3001
XRPL_NODE_URL=wss://s.altnet.rippletest.net:51233
PROTOCOL_WALLET_SEED=...
PROTOCOL_WALLET_ADDRESS=...
MLP_ISSUER_ADDRESS=...
NEXT_PUBLIC_BACKEND_URL=http://localhost:3001

4) Install Rust and RISC Zero tooling

The ZK prover depends on Rust and the RISC Zero toolchain.

curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
cargo install rzup --locked
rzup install rust
rzup install r0vm

5) Build the ZK prover

(cd XRPL-Hackathon/zk && cargo build -p medifi-zk-host --release)

6) Run the backend

source "$HOME/.cargo/env"
pnpm dlx tsx src/app.ts

7) Run the frontend

In a second terminal:

pnpm dev

🌍 Impact

MediFi is designed to make healthcare financing more inclusive and practical.

  • Financial inclusion: patients can access care without needing full upfront cash.
  • Access to healthcare: treatment is no longer blocked by immediate affordability.
  • Real-world DeFi utility: blockchain is used for a concrete, high-impact use case.
  • Transparency + privacy: XRPL settlement and ZK proofs help combine trust with confidentiality.

🔮 Future Improvements

  • Expand to more countries and currencies.
  • Integrate with real hospitals and clinical billing systems.
  • Improve risk models for borrowing eligibility.
  • Add richer liquidity provider analytics and vault controls.
  • Harden identity verification and on-chain auditability.

👥 Team

  • [Nada] - Technical aspects
  • [Sammie] - Pitch / Presentation

🏆 Hackathon Context

Built during an XRPL hackathon in about 36 hours, MediFi focuses on rapid prototyping, strong UX, and a real-world payment flow that can help unlock healthcare access with blockchain infrastructure.


🔗 Useful Commands

pnpm dev
pnpm dlx tsx src/app.ts
cd XRPL-Hackathon/zk && cargo build -p medifi-zk-host --release

📄 License

This project was created for hackathon/demo purposes. Add your preferred license before public release.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors