I have heard that hyperledger has different kind of peer(node) types. I have heard that there are endorser, general, anchor, leader, orderer peers.
Question 1) Could you tell me what each of these peer's role is?
Question 2) Could you tell me what each of these peer has? I mean who has the ledger and chaincode both, who has only the ledger and not the chaincode or who has the chaincode and not the ledger?
Fundamentally there are three types of peers in hyperledger fabric
1- Endorsing peers
Endorsing peers are those peers which simulates transactions in an isolated chaincode containers and prepares transaction proposal based on smart contract results .
All endorsing peers must have chaincode installed
.
2- Comitting peers
These are the peers which dont necessarily have chaincode installed but maintain full ledger of records in their ledger . Main difference between committing and endorsing peers is that committing peers cant invoke chaincode or run smart contract functions and that include both read and write function .
3- Ordering peers(node):
Ordering peers are special type of nodes whose key roles are to receive endorsed transactions from sdk , package them into blocks as per your configuration file and send it to all other peers so that they can validate those transaction and update their ledgers . Ordering nodes keep track of all transactions in their ledger including valid transactions and invalid transactions while endorsing peers and committing peers only contain valid transactions.
Regarding anchor , leader or admin peers these are all different set of privileges which you can assign to perform some specific set of tasks . For example anchor peers used to communicate with other peers . Similarly admin peers can be used to create channels or join channels or perform some sensitive tasks which should only be performed by admins in real world.
More information on this topic can be found here
https://hyperledger-fabric.readthedocs.io/en/release-1.3/peers/peers.html