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

  1. Client proposes a transaction.
  2. Endorsing peers simulate chaincode and produce a read-write set.
  3. They sign (endorse) the result.
  4. Client checks endorsements against the endorsement policy.
  5. The ordering service sequences transactions into blocks (crash-fault-tolerant Raft by default).
  6. Committing peers validate: endorsement policy (VSCC) and version conflicts (MVCC).
  7. Valid transactions are committed with the block.
  8. 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?”.

ModelWho decidesBasisTypical use
MAC (mandatory)Central authoritySecurity labels and clearancesClassified or clinical data
DAC (discretionary)Resource ownerOwner grants and shares rightsCommercial documents, file systems
RBAC (role-based)Administrators via rolesPermissions attached to roles; least privilegeChaincode 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

  1. Hashing: sensor readings per leg are rolled into a Merkle root; altering one log breaks the chain.
  2. Public-key cryptography: ECDHE secures the gateway connection; the QA officer signs a hash of the lab report.
  3. 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().
  4. Consensus: the ordering service fixes custody order so a batch cannot be sold twice; a public chain settles payment.
  5. Cryptocurrency: a UTXO payment with ECDSA signatures settles cross-border without correspondent banks.