Skip to main content

Overview

Salud enables you to create and manage encrypted medical records stored on the Aleo blockchain. Each record is cryptographically secured, ensuring only you can view and share your health data.
All medical records are encrypted before leaving your browser and stored as private records on the Aleo blockchain.

How Medical Records Work

Medical records in Salud are built on Aleo’s privacy-preserving blockchain technology. Here’s what makes them secure:

Private by Default

Records are stored as private Aleo records - only you can decrypt and view them

Client-Side Encryption

Data is encrypted in your browser before reaching the blockchain

Permanent Storage

Records are permanently stored on Aleo blockchain with cryptographic integrity

Zero-Knowledge

Even the backend server cannot read your medical data

Record Structure

Each medical record contains the following information:
interface MedicalRecord {
  owner: address        // Your Aleo wallet address
  record_id: field      // Unique identifier (hash-based)
  data_hash: field      // Integrity verification hash
  data_part1-4: field   // Encrypted data segments (~126 bytes total)
  record_type: u8       // Category (1-10)
  created_at: u32       // Block height timestamp
  version: u8           // Schema version
}
Each record can store approximately 126 bytes of encrypted data. For larger records, data is automatically chunked across multiple record parts.

Record Types

Salud supports 10 different medical record categories:
General health checkups and assessments
Blood tests, urine analysis, and other lab work
Medication prescriptions and dosage information
X-rays, MRI, CT scans, and ultrasounds
Immunization records and vaccine history
Surgery records and post-operative notes
Psychological assessments and therapy notes
Dental examinations and treatments
Eye exams and vision prescriptions
Other medical records not covered by specific categories

Creating a Medical Record

From the UI

  1. Navigate to the My Records page
  2. Click the New Record button
  3. Fill in the record details:
    • Title: Brief description (e.g., “Annual Physical”)
    • Description: Detailed medical information
    • Record Type: Select from 10 categories
  4. Click Create Record
  5. Your record is encrypted and submitted to the blockchain
Record creation requires a small amount of Aleo credits for blockchain transaction fees. Make sure your wallet has sufficient balance.

Using the Contract

Records are created using the create_record transition:
async transition create_record(
    data_part1: field,
    data_part2: field,
    data_part3: field,
    data_part4: field,
    record_type: u8,
    data_hash: field,
    nonce: field,
    make_discoverable: bool
) -> (MedicalRecord, Future)
Parameters:
  • data_part1-4: Pre-encrypted medical data (client-side encryption)
  • record_type: Category of record (1-10)
  • data_hash: Hash of original data for integrity verification
  • nonce: Client-provided randomness for unique ID generation
  • make_discoverable: Whether to add to public index (optional)

Viewing Your Records

All your medical records are automatically synchronized from the blockchain when you connect your wallet.

Record List Features

Search

Search records by title or description

Filter by Type

Filter records by medical category

Grid or List View

Toggle between card grid or list layout

Auto-Sync

Records sync automatically from blockchain

Implementation Example

Here’s how records are fetched and displayed:
// From RecordsPage.tsx:56-69
if (!user?.isConnected) {
  return (
    <div className="space-y-6">
      <PageHeader
        title="My Records"
        description="Connect your wallet to view your medical records"
      />
      <EmptyState
        icon={<Wallet size={48} className="text-slate-300" />}
        title="Wallet Not Connected"
        description="Please connect your Aleo wallet to access your encrypted medical records securely."
      />
    </div>
  );
}

Record Synchronization

Records are fetched from the blockchain and synchronized locally:
  1. On Wallet Connect: All records are fetched from the blockchain
  2. Background Sync: Records automatically update every few minutes
  3. Manual Sync: Click the sync button to refresh immediately
  4. Local Cache: Records are cached in browser for faster access
// From RecordsPage.tsx:49-53
useEffect(() => {
  if (user?.address && canSync) {
    sync().catch(() => {});
  }
}, [user?.address, canSync, sync]);
Record synchronization may take 10-15 seconds as data is fetched from the Aleo blockchain.

Data Encryption

Medical records use multiple layers of encryption:

Client-Side Encryption

  1. Before Blockchain: Data is encrypted in your browser using your private key
  2. Field Elements: Encrypted data is split into Aleo field elements
  3. Integrity Hash: A hash is computed for data integrity verification

Privacy Model

Data TypeVisibilityPurpose
Medical RecordsPrivate (record)Only patient can view encrypted health data
Record MetadataOptional publicEnable discovery if user opts in
Data HashOn-chainVerify data integrity
Never share your private key. Anyone with your private key can decrypt all your medical records.

Best Practices

Be Specific with Titles

Use clear, descriptive titles like “2024 Annual Physical” instead of “Checkup”

Include Relevant Details

Add important information like dates, doctor names, and key findings

Choose Correct Type

Select the appropriate record category for easier filtering later

Regular Backups

While records are on blockchain, keep copies of important documents

Troubleshooting

  • Wait 10-15 seconds for blockchain sync to complete
  • Click the manual sync button
  • Check browser console for sync status
  • Ensure you’re connected with the correct wallet
  • Check that you have sufficient Aleo credits in your wallet
  • Verify the backend server is running and accessible
  • Try enabling Demo Mode for testing without blockchain
  • Ensure you’re using the same private key that created the record
  • Check that the record wasn’t corrupted during storage
  • Verify your wallet connection is active

Next Steps

Share Records

Learn how to share records with doctors

QR Code Sharing

Generate QR codes for quick access

Build docs developers (and LLMs) love