Blockchain Architecture Design (Unit 3) - Simplified Version
**Course Objective (CO-3):** Learn how to deploy a business network using Hyperledger
Composer.
---
Hyperledger Fabric (A): Understanding the Consensus Process and Its
Components
#### Breaking Down the Consensus Process
In Hyperledger Fabric, reaching an agreement (consensus) on transactions is not done all at
once. It’s a step-by-step process with different roles. This makes it flexible and scalable for
various business uses.
The consensus process has three stages:
1. 1. **Endorsement:** Some trusted computers (peers) check if the transaction is valid.
2. 2. **Ordering:** The checked transactions are arranged in order.
3. 3. **Validation and Commitment:** The transactions are reviewed again and added to
the blockchain.
Let’s go deeper into each part:
##### A. Endorsement Stage
**Purpose:** Check if a transaction is valid before it is added to the system.
**Steps:**
- The client app creates a transaction request and sends it to endorsing peers.
- These peers test the transaction using chaincode (a smart contract). They don’t add it
to the blockchain yet.
- They send back the results showing what data will be read or changed, and if the
transaction meets the rules (endorsement policy).
**Endorsement Policy:**
- Each network section (channel) has its own rule.
- For example, a rule might require 2 out of 3 peers to approve a transaction.
**Result:** If enough peers approve, the transaction is sent back to the client. Nothing is
recorded on the blockchain yet.
##### B. Ordering Stage
**Purpose:** Put endorsed transactions in a set order.
**Steps:**
- The client sends the approved transaction to the ordering service.
- The ordering service gathers all transactions and arranges them into blocks.
- It doesn’t check if the transactions are valid—just puts them in order.
**Ordering Options:**
- SOLO (only for testing)
- Kafka (good for handling crashes)
- Raft (leader picks the order and ensures all are consistent)
**Result:** A block of transactions is created and sent to the peers.
##### C. Validation and Commitment Stage
**Purpose:** Confirm that transactions in the block are valid and then save them.
**Steps:**
- Peers check the block.
- They see if the endorsement rules were followed and if the data hasn’t changed since
the transaction was made.
- Valid transactions are added to the ledger.
**Result:** The transactions are now final. The blockchain is updated.
#### Consensus Algorithms Used in Hyperledger Fabric
Different methods can be used based on your needs:
- **SOLO:** Simple, only one node. Good for testing.
- **Kafka:** For large setups. Can handle crashes.
- **Raft:** Elects a leader. Great for fault tolerance.
- **Other:** Byzantine Fault Tolerance (BFT) and custom options are also possible.
#### Example Using Raft
4. 1. Client sends a request.
5. 2. Peers test and approve it.
6. 3. The approved transaction goes to the Raft ordering service.
4. The block is sent to the peers.
5. Peers double-check the rules and update the blockchain.
#### Key Points
- Three steps: Endorsement, Ordering, Validation.
- You can choose how consensus is done.
- Validation and ordering are kept separate for flexibility.
- Only valid transactions move forward.
- Chaincode handles business rules. Consensus ensures trust.
... (Content continues. Truncated here for brevity)