Learn › Blockchain & Access Control › Module 3 · Consensus
Hyperledger Fabric, chaincode and access control models
Fabric's permissioned architecture, the execute–order–validate lifecycle, chaincode determinism and lifecycle, the vaccine-batch lab, and MAC, DAC and RBAC access control.
This page condenses Part 12 of the course map; the full lecture notes for this part are being added.
Permissioned architecture
- Identity: each organisation runs a certificate authority; its Membership Service Provider (MSP) validates X.509 certificates.
- Privacy: channels are separate ledgers for subsets of members; Private Data Collections keep data with authorised peers and put only its hash on the shared ledger.
- Ledger = immutable block log + a world-state database of current values.
Execute–order–validate
- Client proposes a transaction.
- Endorsing peers simulate chaincode and produce a read-write set.
- They sign (endorse) the result.
- Client checks endorsements against the endorsement policy.
- The ordering service sequences transactions into blocks (crash-fault-tolerant Raft by default).
- Committing peers validate: endorsement policy (VSCC) and version conflicts (MVCC).
- Valid transactions are committed with the block.
- World state is updated.
Executing before ordering lets non-deterministic or conflicting transactions be caught at validation instead of corrupting state.
Chaincode
- Must be deterministic: no random numbers, local clocks or external API calls, or endorsers will disagree.
- Lifecycle: package → install on peers → approve by each organisation → commit to the channel.
- Lab case study: a vaccine batch moves CREATED → QA_RELEASED → IN_TRANSIT → RECEIVED, with each transition restricted to the right role.
Access control models
Authentication answers “who are you?” (X.509 via the MSP); authorisation answers “what may you do?”.
| Model | Who decides | Basis | Typical use |
|---|---|---|---|
| MAC (mandatory) | Central authority | Security labels and clearances | Classified or clinical data |
| DAC (discretionary) | Resource owner | Owner grants and shares rights | Commercial documents, file systems |
| RBAC (role-based) | Administrators via roles | Permissions attached to roles; least privilege | Chaincode functions by role |
Immutable ledgers and personal data clash (erasure rights): keep PII off-chain and store only hashes or references; users act through pseudonymous identities.
End-to-end example: cold-chain vaccines
- Hashing: sensor readings per leg are rolled into a Merkle root; altering one log breaks the chain.
- Public-key cryptography: ECDHE secures the gateway connection; the QA officer signs a hash of the lab report.
- Fabric: invoices live in a Private Data Collection; the endorsement policy AND(‘PharmaMSP.peer’, ‘CargoMSP.peer’) gates handovers; RBAC lets only QA call ReleaseBatch() and only the hospital call ReceiveBatch().
- Consensus: the ordering service fixes custody order so a batch cannot be sold twice; a public chain settles payment.
- Cryptocurrency: a UTXO payment with ECDSA signatures settles cross-border without correspondent banks.