COMPARISON

On-Chain vs Off-Chain Storage — What Data Belongs on the Blockchain and What Does Not

Storing data on-chain costs $10,000–$100,000+ per megabyte in gas fees. Most data should not be stored on-chain. Here is the decision framework for what belongs on the blockchain and what belongs in a database.

Read time

3 min

Category

Blockchain Comparison

FAQ

2

Quick summary

Storing data on-chain costs $10,000–$100,000+ per megabyte in gas fees. Most data should not be stored on-chain. Here is the decision framework.

Author

ClickMasters Team

Published

2025-06-23

Book a Call

Need a quick expert recommendation?

Get a practical recommendation before you spend weeks choosing the wrong blockchain architecture.

Book a Free Strategy Call

Complete Comparison

On-chain storage is for immutable, publicly verifiable data that smart contracts read — token balances, ownership records, governance votes, and compliance hashes. Off-chain storage is for large files, frequently updated data, personal data (GDPR/CCPA), and private business data. Use the hash pattern: store data off-chain, store SHA-256 hash on-chain.

On-Chain Storage: What Belongs There

On-chain storage is appropriate for data that must be: immutable (cannot be altered after recording), publicly verifiable (anyone can confirm the value), trustless (no single party can control it), and integral to smart contract execution (the contract reads this value to determine what to do).

  • Token balances and allowances (ERC-20 state)
  • NFT ownership records (token ID → owner mapping)
  • Governance vote records (who voted how)
  • Settlement records (payment confirmed at timestamp)
  • Compliance certification hashes (SHA-256 of document, not the document itself)
  • Supply enforcement (total minted, max supply)

Off-Chain Storage: What Belongs Elsewhere

Off-chain storage (database, IPFS, Arweave, S3) is appropriate for data that is: large (images, videos, documents), frequently updated (user profile data, application state), private (user PII, HIPAA-protected health data), or not required for smart contract execution.

  • NFT artwork (image file → stored on IPFS, hash stored on-chain)
  • User profiles and identity data (database, on-chain only the wallet address)
  • Order history and analytics (database, on-chain only settlement events)
  • Application state (database, on-chain only financial transactions)
  • PHI in healthcare applications (encrypted off-chain, hash on-chain for integrity)

The Hash Pattern

The standard architecture for large or sensitive data: store the data off-chain. Hash the data (SHA-256). Store the hash on-chain. This provides: immutable proof that the data existed and has not been changed (on-chain hash), without storing the data itself on-chain (which would be expensive and potentially reveal private information).

Used for: NFT metadata, healthcare records, supply chain documents, legal agreements, financial statements referenced in smart contracts.

Frequently Asked Questions

Questions founders ask before choosing a blockchain stack

Clear answers to the most common technical, business, and implementation questions around this comparison.

2

Answers

How much does on-chain storage cost?

Ethereum: approximately $5,000–$50,000 per megabyte at typical gas prices. One 4MB image stored on Ethereum mainnet would cost $20,000–$200,000. This is why NFT images are on IPFS, not on-chain.

What is IPFS and why do NFTs use it?

IPFS (InterPlanetary File System) is a content-addressed distributed storage network. Files are identified by their hash — the same hash will always retrieve the same file. NFT metadata points to an IPFS URI (ipfs://QmHash...) — this provides content-addressed permanence without on-chain gas costs. Arweave offers permanent, incentivized storage with one-time payment — more permanent guarantee than IPFS.

Frequently Asked Questions

Questions founders ask before choosing a blockchain stack

Clear answers to the most common technical, business, and implementation questions around this comparison.

2

Answers

How much does on-chain storage cost?

Ethereum: approximately $5,000–$50,000 per megabyte at typical gas prices. One 4MB image stored on Ethereum mainnet would cost $20,000–$200,000. This is why NFT images are on IPFS, not on-chain.

What is IPFS and why do NFTs use it?

IPFS (InterPlanetary File System) is a content-addressed distributed storage network. Files are identified by their hash — the same hash will always retrieve the same file. NFT metadata points to an IPFS URI (ipfs://QmHash...) — this provides content-addressed permanence without on-chain gas costs. Arweave offers permanent, incentivized storage with one-time payment — more permanent guarantee than IPFS.

Need Help with Blockchain Data Architecture?

Get expert guidance on designing on-chain and off-chain data storage.

Book a Free Strategy Call