hyperledger-fabric-architecture.png

Hyperledger Fabric Architecture

16/November/2017
If you are new to hyperledger Fabric, read our previous blogs on hyperledger fabric.


In this blog, let us look at how an actual transaction is done in fabric. It would be easy to understand it as a working example.  In fabric architecture, every node will have a corresponding ‘Peer’ in the network. 
Consider two clients ‘A’ and ‘B’ engaging in a transaction.

hyperledger-fabric-architecture-1-blockchainexpert

 Here, ‘A’ trying to send a request to ‘B’, so the client application of ‘A’ will construct a transaction proposal using an available API. 
 
  A transaction proposal is nothing but a request to invoke a chaincode function, which is responsible for performing a proposed transaction in a ledger. Every proposal attach a unique signature for that particular transaction before sending the proposal to endorsers. A transaction must satisfy a set of endorsement policies before it is added to the ledger
 
Now let us see the steps involved in the transaction.
 - After constructing a transaction proposal in a correct format, the client app sends this to all endorsers. Let Peer ‘ A’ and Peer ‘B’ be the endorsers. 

hyperledger-fabric-architecture-2-blockchainexpert
 - The endorsing peers A and B on receiving the transaction proposal  will verify the following:
 a. Check whether the transaction proposal is well-formed.
 b. Verify that the proposal is not submitted earlier.
 c. Check whether the signature attached to the proposal is valid.
 d. Check whether the submitter (here Client A) is authenticated to perform the proposed transaction.
 - If it follows conditions, then the endorsing peers will invoke the specified functions of chain code and perform it against the current state of the ledger.

 - But the result of this transaction is not updated to the ledger at this stage, instead, it is sent back to the client app of ‘A’ as ‘proposal response’.
 - An endorser signature is attached to the proposal response. This is to inform that who endorsed that transaction. 

hyperledger-fabric-architecture-3-blockchainexpert

 - On receiving a proposal response, the client app analyzes the following :
    a. Check whether the response from all endorser are received 
       This is accomplished by checking the endorser signatures of each response.
     b.Check whether the endorsement policy is fulfilled.
     c. Check whether the response from all endorsers is same

 - If all the conditions are satisfied, then the client app submit the transaction to ordering service to update the ledger.
 - The ordering service doesn’t inspect transaction, instead, it simply receives transactions from all channels in the network, orders them and creates blocks of transactions.

hyperledger-fabric-architecture-4-blockchainexpert

 - Then the ordering service sends the block to all peers on the channel.

hyperledger-fabric-architecture-5-blockchainexpert
 - Each peer appends the block to the Blockchain ledger copy.
 - An event is emitted, to notify the client application that the transaction has been immutably appended to the chain

Comments

0

Leave a comment