A blockchain-based healthcare management system built with Soroban smart contracts on the Stellar network, enabling secure, transparent, and efficient healthcare data management.
This decentralized healthcare system leverages Stellar's Soroban smart contracts to provide a trustless, HIPAA-compliant solution for managing electronic health records (EHR), patient data, medical appointments, and healthcare provider interactions. The system ensures data privacy, interoperability, and patient sovereignty over personal health information.
- Patient Data Sovereignty: Patients maintain complete control over their health records with cryptographic access management
- Secure Health Records: Encrypted storage of medical records with granular permission controls
- Provider Verification: Blockchain-based credential verification for healthcare providers
- Appointment Management: Decentralized scheduling and management of medical appointments
- Medical History Tracking: Immutable audit trail of all medical interactions and treatments
- Insurance Integration: Smart contract-based claims processing and verification
- Prescription Management: Secure digital prescription issuance and tracking
- Consent Management: Patient-controlled data sharing with healthcare providers and institutions
The system consists of multiple interconnected Soroban smart contracts:
patient_registry.rs- Patient identity and profile managementprovider_registry.rs- Healthcare provider credentials and verificationhealth_records.rs- Electronic health record storage and access controlappointments.rs- Appointment scheduling and managementprescriptions.rs- Digital prescription issuance and pharmacy verificationinsurance_claims.rs- Automated claims processing and settlementconsent_manager.rs- Patient consent and data sharing permissions
- Blockchain: Stellar Network
- Smart Contracts: Soroban (Rust-based)
- Development Framework: Soroban SDK
- Testing: Soroban Test Framework
- Deployment: Stellar CLI
Before you begin, ensure you have the following installed:
- Rust (1.74.0 or later)
- Soroban CLI
- Stellar CLI
- Node.js (18.x or later) - for frontend integration
- Docker (optional, for local Stellar network)
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install Soroban CLI
cargo install --locked soroban-cli
# Install Stellar CLI
cargo install --locked stellar-cli- Clone the repository:
git clone https://github.com/yourusername/stellar-healthcare-system.git
cd stellar-healthcare-system- Install dependencies:
cargo build- Configure your environment:
cp .env.example .env
# Edit .env with your configurationCreate a .env file in the root directory:
STELLAR_NETWORK=testnet
SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
ADMIN_SECRET_KEY=your_secret_key_here
CONTRACT_WASM_HASH=your_contract_hash- Start a local Stellar network:
stellar network start local- Build the smart contracts:
soroban contract build- Deploy to local network:
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/patient_registry.wasm \
--source admin \
--network local- Build optimized contracts:
soroban contract optimize --wasm target/wasm32-unknown-unknown/release/patient_registry.wasm- Deploy to Stellar Testnet:
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/patient_registry.optimized.wasm \
--source admin \
--network testnet- Initialize contracts:
soroban contract invoke \
--id <CONTRACT_ID> \
--source admin \
--network testnet \
-- initialize \
--admin <ADMIN_ADDRESS>soroban contract invoke \
--id <PATIENT_REGISTRY_CONTRACT> \
--source patient \
--network testnet \
-- register_patient \
--patient_id "P12345" \
--name "John Doe" \
--dob "1990-01-01" \
--encrypted_data <ENCRYPTED_HEALTH_DATA>soroban contract invoke \
--id <PROVIDER_REGISTRY_CONTRACT> \
--source provider \
--network testnet \
-- register_provider \
--provider_id "DR001" \
--name "Dr. Jane Smith" \
--specialty "Cardiology" \
--credentials <CREDENTIAL_HASH>soroban contract invoke \
--id <HOSPITAL_REGISTRY_CONTRACT> \
--source hospital \
--network testnet \
-- register_hospital \
--wallet <HOSPITAL_WALLET> \
--name "Regional Medical Center" \
--location "789 Pine Rd" \
--metadata "Accredited, trauma level II"soroban contract invoke \
--id <HOSPITAL_REGISTRY_CONTRACT> \
--source hospital \
--network testnet \
-- set_hospital_config \
--wallet <HOSPITAL_WALLET> \
--config <CONFIG_XDR>soroban contract invoke \
--id <CONSENT_MANAGER_CONTRACT> \
--source patient \
--network testnet \
-- grant_access \
--patient_id "P12345" \
--provider_id "DR001" \
--duration_days 30 \
--access_level "read"Run the complete test suite:
cargo testRun specific test modules:
cargo test patient_registry
cargo test health_recordsRun integration tests:
cargo test --test integration_tests