# Patient Data Ownership

<figure><img src="https://1965619156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVTbs9qAUKtW5fu3rCJvO%2Fuploads%2FXbmMufAWsUEHp8riPJWW%2Fimage.png?alt=media&#x26;token=3324a4ac-7921-41fb-a9ba-5efcb2b6d27f" alt=""><figcaption></figcaption></figure>

The concept of patient data ownership in the context of blockchain and IPFS (InterPlanetary File System) involves a mix of cryptography, decentralized storage, and blockchain technology to ensure that patient data is securely stored, managed, and shared while maintaining the patient's control over their data. Here's an overview of how this works:

## Blockchain Wallet System for Patient Data

1. **Blockchain Wallets:** Patients have blockchain wallets, which are essentially digital tools that allow them to store and manage their private keys. A private key is a secure digital code known only to the owner and is used to sign transactions or encrypt data, ensuring the security and ownership of the data.
2. **Data Encryption:** Before patient data is stored on IPFS or any other storage system, it is encrypted using the patient's private key. This process transforms the readable data (plaintext) into an unreadable format (ciphertext) that can only be decrypted with the corresponding public key or the private key used for encryption.
3. **Storing on IPFS:** Once encrypted, the data is stored on IPFS. IPFS allows for the decentralized storage of files, making them accessible through a unique hash (a cryptographic fingerprint) instead of a location-based address. Despite being stored on a public network where files are accessible to anyone who has the hash, the encryption ensures that only those with the right key can read the contents.

## How Encryption Ensures Ownership

* **Encryption Layer:** The layer of encryption acts as a protective barrier around the data. Although the file is publicly accessible on IPFS, the encryption ensures that the data remains confidential and tamper-proof. Without the corresponding private key or an authorized decryption method, the data is gibberish to unauthorized users.
* **Control and Access:** Ownership in this context is about control and access. The patient, who holds the private key, has exclusive control over who can access their data. They can grant access by sharing their public key or a decryption key under specific terms, ensuring that they "own" their data in terms of deciding who can see it and use it.
