Skip to main content
Get your privacy-preserving medical records system up and running in minutes. This guide will walk you through creating your first encrypted medical record on the Aleo blockchain.

Prerequisites

Before you begin, make sure you have:
  • Node.js 18+ installed on your system
  • npm or yarn package manager
  • A modern web browser (Chrome, Firefox, or Safari)
  • An Aleo private key (we’ll help you get one below)

Installation

1

Clone the Repository

Clone the Salud Health repository to your local machine:
git clone <repository-url>
cd Salud
2

Install Frontend Dependencies

Navigate to the Main APP directory and install dependencies:
cd "Main APP"
npm install
The frontend uses React 18, TypeScript, and Vite for a fast development experience. Key dependencies include @provablehq/sdk for Aleo blockchain integration.
3

Configure Environment

The frontend connects directly to the Aleo blockchain. No additional backend configuration needed for basic usage.Create a .env file in the Main APP directory (optional):
ALEO_NETWORK=testnet
ALEO_ENDPOINT=https://api.explorer.provable.com/v1
PROGRAM_ID=salud_health_records_v6.aleo
4

Start the Application

Launch the development server:
npm run dev
The application will start at http://localhost:5173

Get Your Aleo Wallet

Salud Health requires an Aleo private key to encrypt your medical data before storing it on the blockchain. You have three options:
Don’t have a wallet yet? Generate one directly in Salud:
  1. Open Salud at http://localhost:5173
  2. Click “Generate New” on the wallet connect screen
  3. Save the generated private key securely
  4. The app will automatically connect
You can later import this account into Leo Wallet or Shield Wallet using the same private key.
If you use Shield Wallet:
  1. Open the Shield Wallet extension
  2. Go to Account Settings
  3. Select “Export Private Key”
  4. Authenticate with your password
  5. Copy the private key
  6. Paste it into Salud

Create Your First Medical Record

Once connected, you’re ready to create your first encrypted medical record:
1

Connect Your Wallet

On the Salud dashboard, paste your Aleo private key or generate a new account. The app will validate your key and establish a secure session.
Expected format: APrivateKey1zkp...
Length: 59 characters
2

Create a New Record

Click the “New Record” button on the dashboard. You’ll see a form with the following fields:
  • Title: Brief description (e.g., “Annual Physical 2026”)
  • Description: Detailed notes about the visit or condition
  • Record Type: Select from:
    • General (1)
    • Lab Results (2)
    • Prescription (3)
    • Imaging (4)
    • Vaccination (5)
  • Medical Data: The actual health information (automatically encrypted)
3

Submit to Blockchain

Click “Create Record” to encrypt and store your data on the Aleo blockchain.Under the hood, Salud:
  1. Encrypts your medical data client-side using your private key
  2. Splits the data into 12 field elements (~360 bytes total capacity)
  3. Generates a unique record ID using BHP256::hash_to_field
  4. Creates a private MedicalRecord on Aleo
record MedicalRecord {
    owner: address,
    record_id: field,
    data_hash: field,
    data_part1-12: field,
    record_type: u8,
    created_at: u32,
    version: u8,
}
On testnet, this transaction is free. Your record will appear in 10-15 seconds after blockchain confirmation.
4

View Your Record

Once confirmed, your encrypted record appears in the dashboard. Click on it to:
  • View decrypted details (only you can decrypt)
  • Share with healthcare providers
  • View access history
  • Download as PDF

Share with a Doctor

One of Salud’s most powerful features is time-limited access sharing:
1

Select a Record

Click on any medical record in your dashboard to open the details view.
2

Click 'Share with Doctor'

In the record details modal, click the “Share with Doctor” button.
3

Configure Access

Enter the following details:
  • Doctor’s Aleo Address: The healthcare provider’s wallet address (starts with aleo1...)
  • Access Duration: Choose from:
    • 1 hour (240 blocks) - Quick consultation
    • 24 hours (5,760 blocks) - Standard access
    • 7 days (40,320 blocks) - Extended care
Aleo produces approximately 1 block every 15 seconds, so durations are measured in block heights rather than timestamps.
4

Generate Access Token

Salud creates a cryptographic access token using:
BHP256::hash_to_field(AccessTokenInput {
    record_id: record_id,
    doctor: doctor,
    patient: patient,
    nonce: nonce,
})
The token is stored on-chain in the access_grants mapping:
struct AccessGrant {
    patient: address,
    doctor: address,
    record_id: field,
    access_token: field,
    granted_at: u32,
    expires_at: u32,
    is_revoked: bool,
}
5

Share QR Code

Salud generates a QR code containing the access token. The doctor can scan this QR code to view your record during the access window.
Access automatically expires after the specified duration. You can also manually revoke access at any time from the Access History page.

What Makes Salud Different?

Unlike typical blockchain dApps, Salud provides medical-grade privacy:
FeatureStandard dAppSalud Health
Data Encryption❌ Not encrypted✅ Encrypted with your key
Medical Privacy❌ Visible to dApp✅ Only you can decrypt
Server Access❌ Can read data✅ Zero-knowledge
Sharing❌ Not possible✅ Time-limited tokens
Security LevelStandardHIPAA-grade
Your medical data is encrypted in your browser before it reaches any server or the blockchain. Even the Aleo network cannot decrypt your records.

Next Steps

Installation Guide

Detailed setup instructions including backend configuration and environment variables

Architecture

Learn how Salud integrates with Aleo blockchain for privacy-preserving healthcare

Smart Contract

Explore the Leo smart contract powering Salud’s medical records

Security Guide

Privacy model and security best practices

Troubleshooting

Ensure your private key:
  • Starts with APrivateKey1
  • Is exactly 59 characters long
  • Has no extra spaces or line breaks
If you’re unsure, use the “Generate New” button to create a fresh account.
Records are fetched from the blockchain on connect, which may take 10-15 seconds. Check:
  • Browser console for sync status
  • Network connection to Aleo testnet
  • That you’re using the correct wallet address
On testnet, ensure you have:
  • Testnet credits in your wallet (get from faucet)
  • A valid network connection
  • The correct PROGRAM_ID in your environment variables
Current program: salud_health_records_v6.aleo

Getting Help

Need assistance?
  • Check the FAQ for common questions
  • Review the troubleshooting guide
  • Join the Aleo community Discord
  • Open an issue on GitHub

Build docs developers (and LLMs) love