github.com/kaituanwang/hyperledger@v2.0.1+incompatible/docs/source/peers/peers.md (about)

     1  # Peers
     2  
     3  A blockchain network is comprised primarily of a set of *peer nodes* (or, simply, *peers*).
     4  Peers are a fundamental element of the network because they host ledgers and smart
     5  contracts. Recall that a ledger immutably records all the transactions generated
     6  by smart contracts (which in Hyperledger Fabric are contained in a *chaincode*,
     7  more on this later). Smart contracts and ledgers are used to encapsulate the
     8  shared *processes* and shared *information* in a network, respectively. These
     9  aspects of a peer make them a good starting point to understand a Fabric network.
    10  
    11  Other elements of the blockchain network are of course important: ledgers and
    12  smart contracts, orderers, policies, channels, applications, organizations,
    13  identities, and membership, and you can read more about them in their own
    14  dedicated sections. This section focusses on peers, and their relationship to those
    15  other elements in a Fabric network.
    16  
    17  ![Peer1](./peers.diagram.1.png)
    18  
    19  *A blockchain network is comprised of peer nodes, each of which can hold copies
    20  of ledgers and copies of smart contracts. In this example, the network N
    21  consists of peers P1, P2 and P3, each of which maintain their own instance of
    22  the distributed ledger L1. P1, P2 and P3 use the same chaincode, S1, to access
    23  their copy of that distributed ledger*.
    24  
    25  Peers can be created, started, stopped, reconfigured, and even deleted. They
    26  expose a set of APIs that enable administrators and applications to interact
    27  with the services that they provide. We'll learn more about these services in
    28  this section.
    29  
    30  ### A word on terminology
    31  
    32  Fabric implements **smart contracts** with a technology concept it calls
    33  **chaincode** --- simply a piece of code that accesses the ledger, written in
    34  one of the supported programming languages. In this topic, we'll usually use the
    35  term **chaincode**, but feel free to read it as **smart contract** if you're
    36  more used to that term. It's the same thing! If you want to learn more about
    37  chaincode and smart contracts, check out our [documentation on smart contracts
    38  and chaincode](../smartcontract/smartcontract.html).
    39  
    40  ## Ledgers and Chaincode
    41  
    42  Let's look at a peer in a little more detail. We can see that it's the peer that
    43  hosts both the ledger and chaincode. More accurately, the peer actually hosts
    44  *instances* of the ledger, and *instances* of chaincode. Note that this provides
    45  a deliberate redundancy in a Fabric network --- it avoids single points of
    46  failure. We'll learn more about the distributed and decentralized nature of a
    47  blockchain network later in this section.
    48  
    49  ![Peer2](./peers.diagram.2.png)
    50  
    51  *A peer hosts instances of ledgers and instances of chaincodes. In this example,
    52  P1 hosts an instance of ledger L1 and an instance of chaincode S1. There
    53  can be many ledgers and chaincodes hosted on an individual peer.*
    54  
    55  Because a peer is a *host* for ledgers and chaincodes, applications and
    56  administrators must interact with a peer if they want to access these resources.
    57  That's why peers are considered the most fundamental building blocks of a
    58  Fabric network. When a peer is first created, it has neither ledgers nor
    59  chaincodes. We'll see later how ledgers get created, and how chaincodes get
    60  installed, on peers.
    61  
    62  ### Multiple Ledgers
    63  
    64  A peer is able to host more than one ledger, which is helpful because it allows
    65  for a flexible system design. The simplest configuration is for a peer to manage a
    66  single ledger, but it's absolutely appropriate for a peer to host two or more
    67  ledgers when required.
    68  
    69  ![Peer3](./peers.diagram.3.png)
    70  
    71  *A peer hosting multiple ledgers. Peers host one or more ledgers, and each
    72  ledger has zero or more chaincodes that apply to them. In this example, we
    73  can see that the peer P1 hosts ledgers L1 and L2. Ledger L1 is accessed using
    74  chaincode S1. Ledger L2 on the other hand can be accessed using chaincodes S1 and S2.*
    75  
    76  Although it is perfectly possible for a peer to host a ledger instance without
    77  hosting any chaincodes which access that ledger, it's rare that peers are configured
    78  this way. The vast majority of peers will have at least one chaincode installed
    79  on it which can query or update the peer's ledger instances. It's worth
    80  mentioning in passing that, whether or not users have installed chaincodes for use by
    81  external applications, peers also have special **system chaincodes** that are
    82  always present. These are not discussed in detail in this topic.
    83  
    84  ### Multiple Chaincodes
    85  
    86  There isn't a fixed relationship between the number of ledgers a peer has and
    87  the number of chaincodes that can access that ledger. A peer might have
    88  many chaincodes and many ledgers available to it.
    89  
    90  ![Peer4](./peers.diagram.4.png)
    91  
    92  *An example of a peer hosting multiple chaincodes. Each ledger can have
    93  many chaincodes which access it. In this example, we can see that peer P1
    94  hosts ledgers L1 and L2, where L1 is accessed by chaincodes S1 and S2, and
    95  L2 is accessed by S1 and S3. We can see that S1 can access both L1 and L2.*
    96  
    97  We'll see a little later why the concept of **channels** in Fabric is important
    98  when hosting multiple ledgers or multiple chaincodes on a peer.
    99  
   100  ## Applications and Peers
   101  
   102  We're now going to show how applications interact with peers to access the
   103  ledger. Ledger-query interactions involve a simple three-step dialogue between
   104  an application and a peer; ledger-update interactions are a little more
   105  involved, and require two extra steps. We've simplified these steps a little to
   106  help you get started with Fabric, but don't worry --- what's most important to
   107  understand is the difference in application-peer interactions for ledger-query
   108  compared to ledger-update transaction styles.
   109  
   110  Applications always connect to peers when they need to access ledgers and
   111  chaincodes. The Fabric Software Development Kit (SDK) makes this
   112  easy for programmers --- its APIs enable applications to connect to peers, invoke
   113  chaincodes to generate transactions, submit transactions to the network that
   114  will get ordered, validated and committed to the distributed ledger, and receive
   115  events when this process is complete.
   116  
   117  Through a peer connection, applications can execute chaincodes to query or
   118  update a ledger. The result of a ledger query transaction is returned
   119  immediately, whereas ledger updates involve a more complex interaction between
   120  applications, peers and orderers. Let's investigate this in a little more detail.
   121  
   122  ![Peer6](./peers.diagram.6.png)
   123  
   124  *Peers, in conjunction with orderers, ensure that the ledger is kept up-to-date
   125  on every peer. In this example, application A connects to P1 and invokes
   126  chaincode S1 to query or update the ledger L1. P1 invokes S1 to generate a
   127  proposal response that contains a query result or a proposed ledger update.
   128  Application A receives the proposal response and, for queries,
   129  the process is now complete. For updates, A builds a transaction
   130  from all of the responses, which it sends to O1 for ordering. O1 collects
   131  transactions from across the network into blocks, and distributes these to all
   132  peers, including P1. P1 validates the transaction before committing to L1. Once L1
   133  is updated, P1 generates an event, received by A, to signify completion.*
   134  
   135  A peer can return the results of a query to an application immediately since
   136  all of the information required to satisfy the query is in the peer's local copy of
   137  the ledger. Peers never consult with other peers in order to respond to a query from
   138  an application. Applications can, however, connect to one or more peers to issue
   139  a query; for example, to corroborate a result between multiple peers, or
   140  retrieve a more up-to-date result from a different peer if there's a suspicion
   141  that information might be out of date. In the diagram, you can see that ledger
   142  query is a simple three-step process.
   143  
   144  An update transaction starts in the same way as a query transaction, but has two
   145  extra steps. Although ledger-updating applications also connect to peers to
   146  invoke a chaincode, unlike with ledger-querying applications, an individual peer
   147  cannot perform a ledger update at this time, because other peers must first
   148  agree to the change --- a process called **consensus**. Therefore, peers return
   149  to the application a **proposed** update --- one that this peer would apply
   150  subject to other peers' prior agreement. The first extra step --- step four ---
   151  requires that applications send an appropriate set of matching proposed updates
   152  to the entire network of peers as a transaction for commitment to their
   153  respective ledgers. This is achieved by the application by using an **orderer** to
   154  package transactions into blocks, and distributing them to the entire network of
   155  peers, where they can be verified before being applied to each peer's local copy
   156  of the ledger. As this whole ordering processing takes some time to complete
   157  (seconds), the application is notified asynchronously, as shown in step five.
   158  
   159  Later in this section, you'll learn more about the detailed nature of this
   160  ordering process --- and for a really detailed look at this process see the
   161  [Transaction Flow](../txflow.html) topic.
   162  
   163  ## Peers and Channels
   164  
   165  Although this section is about peers rather than channels, it's worth spending a
   166  little time understanding how peers interact with each other, and with applications,
   167  via *channels* --- a mechanism by which a set of components within a blockchain
   168  network can communicate and transact *privately*.
   169  
   170  These components are typically peer nodes, orderer nodes and applications and,
   171  by joining a channel, they agree to collaborate to collectively share and
   172  manage identical copies of the ledger associated with that channel. Conceptually, you can
   173  think of channels as being similar to groups of friends (though the members of a
   174  channel certainly don't need to be friends!). A person might have several groups
   175  of friends, with each group having activities they do together. These groups
   176  might be totally separate (a group of work friends as compared to a group of
   177  hobby friends), or there can be some crossover between them. Nevertheless, each group
   178  is its own entity, with "rules" of a kind.
   179  
   180  ![Peer5](./peers.diagram.5.png)
   181  
   182  *Channels allow a specific set of peers and applications to communicate with
   183  each other within a blockchain network. In this example, application A can
   184  communicate directly with peers P1 and P2 using channel C. You can think of the
   185  channel as a pathway for communications between particular applications and
   186  peers. (For simplicity, orderers are not shown in this diagram, but must be
   187  present in a functioning network.)*
   188  
   189  We see that channels don't exist in the same way that peers do --- it's more
   190  appropriate to think of a channel as a logical structure that is formed by a
   191  collection of physical peers. *It is vital to understand this point --- peers
   192  provide the control point for access to, and management of, channels*.
   193  
   194  ## Peers and Organizations
   195  
   196  Now that you understand peers and their relationship to ledgers, chaincodes
   197  and channels, you'll be able to see how multiple organizations come together to
   198  form a blockchain network.
   199  
   200  Blockchain networks are administered by a collection of organizations rather
   201  than a single organization. Peers are central to how this kind of distributed
   202  network is built because they are owned by --- and are the connection points to
   203  the network for --- these organizations.
   204  
   205  <a name="Peer8"></a>
   206  ![Peer8](./peers.diagram.8.png)
   207  
   208  *Peers in a blockchain network with multiple organizations. The blockchain
   209  network is built up from the peers owned and contributed by the different
   210  organizations. In this example, we see four organizations contributing eight
   211  peers to form a network. The channel C connects five of these peers in the
   212  network N --- P1, P3, P5, P7 and P8. The other peers owned by these
   213  organizations have not been joined to this channel, but are typically joined to
   214  at least one other channel. Applications that have been developed by a
   215  particular organization will connect to their own organization's peers as well
   216  as those of different organizations. Again,
   217  for simplicity, an orderer node is not shown in this diagram.*
   218  
   219  It's really important that you can see what's happening in the formation of a
   220  blockchain network. *The network is both formed and managed by the multiple
   221  organizations who contribute resources to it.* Peers are the resources that
   222  we're discussing in this topic, but the resources an organization provides are
   223  more than just peers. There's a principle at work here --- the network literally
   224  does not exist without organizations contributing their individual resources to
   225  the collective network. Moreover, the network grows and shrinks with the
   226  resources that are provided by these collaborating organizations.
   227  
   228  You can see that (other than the ordering service) there are no centralized
   229  resources --- in the [example above](#Peer8), the network, **N**, would not exist
   230  if the organizations did not contribute their peers. This reflects the fact that
   231  the network does not exist in any meaningful sense unless and until
   232  organizations contribute the resources that form it. Moreover, the network does
   233  not depend on any individual organization --- it will continue to exist as long
   234  as one organization remains, no matter which other organizations may come and
   235  go. This is at the heart of what it means for a network to be decentralized.
   236  
   237  Applications in different organizations, as in the [example above](#Peer8), may
   238  or may not be the same. That's because it's entirely up to an organization as to how
   239  its applications process their peers' copies of the ledger. This means that both
   240  application and presentation logic may vary from organization to organization
   241  even though their respective peers host exactly the same ledger data.
   242  
   243  Applications connect either to peers in their organization, or peers in another
   244  organization, depending on the nature of the ledger interaction that's required.
   245  For ledger-query interactions, applications typically connect to their own
   246  organization's peers. For ledger-update interactions, we'll see later why
   247  applications need to connect to peers representing *every* organization that is
   248  required to endorse the ledger update.
   249  
   250  ## Peers and Identity
   251  
   252  Now that you've seen how peers from different organizations come together to
   253  form a blockchain network, it's worth spending a few moments understanding how
   254  peers get assigned to organizations by their administrators.
   255  
   256  Peers have an identity assigned to them via a digital certificate from a
   257  particular certificate authority. You can read lots more about how X.509
   258  digital certificates work elsewhere in this guide but, for now, think of a
   259  digital certificate as being like an ID card that provides lots of verifiable
   260  information about a peer. *Each and every peer in the network is assigned a
   261  digital certificate by an administrator from its owning organization*.
   262  
   263  ![Peer9](./peers.diagram.9.png)
   264  
   265  *When a peer connects to a channel, its digital certificate identifies its
   266  owning organization via a channel MSP. In this example, P1 and P2 have
   267  identities issued by CA1. Channel C determines from a policy in its channel
   268  configuration that identities from CA1 should be associated with Org1 using
   269  ORG1.MSP. Similarly, P3 and P4 are identified by ORG2.MSP as being part of
   270  Org2.*
   271  
   272  Whenever a peer connects using a channel to a blockchain network, *a policy in
   273  the channel configuration uses the peer's identity to determine its
   274  rights.* The mapping of identity to organization is provided by a component
   275  called a *Membership Service Provider* (MSP) --- it determines how a peer gets
   276  assigned to a specific role in a particular organization and accordingly gains
   277  appropriate access to blockchain resources. Moreover, a peer can be owned only
   278  by a single organization, and is therefore associated with a single MSP. We'll
   279  learn more about peer access control later in this section, and there's an entire
   280  section on MSPs and access control policies elsewhere in this guide. But for now,
   281  think of an MSP as providing linkage between an individual identity and a
   282  particular organizational role in a blockchain network.
   283  
   284  To digress for a moment, peers as well as *everything that interacts with a
   285  blockchain network acquire their organizational identity from their digital
   286  certificate and an MSP*. Peers, applications, end users, administrators and
   287  orderers must have an identity and an associated MSP if they want to interact
   288  with a blockchain network. *We give a name to every entity that interacts with
   289  a blockchain network using an identity --- a principal.* You can learn lots
   290  more about principals and organizations elsewhere in this guide, but for now
   291  you know more than enough to continue your understanding of peers!
   292  
   293  Finally, note that it's not really important where the peer is physically
   294  located --- it could reside in the cloud, or in a data centre owned by one
   295  of the organizations, or on a local machine --- it's the digital certificate
   296  associated with it that identifies it as being owned by a particular organization.
   297  In our example above, P3 could be hosted in Org1's data center, but as long as the
   298  digital certificate associated with it is issued by CA2, then it's owned by
   299  Org2.
   300  
   301  ## Peers and Orderers
   302  
   303  We've seen that peers form the basis for a blockchain network, hosting ledgers
   304  and smart contracts which can be queried and updated by peer-connected applications.
   305  However, the mechanism by which applications and peers interact with each other
   306  to ensure that every peer's ledger is kept consistent with each other is mediated
   307  by special nodes called *orderers*, and it's to these nodes we now turn our
   308  attention.
   309  
   310  An update transaction is quite different from a query transaction because a single
   311  peer cannot, on its own, update the ledger --- updating requires the consent of other
   312  peers in the network. A peer requires other peers in the network to approve a
   313  ledger update before it can be applied to a peer's local ledger. This process is
   314  called *consensus*, which takes much longer to complete than a simple query. But when
   315  all the peers required to approve the transaction    do so, and the transaction is
   316  committed to the ledger, peers will notify their connected applications that the
   317  ledger has been updated. You're about to be shown a lot more detail about how
   318  peers and orderers manage the consensus process in this section.
   319  
   320  Specifically, applications that want to update the ledger are involved in a
   321  3-phase process, which ensures that all the peers in a blockchain network keep
   322  their ledgers consistent with each other. 
   323  
   324  * In the first phase, applications work with a subset of *endorsing peers*, each of
   325    which provide an endorsement of the proposed ledger update to the application,
   326    but do not apply the proposed update to their copy of the ledger.
   327  * In the second phase, these separate endorsements are collected together
   328    as transactions and packaged into blocks.
   329  * In the third and final phase, these blocks are distributed back to every peer where
   330    each transaction is validated before being committed to that peer's copy of the ledger.
   331  
   332  As you will see, orderer nodes are central to this process, so let's
   333  investigate in a little more detail how applications and peers use orderers to
   334  generate ledger updates that can be consistently applied to a distributed,
   335  replicated ledger.
   336  
   337  ### Phase 1: Proposal
   338  
   339  Phase 1 of the transaction workflow involves an interaction between an
   340  application and a set of peers --- it does not involve orderers. Phase 1 is only
   341  concerned with an application asking different organizations' endorsing peers to
   342  agree to the results of the proposed chaincode invocation.
   343  
   344  To start phase 1, applications generate a transaction proposal which they send
   345  to each of the required set of peers for endorsement. Each of these *endorsing peers* then
   346  independently executes a chaincode using the transaction proposal to
   347  generate a transaction proposal response. It does not apply this update to the
   348  ledger, but rather simply signs it and returns it to the application. Once the
   349  application has received a sufficient number of signed proposal responses,
   350  the first phase of the transaction flow is complete. Let's examine this phase in
   351  a little more detail.
   352  
   353  ![Peer10](./peers.diagram.10.png)
   354  
   355  *Transaction proposals are independently executed by peers who return endorsed
   356  proposal responses. In this example, application A1 generates transaction T1
   357  proposal P which it sends to both peer P1 and peer P2 on channel C. P1 executes
   358  S1 using transaction T1 proposal P generating transaction T1 response R1 which
   359  it endorses with E1. Independently, P2 executes S1 using transaction T1
   360  proposal P generating transaction T1 response R2 which it endorses with E2.
   361  Application A1 receives two endorsed responses for transaction T1, namely E1
   362  and E2.*
   363  
   364  Initially, a set of peers are chosen by the application to generate a set of
   365  proposed ledger updates. Which peers are chosen by the application? Well, that
   366  depends on the *endorsement policy* (defined for a chaincode), which defines
   367  the set of organizations that need to endorse a proposed ledger change before it
   368  can be accepted by the network. This is literally what it means to achieve
   369  consensus --- every organization who matters must have endorsed the proposed
   370  ledger change *before* it will be accepted onto any peer's ledger.
   371  
   372  A peer endorses a proposal response by adding its digital signature, and signing
   373  the entire payload using its private key. This endorsement can be subsequently
   374  used to prove that this organization's peer generated a particular response. In
   375  our example, if peer P1 is owned by organization Org1, endorsement E1
   376  corresponds to a digital proof that "Transaction T1 response R1 on ledger L1 has
   377  been provided by Org1's peer P1!".
   378  
   379  Phase 1 ends when the application receives signed proposal responses from
   380  sufficient peers. We note that different peers can return different and
   381  therefore inconsistent transaction responses to the application *for the same
   382  transaction proposal*. It might simply be that the result was generated at
   383  different times on different peers with ledgers at different states, in which
   384  case an application can simply request a more up-to-date proposal response. Less
   385  likely, but much more seriously, results might be different because the chaincode
   386  is *non-deterministic*. Non-determinism is the enemy of chaincodes
   387  and ledgers and if it occurs it indicates a serious problem with the proposed
   388  transaction, as inconsistent results cannot, obviously, be applied to ledgers.
   389  An individual peer cannot know that their transaction result is
   390  non-deterministic --- transaction responses must be gathered together for
   391  comparison before non-determinism can be detected. (Strictly speaking, even this
   392  is not enough, but we defer this discussion to the transaction section, where
   393  non-determinism is discussed in detail.)
   394  
   395  At the end of phase 1, the application is free to discard inconsistent
   396  transaction responses if it wishes to do so, effectively terminating the
   397  transaction workflow early. We'll see later that if an application tries to use
   398  an inconsistent set of transaction responses to update the ledger, it will be
   399  rejected.
   400  
   401  ### Phase 2: Ordering and packaging transactions into blocks
   402  
   403  The second phase of the transaction workflow is the packaging phase. The orderer
   404  is pivotal to this process --- it receives transactions containing endorsed
   405  transaction proposal responses from many applications, and orders the
   406  transactions into blocks. For more details about the
   407  ordering and packaging phase, check out our
   408  [conceptual information about the ordering phase](../orderer/ordering_service.html#phase-two-ordering-and-packaging-transactions-into-blocks).
   409  
   410  ### Phase 3: Validation and commit
   411  
   412  At the end of phase 2, we see that orderers have been responsible for the simple
   413  but vital processes of collecting proposed transaction updates, ordering them,
   414  and packaging them into blocks, ready for distribution to the peers.
   415  
   416  The final phase of the transaction workflow involves the distribution and
   417  subsequent validation of blocks from the orderer to the peers, where they can be
   418  committed to the ledger. Specifically, at each peer, every transaction within a
   419  block is validated to ensure that it has been consistently endorsed by all
   420  relevant organizations before it is committed to the ledger. Failed transactions
   421  are retained for audit, but are not committed to the ledger.
   422  
   423  ![Peer12](./peers.diagram.12.png)
   424  
   425  *The second role of an orderer node is to distribute blocks to peers. In this
   426  example, orderer O1 distributes block B2 to peer P1 and peer P2. Peer P1
   427  processes block B2, resulting in a new block being added to ledger L1 on P1.
   428  In parallel, peer P2 processes block B2, resulting in a new block being added
   429  to ledger L1 on P2. Once this process is complete, the ledger L1 has been
   430  consistently updated on peers P1 and P2, and each may inform connected
   431  applications that the transaction has been processed.*
   432  
   433  Phase 3 begins with the orderer distributing blocks to all peers connected to
   434  it. Peers are connected to orderers on channels such that when a new block is
   435  generated, all of the peers connected to the orderer will be sent a copy of the
   436  new block. Each peer will process this block independently, but in exactly the
   437  same way as every other peer on the channel. In this way, we'll see that the
   438  ledger can be kept consistent. It's also worth noting that not every peer needs
   439  to be connected to an orderer --- peers can cascade blocks to other peers using
   440  the **gossip** protocol, who also can process them independently. But let's
   441  leave that discussion to another time!
   442  
   443  Upon receipt of a block, a peer will process each transaction in the sequence in
   444  which it appears in the block. For every transaction, each peer will verify that
   445  the transaction has been endorsed by the required organizations according to the
   446  *endorsement policy* of the chaincode which generated the transaction. For
   447  example, some transactions may only need to be endorsed by a single
   448  organization, whereas others may require multiple endorsements before they are
   449  considered valid. This process of validation verifies that all relevant
   450  organizations have generated the same outcome or result. Also note that this
   451  validation is different than the endorsement check in phase 1, where it is the
   452  application that receives the response from endorsing peers and makes the
   453  decision to send the proposal transactions. In case the application violates
   454  the endorsement policy by sending wrong transactions, the peer is still able to
   455  reject the transaction in the validation process of phase 3.
   456  
   457  If a transaction has been endorsed correctly, the peer will attempt to apply it
   458  to the ledger. To do this, a peer must perform a ledger consistency check to
   459  verify that the current state of the ledger is compatible with the state of the
   460  ledger when the proposed update was generated. This may not always be possible,
   461  even when the transaction has been fully endorsed. For example, another
   462  transaction may have updated the same asset in the ledger such that the
   463  transaction update is no longer valid and therefore can no longer be applied. In
   464  this way, the ledger is kept consistent across each peer in the channel because
   465  they each follow the same rules for validation.
   466  
   467  After a peer has successfully validated each individual transaction, it updates
   468  the ledger. Failed transactions are not applied to the ledger, but they are
   469  retained for audit purposes, as are successful transactions. This means that
   470  peer blocks are almost exactly the same as the blocks received from the orderer,
   471  except for a valid or invalid indicator on each transaction in the block.
   472  
   473  We also note that phase 3 does not require the running of chaincodes --- this is
   474  done only during phase 1, and that's important. It means that chaincodes only have
   475  to be available on endorsing nodes, rather than throughout the blockchain
   476  network. This is often helpful as it keeps the logic of the chaincode
   477  confidential to endorsing organizations. This is in contrast to the output of
   478  the chaincodes (the transaction proposal responses) which are shared with every
   479  peer in the channel, whether or not they endorsed the transaction. This
   480  specialization of endorsing peers is designed to help scalability and confidentiality.
   481  
   482  Finally, every time a block is committed to a peer's ledger, that peer
   483  generates an appropriate *event*. *Block events* include the full block content,
   484  while *block transaction events* include summary information only, such as
   485  whether each transaction in the block has been validated or invalidated.
   486  *Chaincode* events that the chaincode execution has produced can also be
   487  published at this time. Applications can register for these event types so
   488  that they can be notified when they occur. These notifications conclude the
   489  third and final phase of the transaction workflow.
   490  
   491  In summary, phase 3 sees the blocks which are generated by the orderer
   492  consistently applied to the ledger. The strict ordering of transactions into
   493  blocks allows each peer to validate that transaction updates are consistently
   494  applied across the blockchain network.
   495  
   496  ### Orderers and Consensus
   497  
   498  This entire transaction workflow process is called *consensus* because all peers
   499  have reached agreement on the order and content of transactions, in a process
   500  that is mediated by orderers. Consensus is a multi-step process and applications
   501  are only notified of ledger updates when the process is complete --- which may
   502  happen at slightly different times on different peers.
   503  
   504  We will discuss orderers in a lot more detail in a future orderer topic, but for
   505  now, think of orderers as nodes which collect and distribute proposed ledger
   506  updates from applications for peers to validate and include on the ledger.
   507  
   508  That's it! We've now finished our tour of peers and the other components that
   509  they relate to in Fabric. We've seen that peers are in many ways the
   510  most fundamental element --- they form the network, host chaincodes and the
   511  ledger, handle transaction proposals and responses, and keep the ledger
   512  up-to-date by consistently applying transaction updates to it.
   513  
   514  <!--- Licensed under Creative Commons Attribution 4.0 International License
   515  https://creativecommons.org/licenses/by/4.0/) -->