Peers can be subdivided as follows:
- Mandatory peers: Endorsing peers, and non-endorsing peers, also known as committers and leader peers.
- Option peers: Anchor peers. These are optional, and a blockchain network can function and exist without them.
The following are the different types of peers available:
- Endorsing peers: The preceding section covered endorsing peers in detail. Referring to the Architecture: conceptual view diagram, peers (P1 and P2) have chaincode installed by administrators of organizations (O1 and O2). Hence, they can endorse transactions, and are referred to as endorsing peers.
- Non-endorsing peers (also known as committing peers): Referring to the preceding diagram, peer P4 (owned by organization O1) does not have chaincode installed. The administrator of organization 1 (O1) chose to install chaincode only on P1, and not on P4. This highlights two points:
- Firstly, organization administrators can selectively choose to install chaincode on peers.
- Secondly, peers with chaincode installed are termed endorsing peers, and peers that do not have chaincode installed can exist on the channel. Such peers (P4) are non-endorsing peers (called committing peers). Every node on the channel is a committing peer:
- Peers such as P4 (non-endorsing peers, also known as committing peers) cannot generate transactions. However, they can accept or reject transactions to ledger (L1).
- Peers with chaincode installed can generate transactions and also endorse transactions.
- Committing peers receive blocks of transactions (transactions initiated by endorsing peers) and are validated before being committed to a local copy of the ledger (L1). Such a commit to the ledger copy (L1) by the peers (endorsers and committers) constitutes an append-only operation to the ledger.
Remember that the endorsement policy (EP #1) for chaincode, existing in channel configuration (CCon1), dictates which peers of an organization should digitally sign transaction before being appended to the ledger (L1) of the channel.
- Leader peer: Organization O1 has two peers (P1 and P4) on the channel (C1), where P1 is an endorser and P4 is a committer. Hence, transactions need to be distributed to all peers (committers) in an organization (O1). The distribution of transactions means distributing from orderers to committing peers of the organization. To ensure a transaction distribution, a peer can be defined as a leader peer (statically), or any peer can assume the role of leader (dynamically). Hence, in our sample network, for Channel-C1 and organization O1, peer P1 is dynamically defined as the leader peer, which will distribute transactions to all peers of organization 1 (O1) that are attached to Channel-C1.
- Anchor peer: For inter-organization, peer-to-peer communication, a channel requires an anchor peer. This is an optional peer and is only required when cross-organization communication is required.
A peer can be all four. Example P1 of O1 is an endorser, a committer, a leader, and can be an anchor peer as well. In addition, for a channel, there will always be one endorser, one committer, and one leader.