Skip to main content
A blockchain is a decentralized, immutable ledger for recording transactions and storing data proofs. Because that data is public, it is not the place for sensitive information. Chains hold hash representations or encrypted versions of the data instead, which keeps the ledger efficient, tamper-resistant, and verifiable. Larger or more sensitive data stays in off-chain storage.
  1. Blockchain Efficiency: Storing large data directly on-chain is resource-intensive and costly. Blockchains are designed to prioritize consensus, security, and scalability.
  2. Data Integrity: Storing hash representations of data on-chain ensures that the integrity and authenticity of the off-chain data can be verified without directly storing it.
  3. Access Control: Off-chain storage often incorporates mechanisms to ensure only verifiable entities can access sensitive or private metadata.
  4. Hybrid Storage: Combining on-chain and off-chain storage provides a balance between decentralization, cost, and performance.

Key Concepts

On-chain data

On-chain data refers to data stored directly on the blockchain. Some examples with the peaq blockchain include: hashes of DID Documents, transaction metadata, storage configurations, RBAC data, and smart contract states. Data stored on the blockchain is immutable and publicly verifiable. Benefits:
  • Immutability: once recorded, on-chain data cannot be altered. That makes it tamper-evident, which is not the same as secure: the rest of the system still needs its own safeguards.
  • Verification: Storing a hash ensures the authenticity of off-chain data without compromising privacy.
  • Transparency: On-chain data is publicly accessible and verifiable, promoting openness and auditability.

Off-chain data

Off-chain data refers to data stored outside the blockchain (e.g., in distributed storage systems like IPFS, traditional databases (MongoDB), or cloud services). This is typically large files, metadata, or sensitive information that is too big or too private for a public blockchain. Access to off-chain storage is controlled through cryptographic mechanisms or decentralized identifiers. Benefits:
  • Scalability: Reduces blockchain bloat by storing large or complex data elsewhere.
  • Flexibility: Allows for dynamic updates to metadata without altering on-chain records.
  • Privacy: Sensitive data can be encrypted and shared with authorized entities only.

Example Use Case: DID Document

  • On-Chain: Store the hash of the DID Document along with its basic details.
  • Off-Chain: Store the metadata (e.g., entity metadata too large for DID Document) in an off-chain storage solution.
  • Access Control: Ensure only authorized entities can access the off-chain services via verifiable credentials or permissions.
To learn more about how to use IPFS or MongoDB with a DID Document please check out the tutorial: Off-Chain Storage Solutions