139  Blockchain Fundamentals for IoT

In 60 Seconds

Only use blockchain when multiple parties need shared data without trusting each other AND require an immutable audit trail; otherwise, a traditional database is simpler and faster. IoT-optimized DAGs like IOTA eliminate mining fees, enabling feeless micropayments between devices at 1,000+ transactions per second.

Minimum Viable Understanding
  • Blockchain provides immutable, decentralized trust – no single party controls the record, and tampering is cryptographically detectable.
  • Three blockchain types serve different IoT needs: public (global verification, slow/expensive), private (enterprise, fast/cheap), and IoT-optimized DAGs like IOTA (feeless micropayments).
  • Only use blockchain when multiple parties need shared data without trusting each other AND require an immutable audit trail; otherwise, a traditional database is simpler, faster, and cheaper.

139.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Explain why decentralization and immutability matter for IoT trust models
  • Differentiate between blockchain types (public, private, consortium) and their IoT suitability
  • Diagnose the trust problems blockchain solves in multi-party IoT ecosystems
  • Evaluate tradeoffs between public, private, and IoT-optimized distributed ledgers

Key Concepts

  • Distributed Ledger Technology (DLT): A database architecture where records are shared and synchronized across multiple nodes with no central administrator, making tampering detectable through consensus
  • Consensus Mechanism: The algorithm by which blockchain nodes agree on the valid state of the ledger — Proof of Work (mining), Proof of Stake (staking), or Byzantine Fault Tolerant (BFT) variants each trade energy for throughput
  • Cryptographic Hash: A fixed-length fingerprint (e.g., SHA-256) of arbitrary data such that any single-bit change in the input produces a completely different output, making blockchain tampering detectable
  • Smart Contract: Self-executing code stored on a blockchain that automatically enforces agreement terms when predefined conditions are met, enabling trustless M2M payments and automated IoT triggers
  • Directed Acyclic Graph (DAG): An alternative to linear blockchain structure used by IOTA’s Tangle, where transactions validate two prior transactions in a graph structure enabling parallel processing and feeless micropayments
  • Transaction Finality: The point at which a blockchain transaction is considered irreversible — 10–60 minutes on Bitcoin, sub-second on private chains — determining whether blockchain can meet IoT real-time requirements
  • On-Chain vs Off-Chain: The architectural pattern of storing only cryptographic proofs and custody events on the blockchain while keeping raw sensor data in a conventional database, reducing transaction costs by 10,000×

139.2 Introduction

Time: ~8 min | Difficulty: Intermediate | P04.C09.U01

How do you trust data from 10,000 sensors owned by different companies? Who verifies that the temperature reading from a pharmaceutical shipment was accurate and unaltered? When an autonomous vehicle reports an accident, how can insurers trust the vehicle’s logs weren’t tampered with?

Traditional IoT architectures rely on centralized authorities to validate data, manage identities, and enforce agreements. But this creates single points of failure, trust bottlenecks, and opportunities for manipulation. Blockchain and distributed ledger technology (DLT) offer an alternative: immutable, decentralized trust where no single party controls the record of truth.

Blockchain provides a shared, tamper-proof ledger where IoT devices can record transactions, trigger automated agreements through smart contracts, and establish trust without intermediaries. However, integrating blockchain with resource-constrained IoT devices presents unique challenges in scalability, latency, and energy consumption that require careful architectural consideration.

Common Misconception: Blockchain Solves All IoT Security Problems

Myth: “Adding blockchain to my IoT system automatically makes it secure and solves all trust issues.”

Reality: Blockchain provides data immutability and decentralized consensus, but does NOT solve:

  • Device security: If an attacker compromises an IoT sensor and controls its private key, they can sign and submit fraudulent data that will be permanently recorded on the blockchain as “valid.”
  • Input validation: Blockchain follows “garbage in, garbage out”–if a faulty or malicious sensor reports incorrect temperature readings, the blockchain will faithfully record those false readings forever.
  • Real-time threats: Blockchain has finality delays (seconds to minutes). It cannot prevent active attacks like man-in-the-middle or jamming.
  • Privacy: Public blockchains expose all transaction data. Private blockchains still require careful access control design.

Key insight: Blockchain is a trust layer for multi-party systems, not a replacement for device security, encryption, access control, or input validation. You still need secure boot, attestation, encrypted communication, and anomaly detection–blockchain complements these, not replaces them.

Imagine a shared notebook that everyone in a group has an identical copy of. When someone writes a new entry, everyone’s notebook automatically updates to include it. Once an entry is written, it cannot be erased or changed–ever. If someone tries to alter their copy, everyone else’s notebooks will show the discrepancy, and the fake entry is rejected.

That’s essentially what blockchain is: a shared, unchangeable record of transactions or events. Each “block” contains a batch of transactions, and these blocks are “chained” together using cryptography. The chain is maintained by many computers (nodes) that all agree on what the correct version is.

For IoT, this means sensor readings, device actions, or equipment status can be recorded in a way that no single company or person can manipulate the historical record–creating trust through mathematics and distribution rather than relying on a central authority.

Blockchain is like a magical notebook where EVERYONE has an exact copy, and once you write something, it can NEVER be erased or changed - not even by the sneakiest person!

139.2.1 The Sensor Squad Adventure: The Unbreakable Truth Notebook

The Sensor Squad had a big problem at the Smart Farm. Farmer Fred claimed his tomatoes were grown at exactly the perfect temperature. But Sneaky Sam said, “How do we KNOW that’s true? What if someone changed the records?”

This was a serious problem! The tomatoes were being sold to a fancy restaurant, and they needed PROOF that the temperature readings were real and hadn’t been changed.

Sammy the Temperature Sensor had an idea. “What if EVERYONE kept a copy of my temperature readings? Not just one notebook, but MANY notebooks - and they all have to match!”

Here’s how the Sensor Squad set up their “blockchain” system:

Step 1: Everyone Gets a Notebook

Sammy, Lila the LED, Max the Microcontroller, Bella the Battery, AND Farmer Fred all got identical notebooks. Whenever Sammy recorded a temperature, ALL of them wrote it down at the same time.

Step 2: Chain the Pages Together

After each page was filled, the Squad did something clever. They used a special code (called a “hash”) that connected each page to the previous one. It was like putting a secret stamp on each page that said “this page comes after THAT page.”

Step 3: The Cheater Test

Sneaky Sam tried to cheat! He snuck into Farmer Fred’s barn and changed one number in Fred’s notebook: “25 degrees” became “20 degrees.”

But when the Squad compared notebooks, FOUR of them said “25 degrees” and only ONE said “20 degrees.” The different one was obviously wrong! Plus, because Sneaky Sam changed that page, the secret stamp didn’t match anymore.

“CAUGHT!” shouted the Squad. “The blockchain ALWAYS knows when someone tries to cheat!”

Step 4: The Restaurant Gets the Truth

Now the fancy restaurant could trust the temperature records because: - Not just ONE person kept the records - EVERYONE did - Changing one notebook wouldn’t work - you’d have to change ALL of them at exactly the same time (impossible!) - The chain of secret stamps would reveal any tampering

“It’s like having a hundred witnesses instead of just one,” explained Max. “Even if one witness lies, all the others tell the truth!”

The Lesson:

Farmer Fred smiled. “Blockchain helps when you need EVERYONE to trust the same truth, especially when you don’t know each other well. It’s perfect for important things like food safety, medicine tracking, and making sure IoT sensors are telling the real story!”

139.2.2 Key Words for Kids

Word What It Means
Blockchain A special system where many people keep identical copies of the same information, so no one can cheat or lie
Block One page of records - like one day’s worth of sensor readings bundled together
Chain How the pages connect - each page has a secret code linking it to the page before it
Hash A special code or fingerprint that changes completely if even ONE tiny thing is different
Decentralized Not controlled by any single person - everyone shares the responsibility equally

139.2.3 Try This at Home!

The Unbreakable Truth Game!

Play this with 3-5 friends or family members to see how blockchain works:

What you need:

  • Small notebooks or paper for each person
  • A timer

The Game:

  1. One person is the “Sensor” and announces events: “9:00 AM - Temperature is 22 degrees!”
  2. EVERYONE writes this down in their notebook at the same time
  3. After 5 events, one person secretly tries to change ONE thing in their notebook
  4. Everyone compares notebooks - can you find the cheater?

The Blockchain Version (harder to cheat!):

After each event, everyone writes the FIRST LETTER of each word from the previous event at the top of the new page. For example: - Event 1: “Temperature is 22” - Event 2 starts with: “T-I-2-2” then the new event

If someone changes Event 1, their letters for Event 2 won’t match everyone else’s!

What you’ll learn:

  • When everyone keeps records, it’s MUCH harder to cheat
  • Connecting events together (like a chain) makes tampering obvious
  • Trust works better when NO ONE person controls all the information
Key Takeaway

In one sentence: Blockchain provides immutable, decentralized trust for multi-party IoT ecosystems, but cannot solve device-level security or meet real-time latency requirements.

Remember this rule: Only use blockchain when multiple parties need shared data without trusting each other AND require an immutable audit trail; otherwise, a traditional database is simpler, faster, and cheaper.

139.3 Why Blockchain for IoT?

Time: ~12 min | Difficulty: Intermediate | P04.C09.U02

139.3.1 The Trust Problem in IoT Ecosystems

IoT deployments increasingly involve multiple stakeholders with competing interests:

  • Multi-party ownership: A smart city has sensors owned by utilities, government, and private companies
  • Data integrity questions: Who guarantees a pollution sensor reading is accurate and unaltered?
  • Audit trail requirements: Regulatory compliance demands provable history (FDA for medical devices, NHTSA for autonomous vehicles)
  • Automated transactions: M2M payments, resource sharing, and automated contracts need verifiable execution

Traditional solutions rely on trusted third parties (cloud providers, certification authorities), but these introduce:

  • Single points of failure: Server outages affect all dependent IoT systems
  • Trust bottlenecks: Central authority must validate every transaction
  • Manipulation risks: Database administrators can alter historical records
  • Vendor lock-in: Dependence on proprietary platforms

139.3.2 What Blockchain Provides

Blockchain addresses these challenges through four fundamental properties:

  1. Immutability: Once recorded, data cannot be altered without detection. Cryptographic hashing and chain structure make tampering computationally infeasible.

  2. Decentralization: No single entity controls the ledger. Consensus mechanisms ensure agreement across distributed nodes without central authority.

  3. Transparency: All authorized parties see the same record of truth. Public blockchains are fully open; private blockchains offer permissioned transparency.

  4. Smart Contracts: Self-executing code that automatically enforces agreements when conditions are met, enabling trustless automation.

Side-by-side comparison diagram showing centralized IoT architecture on left with five gray IoT devices all connecting to single orange central server creating single point of failure, versus decentralized blockchain architecture on right with five teal nodes each containing ledger copy interconnected in mesh topology with no central authority providing distributed consensus and fault tolerance
Figure 139.1: Comparison of centralized IoT architecture (single point of failure) versus decentralized blockchain architecture (distributed consensus and ledger replication).

139.3.3 Value Propositions for IoT

Blockchain adds genuine value in IoT scenarios requiring:

  • Multi-organizational trust: Supply chains with manufacturers, shippers, retailers, regulators
  • Auditability: Provable compliance history for regulated industries
  • Micropayments: M2M transactions where traditional payment rails are too expensive
  • Device identity: Self-sovereign identity for billions of IoT devices
  • Data marketplaces: Monetizing sensor data while maintaining ownership

139.4 Blockchain Types for IoT

Time: ~15 min | Difficulty: Intermediate | P04.C09.U03

Not all blockchains are suitable for IoT. Understanding the spectrum from fully public to fully private is critical for architectural decisions.

139.4.1 Public Blockchains

Examples: Bitcoin, Ethereum, Cardano

Characteristics:

  • Fully decentralized: Anyone can run a node, validate transactions, participate in consensus
  • Permissionless: No gatekeepers for reading or writing data
  • High security: Massive computational power protects against attacks (Bitcoin: ~300 exahashes/second)
  • Low throughput: 7-15 transactions per second (Bitcoin: 7 TPS, Ethereum: 15 TPS)
  • High latency: 10 minutes to 1 hour for transaction finality
  • Energy intensive: Proof of Work consumes gigawatts (Bitcoin: ~150 TWh/year)

IoT Suitability: Generally poor for high-frequency sensor data. Useful only for: - Recording critical milestones (device manufacturing, ownership transfers) - Anchoring hashes of off-chain IoT data for verification - Public identity registries for IoT devices

139.4.2 Private (Permissioned) Blockchains

Examples: Hyperledger Fabric, R3 Corda, Quorum

Characteristics:

  • Controlled access: Only authorized nodes participate
  • Higher throughput: 1,000-10,000+ TPS depending on configuration
  • Lower latency: Sub-second to few-second finality
  • Energy efficient: Use consensus mechanisms like PBFT, Raft instead of Proof of Work
  • Privacy controls: Channel-based isolation, encrypted ledger state
  • Governance: Consortium defines rules, membership, smart contract approval

IoT Suitability: Good for enterprise IoT where: - Known participants (supply chain partners, utility companies) - Performance matters (frequent sensor updates) - Privacy required (confidential business data) - Regulatory compliance needed (GDPR, HIPAA)

139.4.3 IoT-Optimized Distributed Ledgers

IOTA (Tangle - Directed Acyclic Graph):

  • No blockchain: Uses DAG (Tangle) structure instead of linear chain
  • Feeless: No transaction costs, enabling micropayments
  • Scalable: Parallelized validation; throughput increases with activity
  • Lightweight: Designed for resource-constrained devices
  • Controversy: Centralized “coordinator” (being phased out), security questions

Hedera Hashgraph:

  • Asynchronous Byzantine Fault Tolerance: Fast, fair, provably secure consensus
  • High throughput: 10,000+ TPS
  • Governed: Controlled by council of enterprises (Google, IBM, Boeing)

IoT Suitability: Best for machine-to-machine ecosystems requiring: - High-frequency microtransactions - Low computational overhead - Predictable costs

139.4.4 Comparison Table

Intermediate Level

Characteristic Public Blockchain Private Blockchain IOTA/DAG
Throughput (TPS) 7-15 1,000-10,000+ 1,000+ (scales with load)
Latency 10 min - 1 hr <1 sec - few sec <10 sec
Energy per TX ~1,000 kWh (Bitcoin) <0.01 kWh ~0.001 kWh
Transaction Cost $1-50 $0.001-0.01 $0 (feeless)
Decentralization High Low-Medium Medium (improving)
Node Requirements 1TB+ storage, high CPU 100GB+, moderate CPU <10GB, low CPU
IoT Suitability Low (anchoring only) High (enterprise) High (M2M)
Three-column comparison table showing blockchain types: Public blockchain (Bitcoin/Ethereum) with high security and full decentralization but slow 7-15 TPS and expensive $1-50 per transaction, Private blockchain (Hyperledger Fabric) with fast 10K TPS and low $0.001 cost but lower decentralization, and IoT-optimized DAG (IOTA) with feeless $0 transactions and scalability but less mature ecosystem, each matched to best-fit use cases like supply chain for private, smart city micropayments for DAG, and device identity for public
Figure 139.2: Blockchain type comparison showing public, private, and IoT-optimized DAG blockchains with their respective trade-offs and best-fit IoT use cases.
Tradeoff: Public Blockchain vs Private Blockchain

Decision context: When adding blockchain to an IoT system, you must choose between fully decentralized public networks and controlled private/consortium networks.

Factor Public Blockchain Private Blockchain
Power High (Proof of Work mining) Low (efficient consensus like PBFT)
Cost $1-50 per transaction (gas fees) $0.001-0.01 per transaction
Complexity Simple to join (permissionless) Requires consortium governance setup
Latency 10 min - 1 hour finality Sub-second to few seconds finality

Choose Public Blockchain when:

  • Global, censorship-resistant verification is required (device identity registry)
  • No trusted consortium exists to govern a private network
  • Transaction frequency is low (once per device lifetime)
  • Maximum decentralization and transparency are paramount

Choose Private Blockchain when:

  • Known participants need shared trust (supply chain partners)
  • High transaction throughput is required (>100 TPS)
  • Confidential business data must remain private
  • Regulatory compliance requires access controls (GDPR, HIPAA)

Default recommendation: Use Private Blockchain (Hyperledger Fabric) for enterprise IoT unless you specifically need global public verification or have no consortium to manage the network.

Blockchain-IoT integration architecture showing how distributed ledger technology connects with IoT devices

Blockchain-IoT integration architecture showing how distributed ledger technology connects with IoT devices
Figure 139.3: The blockchain-IoT integration architecture demonstrates how resource-constrained devices can leverage distributed ledger technology through gateway mediation. IoT sensors sign transactions locally, while gateways handle the computationally intensive blockchain operations, enabling even battery-powered devices to participate in decentralized consensus ecosystems.

Real-World IoT Blockchain Selection Decision:

Scenario 1: Global Supply Chain (Walmart Food Trust)

  • Requirement: 20 companies (farms, processors, distributors, retailers) need shared trust
  • Data volume: 10,000 products tracked, 100 events per product per day = 1M events/day
  • Choice: Hyperledger Fabric (Private Blockchain)
  • Why: Known participants (consortium), needs privacy (confidential pricing), fast (1K TPS sufficient), low cost (<$0.01/tx vs. Ethereum $50/tx = $50M/day savings!)

Scenario 2: Smart City Parking (IOTA Use Case)

  • Requirement: 50,000 parking spots, drivers pay per minute via car digital wallet
  • Data volume: 5,000 cars x 60 payments/hour = 300K TPS (peak)
  • Choice: IOTA Tangle (DAG)
  • Why: Feeless (transaction costs would exceed parking fees otherwise), scalable, micropayments ($0.05/5-min), M2M (no human intervention)

Scenario 3: Device Manufacturing Certificates (Public Blockchain)

  • Requirement: 1 billion IoT devices need globally verifiable authenticity certificates
  • Data volume: 1B devices manufactured over 10 years = 100M/year = 3 TPS average
  • Choice: Ethereum (Public Blockchain)
  • Why: Needs global trust (anyone can verify), low transaction frequency (once per device lifetime), worth high cost ($10 certificate fee acceptable for $100 device)

Scenario: A pharmaceutical distributor ships temperature-sensitive vaccines from manufacturing in Switzerland to clinics in 50 countries. Regulatory agencies (FDA, EMA) require proof that vaccines stayed within 2-8°C for the entire journey. The distributor works with 15 logistics partners (freight, airlines, customs brokers, warehouses).

Requirements:

Requirement Details
Participants 1 manufacturer + 15 logistics partners + 50 clinic chains + 10 regulators = 76 organizations
Sensors 5,000 shipping containers with temperature loggers reporting every 5 minutes
Data volume 5,000 containers × 12 readings/hour × 168 hours (7 days avg shipment) = 10M readings/shipment
Audit trail Immutable proof for 10-year regulatory retention
Access control Different partners see only their segment (privacy)
Response time Temperature breach alert within 2 minutes (not real-time blockchain consensus)

Architecture Decision:

Option A: Centralized Database (Rejected)

Factor Analysis
Trust Single company controls all records - other partners don’t trust it
Tampering risk Database admin could alter historical readings to hide violations
Compliance Regulators require third-party neutral verification
Cost Low (PostgreSQL + API: $5K/month)

Verdict: Fails the trust requirement. If a shipment spoils, parties blame each other and manipulate records.

Option B: Public Blockchain (Ethereum) - Rejected

Factor Analysis
Throughput 10M readings × 15 TPS = 666,666 seconds = 7.7 days just to record ONE shipment (unusable)
Cost 10M transactions × $1/tx = $10M per shipment (vaccines cost $500K - blockchain exceeds product value!)
Privacy All logistics pricing exposed on public ledger (unacceptable)
Latency 10-60 min finality (too slow for 2-min alerts)

Can Ethereum handle global pharmaceutical logistics? Let’s calculate the exact throughput mismatch:

For 10M temperature readings per 7-day shipment:

  • Required transaction rate: \[\text{TPS needed} = \frac{10{,}000{,}000 \text{ readings}}{7 \text{ days} \times 86{,}400 \text{ sec/day}} = 16.5 \text{ TPS}\]

Ethereum capacity: 15 TPS (barely sufficient)

  • Cost at current gas prices (\(1/transaction average):\)\(\text{Cost per shipment} = 10{,}000{,}000 \times \$1 = \$10{,}000{,}000\)$

For a $500K vaccine shipment, blockchain fees would be 20× the product value – economically absurd. The hybrid approach (only hashes on-chain) reduces this to 672 transactions = $672, a 14,900× cost reduction that makes the system viable.

Verdict: Fails throughput, cost, and privacy requirements.

Option C: Private Blockchain (Hyperledger Fabric) - Selected

Hybrid Architecture:

Layer 1: Edge/Cloud (Real-time)
- Temperature sensors → Cloud MQTT broker
- Rule engine checks thresholds (2-8°C)
- Alert fires within 10 seconds if breach detected
- Raw data stored in cloud database (PostgreSQL)

Layer 2: Blockchain (Audit trail)
- Every 15 minutes: Hash of sensor readings batch written to blockchain
- At custody transfer points: Write immutable checkpoint record
- 10M readings → 672 batch transactions (7-day shipment / 15 min intervals)
- Cost: 672 tx × $0.001 = $0.67 per shipment

Layer 3: Smart Contracts (Automation)
- Automatic payment release when delivery confirmed AND no temperature breaches
- Immutable evidence for insurance claims if violations occurred

Technical Implementation:

Component Technology Why
Blockchain Hyperledger Fabric with 4 peers per org Private consortium (76 orgs), 10K TPS throughput
Consensus Raft ordering service (3 nodes) Fast finality (< 1 second), crash-fault tolerant
Data model On-chain: hashes + custody events. Off-chain: raw sensor data Scalability - blockchain doesn’t store all 10M readings
Channels Separate channels per route segment Privacy - Swiss→Germany logistics data not visible to Kenya partners
Identity X.509 certificates via Fabric CA PKI-based access control per organization
Smart contracts Chaincode for payment automation Golang-based business logic

Cost Comparison (Per Shipment):

Approach Setup Cost Per-Shipment Cost Trust Level
Centralized DB $5,000 $10 Low (single party controls)
Ethereum public $0 $10,000,000 High (but unusable cost)
Hyperledger Fabric $180,000 (network setup) $50 (compute + storage) High (consortium)

Amortization: $180K setup / 10,000 shipments/year = $18/shipment. Total: $50 + $18 = $68 per shipment – adds 0.013% to $500K vaccine shipment cost. Acceptable overhead for regulatory compliance and trust.

Key Design Decisions:

  1. Hybrid on-chain/off-chain: Only cryptographic proofs and custody events on blockchain, not raw sensor data. This enables 10,000x throughput improvement.
  2. Private consortium, not public: Known participants (76 organizations) don’t need global public verification - private network provides speed, privacy, and lower cost.
  3. Alert system off-chain: Real-time temperature alerts via cloud rules engine (sub-10 sec), not blockchain consensus (1 sec-1 min). Blockchain provides audit trail, not operational monitoring.
  4. Channels for privacy: Each route segment gets a private channel - only organizations involved in that leg see commercial terms.

What to Observe: After deployment, monitor blockchain transaction throughput (should handle 672 tx per shipment with <1 sec latency), percentage of shipments with temperature breaches (4.2% industry average – blockchain doesn’t prevent violations, just provides tamper-proof evidence), and dispute resolution time (reduced from 60 days to 2 days with immutable blockchain proof).

Common Mistake: Storing Raw IoT Sensor Data On-Chain

The Mistake: A team building a blockchain-based environmental monitoring system writes every temperature, humidity, and air quality reading (10,000 sensors × 12 readings/hour = 120,000 transactions/hour) directly to an Ethereum blockchain. Within 3 days, they hit $50,000 in gas fees and the system grinds to a halt as transaction backlogs exceed 6 hours.

Why It Happens: Developers misunderstand blockchain’s role. They think “blockchain = database” and try to store all data on-chain for immutability. They don’t calculate transaction throughput or costs. The “decentralized database” mental model leads to architectural disasters.

The Fix - Hybrid Architecture:

Right approach:
1. Store raw sensor data in traditional database (PostgreSQL, TimescaleDB)
2. Compute cryptographic hash of hourly batches (e.g., SHA-256 of 720 readings)
3. Write ONLY the hash to blockchain (1 transaction per hour vs 720)
4. Verification: Anyone can recompute hash from raw data and check against blockchain

Result: 99.9% cost reduction (720 tx/hour → 1 tx/hour) with same tamper-proof guarantee

When to store on-chain: Critical events (custody transfers, alerts, contract executions), periodic checkpoints (hourly/daily hashes), device identity records. Never on-chain: High-frequency sensor readings, large files, anything over 1 KB per record.

Cost comparison example: 100,000 sensors, 1 reading/minute. Wrong: 6M tx/hour × $1 = $6M/hour = $144M/day. Right: 100K batches/hour × $0.001 = $100/hour = $2,400/day – still high, so batch further to 1 hash per 100 sensors per hour = $24/day. Design rule: Aim for <1,000 blockchain transactions per hour for cost-effective operation.

This variant presents blockchain selection as a step-by-step decision process, helping architects choose the right technology based on their specific requirements.

Flowchart decision tree starting with question 'Multi-party trust required?' branching to 'Use database instead' if no, or if yes asking 'Transaction frequency?' with high frequency over 1000 TPS leading to 'Use IOTA or private blockchain' and low frequency leading to 'Public verifiability needed?' which branches to 'Use public blockchain' if yes or 'Use private blockchain like Hyperledger' if no
Figure 139.4: This decision tree starts with the fundamental question: do you actually need blockchain? Many IoT projects would be better served by traditional databases. Blockchain adds value specifically when multiple parties need to share data without trusting each other and require an immutable audit trail.

This variant shows how practical IoT-blockchain systems store only essential data on-chain while keeping bulk sensor data off-chain, addressing the scalability challenge.

Architecture diagram showing IoT sensors at left generating raw data flowing to cloud storage layer (labeled S3 or IPFS) for bulk off-chain storage, while only cryptographic hashes and critical milestone events flow upward to blockchain layer for on-chain immutable records, with smart contracts able to verify off-chain data integrity by comparing hashes, solving scalability challenges
Figure 139.5: This hybrid architecture solves the fundamental problem of blockchain scalability for IoT. Storing 1 million sensor readings/day directly on blockchain would cost thousands of dollars and be impossibly slow. Instead, raw data goes to cheap cloud storage while blockchain stores only cryptographic proofs, enabling verification without the scalability penalty.

139.5 Blockchain Type Calculator

Use this calculator to compare blockchain types based on your IoT system requirements.

Common Pitfalls

Writing every sensor reading directly to a public blockchain. At 10,000 sensors × 12 readings/hour, Ethereum’s 15 TPS limit is exceeded and gas fees reach millions per day. Fix: store only SHA-256 hashes of batched data on-chain; keep raw data in a traditional database.

Adding blockchain to an IoT system controlled entirely by one organization provides no trust benefit over a conventional database but adds complexity, latency, and cost. Only use blockchain when multiple distrusting parties must share immutable records.

Believing blockchain makes IoT devices secure. If a compromised sensor signs fraudulent data, the blockchain faithfully and permanently records the false values. Blockchain provides tamper-evident audit trails, not device security, encryption, or intrusion prevention.

Deploying a real-time control loop (e.g., factory safety shutoff) on a public blockchain with 10-minute finality. Blockchain consensus is incompatible with sub-100ms control requirements. Use edge computing for real-time control; use blockchain only for audit trails.

139.6 Summary

This chapter covered the fundamentals of blockchain technology and its application to IoT ecosystems.

Key Takeaways:

  1. The Trust Problem: Multi-party IoT ecosystems need immutable, decentralized records that no single entity controls
  2. Blockchain Properties: Immutability, decentralization, transparency, and smart contracts provide trustless data sharing
  3. Public Blockchains (Bitcoin, Ethereum): Fully decentralized but too slow (7-15 TPS) and expensive for most IoT use cases
  4. Private Blockchains (Hyperledger Fabric): Enterprise-grade performance (10,000+ TPS) with privacy controls – best for most IoT deployments
  5. IoT-Optimized DAGs (IOTA): Feeless transactions ideal for M2M micropayments, but less mature ecosystem
  6. Decision Rule: Use blockchain only when multiple parties need shared data without trusting each other AND need an immutable audit trail
Test Your Understanding

Question 1: A smart agriculture platform connects 20 farms, 5 distributors, and 100 retailers who all need to verify crop provenance data. Which blockchain type is most appropriate?

  1. Public blockchain (Bitcoin) for maximum decentralization
  2. Private/consortium blockchain (Hyperledger Fabric) for known participants with performance needs
  3. No blockchain needed – a centralized database is sufficient
  4. IOTA Tangle for feeless transactions

b) Private/consortium blockchain (Hyperledger Fabric). The participants are known organizations (not anonymous), requiring high throughput for daily crop tracking, privacy for business data, and low cost per transaction. Public blockchain is too slow and expensive; a centralized database would not solve the multi-party trust problem since no single entity should control all records.

Question 2: An IoT startup wants to add blockchain to a single-company smart thermostat system. The company owns all devices and all data flows through their cloud. What should they do?

  1. Use Ethereum smart contracts for temperature logging
  2. Use Hyperledger Fabric for enterprise-grade performance
  3. Do not use blockchain – a traditional database is simpler, faster, and cheaper for single-party systems
  4. Use IOTA for feeless device transactions

c) Do not use blockchain. Blockchain’s value comes from decentralized trust between parties who do not trust each other. When a single company controls all devices and data, there is no multi-party trust problem to solve. A traditional database provides faster performance, lower cost, and simpler architecture. Adding blockchain would only increase complexity without benefit.

139.7 Knowledge Check

139.8 What’s Next?

You’ve learned the fundamentals of blockchain technology and how different blockchain types suit different IoT scenarios. Continue your journey:

Next Topic Description
Smart Contracts for IoT Self-executing code for IoT agreements and architectural patterns
Blockchain Limitations and Implementations Scalability challenges and real-world deployments like Walmart and Helium
Blockchain Interactive Lab Build a working blockchain on ESP32 with hash chains and mining