Documentation
Introduction to HealthChain
HealthChain is a decentralized medical record system built on Polygon. It allows patients to own their data and grant granular access to providers.
Architecture
The system consists of three main pillars:
- Smart Contracts: Handle access control and record hashes on Polygon Amoy.
- IPFS (Pinata): Decentralized storage for encrypted medical files (PDFs, Images).
- Frontend (Next.js): User interface for encryption, decryption, and viewing.
Smart Contracts
Our primary contract HealthChainRecords.sol manages the mapping between patients and their record hashes.
function addRecord(string memory _ipfsHash, string memory _recordType) public {
// Adds a record to the caller's history
records[msg.sender].push(Record(_ipfsHash, _recordType, msg.sender, block.timestamp));
emit RecordAdded(msg.sender, _ipfsHash, _recordType);
}