Blockchain Basics¶
Goal¶
Blockchain is good at some kinds of processing and poor at others.
This chapter first explains the general mechanism and then places it inside the IW3IP architecture.
- understand what blockchain is used for
- explain its role in IW3IP (auditability and tamper resistance)
General Explanation¶
Minimum Concepts¶
Understand the following four terms.
- Ledger: a record of transactions
- Block: a unit that groups transactions
- Hash: fixed-size digest used for integrity checks
- Smart Contract: program executed on-chain [1]
How Blockchain Builds Trust¶
Instead of keeping records on a single server, blockchain has multiple participants share the same history and links each block with hashes, which makes the record hard to rewrite after the fact [2].
The point is not that tampering is impossible, but that tampering is easy to detect and history can be reconciled across participants.
flowchart LR
B1["Block 1<br/>transactions<br/>hash: a3f…"] --> B2["Block 2<br/>transactions<br/>previous hash: a3f…<br/>hash: 7c1…"] --> B3["Block 3<br/>transactions<br/>previous hash: 7c1…<br/>hash: e90…"]
Each block contains the hash of the block before it. Rewriting a past block changes its hash, which no longer matches the value recorded in the following block, so the change is detectable.
What It Is Good At, and What It Is Not¶
When you use blockchain, you need to decide what to record on it and what to leave to other systems.
- Good at:
- tracing who recorded what and when
- sharing history without depending entirely on one central administrator
- automating rule execution through smart contracts
- Not good at:
- storing large raw data directly
- ultra-low-latency high-throughput data streams
- storing secrets in plain form
Common Misunderstandings¶
- \"Blockchain is fast at everything\": no. Its strengths are verifiability and decentralization
- \"Put all raw data on-chain\": no. Large data is usually stored off-chain, with digests or references recorded on-chain
- \"Smart contracts are legal contracts themselves\": no. Here, treat them as programs that run according to defined conditions
Position in This System¶
Why It Matters in IW3IP¶
In centralized systems, access policy and usage history are often hidden in one operator database.
IW3IP increases transparency by keeping verifiable records for policy-related operations.
Conceptual Diagram¶
flowchart LR
A[Data Producer] --> B[Policy Decision]
B --> C[Blockchain Record]
B --> D[Platform Ingest]
C --> E[Auditable History]
Connection to IW3IP¶
The samples in this site prioritize one idea first: what to record and what not to record.
- This sample implements consent decisions and audit logs first
- On top of that, it deploys the following contracts on the Hardhat local chain and connects to them on-chain
IoTMarketandMerchandise: register and buy products, and check data hashes (Open the marketplace and buy on a phone (v1))ProvenanceToken: mints one token per detection event and records the C2PA manifest label, the image sha256, and the IPFS CID (Connect provenance to the publisher and the chain (C2PA / Stage P, P1 and P2))
What Is On-Chain vs Off-Chain Here¶
Recording something on the blockchain is called on-chain, and keeping it outside the blockchain is called off-chain.
IW3IP separates information suited to verification and audit trails from information that is large or updated frequently.
- On-chain candidates:
- contract summaries
- verification hashes
- auditable usage evidence
- Off-chain candidates:
- raw IoT data
- large media files
- high-frequency sensor streams
The figure below shows which information is on-chain and which is off-chain in the samples on this site.
flowchart LR
subgraph OFF["Off-chain"]
RAW["Raw IoT data<br>sensor streams"]
PUB["publisher<br>consent decision"]
AUD["Audit log<br>(SQLite)"]
BODY["Data and image files"]
end
subgraph ON["On-chain (Hardhat local chain)"]
MER["IoTMarket / Merchandise<br>data hash"]
PT["ProvenanceToken<br>manifest label<br>image sha256, IPFS CID"]
end
RAW --> PUB
PUB -->|"records the decision"| AUD
BODY -.->|"records the hash, etc."| MER
BODY -.->|"records the sha256, CID, etc."| PT
classDef onchain fill:#e3f2fd,stroke:#1565c0,color:#0d47a1
classDef offchain fill:#f5f5f5,stroke:#616161,color:#212121
class MER,PT onchain
class RAW,PUB,AUD,BODY offchain
The data itself stays off the chain, and the chain records only short values such as hashes. By computing the hash of the data you received and comparing it with the value on the chain, you can check that the data has not been changed. In the samples, the consent decision (audit log) is kept in SQLite, not yet on the chain.
Read Next¶
In the short learning path of the Learning Roadmap, the next page is Hardhat Basics (Blockchain Used in This Site).
References¶
[1] Ethereum Foundation, "Ethereum development documentation," https://ethereum.org/developers/docs/
[2] S. Nakamoto, "Bitcoin: A Peer-to-Peer Electronic Cash System," 2008, https://bitcoin.org/bitcoin.pdf