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

     1  # Introduction
     2  
     3  In general terms, a blockchain is an immutable transaction ledger, maintained
     4  within a distributed network of _peer nodes_. These nodes each maintain a copy
     5  of the ledger by applying transactions that have been validated by a _consensus
     6  protocol_, grouped into blocks that include a hash that bind each block to the
     7  preceding block.
     8  
     9  The first and most widely recognized application of blockchain is the
    10  [Bitcoin](https://en.wikipedia.org/wiki/Bitcoin) cryptocurrency, though others
    11  have followed in its footsteps. Ethereum, an alternative cryptocurrency, took a
    12  different approach, integrating many of the same characteristics as Bitcoin but
    13  adding _smart contracts_ to create a platform for distributed applications.
    14  Bitcoin and Ethereum fall into a class of blockchain that we would classify as
    15  _public permissionless_ blockchain technology. Basically, these are public
    16  networks, open to anyone, where participants interact anonymously.
    17  
    18  As the popularity of Bitcoin, Ethereum and a few other derivative technologies
    19  grew, interest in applying the underlying technology of the blockchain,
    20  distributed ledger and distributed application platform to more innovative
    21  _enterprise_ use cases also grew. However, many enterprise use cases require
    22  performance characteristics that the permissionless blockchain technologies are
    23  unable (presently) to deliver. In addition, in many use cases, the identity of
    24  the participants is a hard requirement, such as in the case of financial
    25  transactions where Know-Your-Customer (KYC) and Anti-Money Laundering (AML)
    26  regulations must be followed.
    27  
    28  For enterprise use, we need to consider the following requirements:
    29  
    30  - Participants must be identified/identifiable
    31  - Networks need to be _permissioned_
    32  - High transaction throughput performance
    33  - Low latency of transaction confirmation
    34  - Privacy and confidentiality of transactions and data pertaining to business
    35    transactions
    36  
    37  While many early blockchain platforms are currently being _adapted_ for
    38  enterprise use, Hyperledger Fabric has been _designed_ for enterprise use from
    39  the outset. The following sections describe how Hyperledger Fabric (Fabric)
    40  differentiates itself from other blockchain platforms and describes some of the
    41  motivation for its architectural decisions.
    42  
    43  ## Hyperledger Fabric
    44  
    45  Hyperledger Fabric is an open source enterprise-grade permissioned distributed
    46  ledger technology (DLT) platform, designed for use in enterprise contexts,
    47  that delivers some key differentiating capabilities over other popular
    48  distributed ledger or blockchain platforms.
    49  
    50  One key point of differentiation is that Hyperledger was established under the
    51  Linux Foundation, which itself has a long and very successful history of
    52  nurturing open source projects under **open governance** that grow strong
    53  sustaining communities and thriving ecosystems. Hyperledger is governed by a
    54  diverse technical steering committee, and the Hyperledger Fabric project by a
    55  diverse set of maintainers from multiple organizations. It has a development
    56  community that has grown to over 35 organizations and nearly 200 developers
    57  since its earliest commits.
    58  
    59  Fabric has a highly **modular** and **configurable** architecture, enabling
    60  innovation, versatility and optimization for a broad range of industry use cases
    61  including banking, finance, insurance, healthcare, human resources, supply
    62  chain and even digital music delivery.
    63  
    64  Fabric is the first distributed ledger platform to support **smart contracts
    65  authored in general-purpose programming languages** such as Java, Go and
    66  Node.js, rather than constrained domain-specific languages (DSL). This means
    67  that most enterprises already have the skill set needed to develop smart
    68  contracts, and no additional training to learn a new language or DSL is needed.
    69  
    70  The Fabric platform is also **permissioned**, meaning that, unlike with a public
    71  permissionless network, the participants are known to each other, rather than
    72  anonymous and therefore fully untrusted. This means that while the participants
    73  may not _fully_ trust one another (they may, for example, be competitors in the
    74  same industry), a network can be operated under a governance model that is built
    75  off of what trust _does_ exist between participants, such as a legal agreement
    76  or framework for handling disputes.
    77  
    78  One of the most important of the platform's differentiators is its support for
    79  **pluggable consensus protocols** that enable the platform to be more
    80  effectively customized to fit particular use cases and trust models. For
    81  instance, when deployed within a single enterprise, or operated by a trusted
    82  authority, fully byzantine fault tolerant consensus might be considered
    83  unnecessary and an excessive drag on performance and throughput. In situations
    84  such as that, a
    85  [crash fault-tolerant](https://en.wikipedia.org/wiki/Fault_tolerance) (CFT)
    86  consensus protocol might be more than adequate whereas, in a multi-party,
    87  decentralized use case, a more traditional
    88  [byzantine fault tolerant](https://en.wikipedia.org/wiki/Byzantine_fault_tolerance)
    89  (BFT) consensus protocol might be required.
    90  
    91  Fabric can leverage consensus protocols that **do not require a native
    92  cryptocurrency** to incent costly mining or to fuel smart contract execution.
    93  Avoidance of a cryptocurrency reduces some significant risk/attack vectors,
    94  and absence of cryptographic mining operations means that the platform can be
    95  deployed with roughly the same operational cost as any other distributed system.
    96  
    97  The combination of these differentiating design features makes Fabric one of
    98  the **better performing platforms** available today both in terms of transaction
    99  processing and transaction confirmation latency, and it enables **privacy and confidentiality** of transactions and the smart contracts (what Fabric calls
   100  "chaincode") that implement them.
   101  
   102  Let's explore these differentiating features in more detail.
   103  
   104  ## Modularity
   105  
   106  Hyperledger Fabric has been specifically architected to have a modular
   107  architecture. Whether it is pluggable consensus, pluggable identity management
   108  protocols such as LDAP or OpenID Connect, key management protocols or
   109  cryptographic libraries, the platform has been designed at its core to be
   110  configured to meet the diversity of enterprise use case requirements.
   111  
   112  At a high level, Fabric is comprised of the following modular components:
   113  
   114  - A pluggable _ordering service_ establishes consensus on the order of
   115  transactions and then broadcasts blocks to peers.
   116  - A pluggable _membership service provider_ is responsible for associating
   117  entities in the network with cryptographic identities.
   118  - An optional _peer-to-peer gossip service_ disseminates the blocks output by
   119  ordering service to other peers.
   120  - Smart contracts ("chaincode") run within a container environment (e.g. Docker)
   121  for isolation. They can be written in standard programming languages but do not
   122  have direct access to the ledger state.
   123  - The ledger can be configured to support a variety of DBMSs.
   124  - A pluggable endorsement and validation policy enforcement that can be
   125  independently configured per application.
   126  
   127  There is fair agreement in the industry that there is no "one blockchain to
   128  rule them all". Hyperledger Fabric can be configured in multiple ways to
   129  satisfy the diverse solution requirements for multiple industry use cases.
   130  
   131  ## Permissioned vs Permissionless Blockchains
   132  
   133  In a permissionless blockchain, virtually anyone can participate, and every
   134  participant is anonymous. In such a context, there can be no trust other than
   135  that the state of the blockchain, prior to a certain depth, is immutable. In
   136  order to mitigate this absence of trust, permissionless blockchains typically
   137  employ a "mined" native cryptocurrency or transaction fees to provide economic
   138  incentive to offset the extraordinary costs of participating in a form of
   139  byzantine fault tolerant consensus based on "proof of work" (PoW).
   140  
   141  **Permissioned** blockchains, on the other hand, operate a blockchain amongst
   142  a set of known, identified and often vetted participants operating under a
   143  governance model that yields a certain degree of trust. A permissioned
   144  blockchain provides a way to secure the interactions among a group of entities
   145  that have a common goal but which may not fully trust each other. By relying on
   146  the identities of the participants, a permissioned blockchain can use more
   147  traditional crash fault tolerant (CFT) or byzantine fault tolerant (BFT)
   148  consensus protocols that do not require costly mining.
   149  
   150  Additionally, in such a permissioned context, the risk of a participant
   151  intentionally introducing malicious code through a smart contract is diminished.
   152  First, the participants are known to one another and all actions, whether
   153  submitting application transactions, modifying the configuration of the network
   154  or deploying a smart contract are recorded on the blockchain following an
   155  endorsement policy that was established for the network and relevant transaction
   156  type. Rather than being completely anonymous, the guilty party can be easily
   157  identified and the incident handled in accordance with the terms of the
   158  governance model.
   159  
   160  ## Smart Contracts
   161  
   162  A smart contract, or what Fabric calls "chaincode", functions as a trusted
   163  distributed application that gains its security/trust from the blockchain and
   164  the underlying consensus among the peers. It is the business logic of a
   165  blockchain application.
   166  
   167  There are three key points that apply to smart contracts, especially when
   168  applied to a platform:
   169  
   170  - many smart contracts run concurrently in the network,
   171  - they may be deployed dynamically (in many cases by anyone), and
   172  - application code should be treated as untrusted, potentially even
   173  malicious.
   174  
   175  Most existing smart-contract capable blockchain platforms follow an
   176  **order-execute** architecture in which the consensus protocol:
   177  
   178  - validates and orders transactions then propagates them to all peer nodes,
   179  - each peer then executes the transactions sequentially.
   180  
   181  The order-execute architecture can be found in virtually all existing blockchain
   182  systems, ranging from public/permissionless platforms such as
   183  [Ethereum](https://ethereum.org/) (with PoW-based consensus) to permissioned
   184  platforms such as [Tendermint](http://tendermint.com/),
   185  [Chain](http://chain.com/), and [Quorum](http://www.jpmorgan.com/global/Quorum).
   186  
   187  Smart contracts executing in a blockchain that operates with the order-execute
   188  architecture must be deterministic; otherwise, consensus might never be reached.
   189  To address the non-determinism issue, many platforms require that the smart
   190  contracts be written in a non-standard, or domain-specific language
   191  (such as [Solidity](https://solidity.readthedocs.io/en/v0.4.23/)) so that
   192  non-deterministic operations can be eliminated. This hinders wide-spread
   193  adoption because it requires developers writing smart contracts to learn a new
   194  language and may lead to programming errors.
   195  
   196  Further, since all transactions are executed sequentially by all nodes,
   197  performance and scale is limited. The fact that the smart contract code executes
   198  on every node in the system demands that complex measures be taken to protect
   199  the overall system from potentially malicious contracts in order to ensure
   200  resiliency of the overall system.
   201  
   202  ## A New Approach
   203  
   204  Fabric introduces a new architecture for transactions that we call
   205  **execute-order-validate**. It addresses the resiliency, flexibility,
   206  scalability, performance and confidentiality challenges faced by the
   207  order-execute model by separating the transaction flow into three steps:
   208  
   209  - _execute_ a transaction and check its correctness, thereby endorsing it,
   210  - _order_ transactions via a (pluggable) consensus protocol, and
   211  - _validate_ transactions against an application-specific endorsement policy
   212  before committing them to the ledger
   213  
   214  This design departs radically from the order-execute paradigm in that Fabric
   215  executes transactions before reaching final agreement on their order.
   216  
   217  In Fabric, an application-specific endorsement policy specifies which peer
   218  nodes, or how many of them, need to vouch for the correct execution of a given
   219  smart contract. Thus, each transaction need only be executed (endorsed) by the
   220  subset of the peer nodes necessary to satisfy the transaction's endorsement
   221  policy. This allows for parallel execution increasing overall performance and
   222  scale of the system. This first phase also **eliminates any non-determinism**,
   223  as inconsistent results can be filtered out before ordering.
   224  
   225  Because we have eliminated non-determinism, Fabric is the first blockchain
   226  technology that **enables use of standard programming languages**.
   227  
   228  ## Privacy and Confidentiality
   229  
   230  As we have discussed, in a public, permissionless blockchain network that
   231  leverages PoW for its consensus model, transactions are executed on every node.
   232  This means that neither can there be confidentiality of the contracts
   233  themselves, nor of the transaction data that they process. Every transaction,
   234  and the code that implements it, is visible to every node in the network. In
   235  this case, we have traded confidentiality of contract and data for byzantine
   236  fault tolerant consensus delivered by PoW.
   237  
   238  This lack of confidentiality can be problematic for many business/enterprise use
   239  cases. For example, in a network of supply-chain partners, some consumers might
   240  be given preferred rates as a means of either solidifying a relationship, or
   241  promoting additional sales. If every participant can see every contract and
   242  transaction, it becomes impossible to maintain such business relationships in a
   243  completely transparent network --- everyone will want the preferred rates!
   244  
   245  As a second example, consider the securities industry, where a trader building
   246  a position (or disposing of one) would not want her competitors to know of this,
   247  or else they will seek to get in on the game, weakening the trader's gambit.
   248  
   249  In order to address the lack of privacy and confidentiality for purposes of
   250  delivering on enterprise use case requirements, blockchain platforms have
   251  adopted a variety of approaches. All have their trade-offs.
   252  
   253  Encrypting data is one approach to providing confidentiality; however, in a
   254  permissionless network leveraging PoW for its consensus, the encrypted data is
   255  sitting on every node. Given enough time and computational resource, the
   256  encryption could be broken. For many enterprise use cases, the risk that their
   257  information could become compromised is unacceptable.
   258  
   259  Zero knowledge proofs (ZKP) are another area of research being explored to
   260  address this problem, the trade-off here being that, presently, computing a ZKP
   261  requires considerable time and computational resources. Hence, the trade-off in
   262  this case is performance for confidentiality.
   263  
   264  In a permissioned context that can leverage alternate forms of consensus, one
   265  might explore approaches that restrict the distribution of confidential
   266  information exclusively to authorized nodes.
   267  
   268  Hyperledger Fabric, being a permissioned platform, enables confidentiality
   269  through its channel architecture and [private data](./private-data/private-data.html)
   270  feature. In channels, participants on a Fabric network establish a sub-network
   271  where every member has visibility to a particular set of transactions. Thus, only
   272  those nodes that participate in a channel have access to the smart contract
   273  (chaincode) and data transacted, preserving the privacy and confidentiality of
   274  both. Private data allows collections between members on a channel, allowing
   275  much of the same protection as channels without the maintenance overhead of
   276  creating and maintaining a separate channel.
   277  
   278  ## Pluggable Consensus
   279  
   280  The ordering of transactions is delegated to a modular component for consensus
   281  that is logically decoupled from the peers that execute transactions and
   282  maintain the ledger. Specifically, the ordering service. Since consensus is
   283  modular, its implementation can be tailored to the trust assumption of a
   284  particular deployment or solution. This modular architecture allows the platform
   285  to rely on well-established toolkits for CFT (crash fault-tolerant) or BFT
   286  (byzantine fault-tolerant) ordering.
   287  
   288  Fabric currently offers a CFT ordering service implementation
   289  based on the [`etcd` library](https://coreos.com/etcd/) of the [Raft protocol](https://raft.github.io/raft.pdf).
   290  For information about currently available ordering services, check
   291  out our [conceptual documentation about ordering](./orderer/ordering_service.html).
   292  
   293  Note also that these are not mutually exclusive. A Fabric network can have
   294  multiple ordering services supporting different applications or application
   295  requirements.
   296  
   297  ## Performance and Scalability
   298  
   299  Performance of a blockchain platform can be affected by many variables such as
   300  transaction size, block size, network size, as well as limits of the hardware,
   301  etc. The Hyperledger Fabric [Performance and Scale working group](https://wiki.hyperledger.org/display/PSWG/Performance+and+Scale+Working+Group)
   302  currently works on a benchmarking framework called [Hyperledger Caliper](https://wiki.hyperledger.org/projects/caliper).
   303  
   304  Several research papers have been published studying and testing the performance
   305  capabilities of Hyperledger Fabric. The latest [scaled Fabric to 20,000 transactions per second](https://arxiv.org/abs/1901.00910).
   306  
   307  ## Conclusion
   308  
   309  Any serious evaluation of blockchain platforms should include Hyperledger Fabric
   310  in its short list.
   311  
   312  Combined, the differentiating capabilities of Fabric make it a highly scalable
   313  system for permissioned blockchains supporting flexible trust assumptions that
   314  enable the platform to support a wide range of industry use cases ranging from
   315  government, to finance, to supply-chain logistics, to healthcare and so much
   316  more.
   317  
   318  Hyperledger Fabric is the most active of the Hyperledger projects. The community
   319  building around the platform is growing steadily, and the innovation delivered
   320  with each successive release far out-paces any of the other enterprise blockchain
   321  platforms.
   322  
   323  ## Acknowledgement
   324  
   325  The preceding is derived from the peer reviewed
   326  ["Hyperledger Fabric: A Distributed Operating System for Permissioned Blockchains"](https://arxiv.org/abs/1801.10228v2) - Elli Androulaki, Artem
   327  Barger, Vita Bortnikov, Christian Cachin, Konstantinos Christidis, Angelo De
   328  Caro, David Enyeart, Christopher Ferris, Gennady Laventman, Yacov Manevich,
   329  Srinivasan Muralidharan, Chet Murthy, Binh Nguyen, Manish Sethi, Gari Singh,
   330  Keith Smith, Alessandro Sorniotti, Chrysoula Stathakopoulou, Marko Vukolic,
   331  Sharon Weed Cocco, Jason Yellick