Reputation: 362
Is there any real world example to understand this? What happens if I create 4 peers? Does all the members in the blockchain belongs to all the peers? Or I should make transaction by randomly connecting them to a peer that is available?
Upvotes: 0
Views: 879
Reputation: 4037
The peer in Hyperledger Fabric can have one (or both) of two roles: 1) endorsing node and 2) committing node. The endorsing node processes transaction proposals and it returns the signed result (the endorsement) to the application that made the proposal request.
The committing node receives a block of transactions from the ordering service and it validates that the transaction has met the endorsement policy requirements for that channel, and is valid (all of the transaction read/write sets are equal) and then commits the transaction to the ledger and updates the world state using the read/write set.
Peers belong to a given organization that is participating in the blockchain network (likely with others). It is up to the organization as to how many peers to deploy. The minimum requirement would be one that serves both roles. However, in such a topology, failure of that solo peer could result in data loss for the organization. Hence, you would likely run multiple peer nodes of each role so that they could provide the organization with a certain degree of resilience.
Now, as for "do all members of the network belong to all peers", no. However, when designing a process to be run on the blockchain, you would establish a "channel", identify the organizations participating in the channel, and you would then deploy the chaincode (smart contract) to the endorsing peer nodes for that channel (ideally with endorsing nodes spread across the organizations participating in the channel).
When processing transactions, the transaction proposals are sent only to the endorsing nodes of the organizations participating in the channel (likely, a subset of all of the peer nodes in the network), and the ordering service will publish the blocks containing those transactions only to peers belonging to the organizations participating in the channel.
I would recommend that you try the "building your first network" tutorial, as it will reinforce all of these concepts for you.
Upvotes: 4