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

     1  Introduction
     2  ============
     3  Hyperledger Fabric is a platform for distributed ledger solutions underpinned
     4  by a modular architecture delivering high degrees of confidentiality,
     5  resiliency, flexibility, and scalability. It is designed to support pluggable
     6  implementations of different components and accommodate the complexity and
     7  intricacies that exist across the economic ecosystem.
     8  
     9  We recommend first-time users begin by going through the rest of the
    10  introduction below in order to gain familiarity with how blockchains work
    11  and with the specific features and components of Hyperledger Fabric.
    12  
    13  Once comfortable --- or if you're already familiar with blockchain and
    14  Hyperledger Fabric --- go to :doc:`getting_started` and from there explore the
    15  demos, technical specifications, APIs, etc.
    16  
    17  What is a Blockchain?
    18  ---------------------
    19  **A Distributed Ledger**
    20  
    21  At the heart of a blockchain network is a distributed ledger that records all
    22  the transactions that take place on the network.
    23  
    24  A blockchain ledger is often described as **decentralized** because it is replicated
    25  across many network participants, each of whom **collaborate** in its maintenance.
    26  We’ll see that decentralization and collaboration are powerful attributes that
    27  mirror the way businesses exchange goods and services in the real world.
    28  
    29  .. image:: images/basic_network.png
    30  
    31  In addition to being decentralized and collaborative, the information recorded
    32  to a blockchain is append-only, using cryptographic techniques that guarantee
    33  that once a transaction has been added to the ledger it cannot be modified.
    34  This property of "immutability" makes it simple to determine the provenance of
    35  information because participants can be sure information has not been changed
    36  after the fact. It’s why blockchains are sometimes described as **systems of proof**.
    37  
    38  **Smart Contracts**
    39  
    40  To support the consistent update of information --- and to enable a whole host of
    41  ledger functions (transacting, querying, etc) --- a blockchain network uses **smart
    42  contracts** to provide controlled access to the ledger.
    43  
    44  .. image:: images/Smart_Contract.png
    45  
    46  Smart contracts are not only a key mechanism for encapsulating information
    47  and keeping it simple across the network, they can also be written to allow
    48  participants to execute certain aspects of transactions automatically.
    49  
    50  A smart contract can, for example, be written to stipulate the cost of shipping
    51  an item where the shipping charge changes depending on how quickly the item arrives.
    52  With the terms agreed to by both parties and written to the ledger,
    53  the appropriate funds change hands automatically when the item is received.
    54  
    55  **Consensus**
    56  
    57  The process of keeping the ledger transactions synchronized across the network ---
    58  to ensure that ledgers update only when transactions are approved by the appropriate
    59  participants, and that when ledgers do update, they update with the
    60  same transactions in the same order --- is called **consensus**.
    61  
    62  .. image:: images/consensus.png
    63  
    64  You'll learn a lot more about ledgers, smart contracts and consensus later. For
    65  now, it’s enough to think of a blockchain as a shared, replicated transaction
    66  system which is updated via smart contracts and kept consistently
    67  synchronized through a collaborative process called consensus.
    68  
    69  Why is a Blockchain useful?
    70  ---------------------------
    71  
    72  **Today’s Systems of Record**
    73  
    74  The transactional networks of today are little more than slightly updated
    75  versions of networks that have existed since business records have been kept.
    76  The members of a **business network** transact with each other, but they maintain
    77  separate records of their transactions. And the things they’re transacting ---
    78  whether it’s Flemish tapestries in the 16th century or the securities of today
    79  --- must have their provenance established each time they’re sold to ensure that
    80  the business selling an item possesses a chain of title verifying their
    81  ownership of it.
    82  
    83  What you’re left with is a business network that looks like this:
    84  
    85  .. image:: images/current_network.png
    86  
    87  Modern technology has taken this process from stone tablets and paper folders
    88  to hard drives and cloud platforms, but the underlying structure is the same.
    89  Unified systems for managing the identity of network participants do not exist,
    90  establishing provenance is so laborious it takes days to clear securities
    91  transactions (the world volume of which is numbered in the many trillions of
    92  dollars), contracts must be signed and executed manually, and every database in
    93  the system contains unique information and therefore represents a single point
    94  of failure.
    95  
    96  It’s impossible with today’s fractured approach to information and
    97  process sharing to build a system of record that spans a business network, even
    98  though the needs of visibility and trust are clear.
    99  
   100  **The Blockchain Difference**
   101  
   102  What if, instead of the rat’s nest of inefficiencies represented by the “modern”
   103  system of transactions, business networks had standard methods for establishing
   104  identity on the network, executing transactions, and storing data? What
   105  if establishing the provenance of an asset could be determined by looking
   106  through a list of transactions that, once written, cannot be changed, and can
   107  therefore be trusted?
   108  
   109  That business network would look more like this:
   110  
   111  .. image:: images/future_net.png
   112  
   113  This is a blockchain network, wherein every participant has their own replicated
   114  copy of the ledger. In addition to ledger information being shared, the processes
   115  which update the ledger are also shared. Unlike today’s systems, where a
   116  participant’s **private** programs are used to update their **private** ledgers,
   117  a blockchain system has **shared** programs to update **shared** ledgers.
   118  
   119  With the ability to coordinate their business network through a shared ledger,
   120  blockchain networks can reduce the time, cost, and risk associated with private
   121  information and processing while improving trust and visibility.
   122  
   123  You now know what blockchain is and why it’s useful. There are a lot of other
   124  details that are important, but they all relate to these fundamental ideas of
   125  the sharing of information and processes.
   126  
   127  What is Hyperledger Fabric?
   128  ---------------------------
   129  
   130  The Linux Foundation founded the Hyperledger project in 2015 to advance
   131  cross-industry blockchain technologies. Rather than declaring a single
   132  blockchain standard, it encourages a collaborative approach to developing
   133  blockchain technologies via a community process, with intellectual property
   134  rights that encourage open development and the adoption of key standards over
   135  time.
   136  
   137  Hyperledger Fabric is one of the blockchain projects within Hyperledger.
   138  Like other blockchain technologies, it has a ledger, uses smart contracts,
   139  and is a system by which participants manage their transactions.
   140  
   141  Where Hyperledger Fabric breaks from some other blockchain systems is that
   142  it is **private** and **permissioned**. Rather than an open permissionless system
   143  that allows unknown identities to participate in the network (requiring protocols
   144  like "proof of work" to validate transactions and secure the network), the members
   145  of a Hyperledger Fabric network enroll through a trusted **Membership Service Provider (MSP)**.
   146  
   147  Hyperledger Fabric also offers several pluggable options. Ledger data can be
   148  stored in multiple formats, consensus mechanisms can be swapped in and out,
   149  and different MSPs are supported.
   150  
   151  Hyperledger Fabric also offers the ability to create **channels**, allowing a group of
   152  participants to create a separate ledger of transactions. This is an especially
   153  important option for networks where some participants might be competitors and not
   154  want every transaction they make --- a special price they're offering to some participants
   155  and not others, for example --- known to every participant. If two participants
   156  form a channel, then those participants --- and no others --- have copies of the ledger
   157  for that channel.
   158  
   159  **Shared Ledger**
   160  
   161  Hyperledger Fabric has a ledger subsystem comprising two components: the **world
   162  state** and the **transaction log**. Each participant has a copy of the ledger to
   163  every Hyperledger Fabric network they belong to.
   164  
   165  The world state component describes the state of the ledger at a given point
   166  in time. It’s the database of the ledger. The transaction log component records
   167  all transactions which have resulted in the current value of the world state;
   168  it’s the update history for the world state. The ledger, then, is a combination
   169  of the world state database and the transaction log history.
   170  
   171  The ledger has a replaceable data store for the world state. By default, this
   172  is a LevelDB key-value store database. The transaction log does not need to be
   173  pluggable. It simply records the before and after values of the ledger database
   174  being used by the blockchain network.
   175  
   176  **Smart Contracts**
   177  
   178  Hyperledger Fabric smart contracts are written in **chaincode** and are invoked
   179  by an application external to the blockchain when that application needs to
   180  interact with the ledger. In most cases, chaincode interacts only with the
   181  database component of the ledger, the world state (querying it, for example), and
   182  not the transaction log.
   183  
   184  Chaincode can be implemented in several programming languages. Currently, Go and
   185  Node are supported.
   186  
   187  **Privacy**
   188  
   189  Depending on the needs of a network, participants in a Business-to-Business
   190  (B2B) network might be extremely sensitive about how much information they share.
   191  For other networks, privacy will not be a top concern.
   192  
   193  Hyperledger Fabric supports networks where privacy (using channels) is a key
   194  operational requirement as well as networks that are comparatively open.
   195  
   196  **Consensus**
   197  
   198  Transactions must be written to the ledger in the order in which they occur,
   199  even though they might be between different sets of participants within the
   200  network. For this to happen, the order of transactions must be established
   201  and a method for rejecting bad transactions that have been inserted into the
   202  ledger in error (or maliciously) must be put into place.
   203  
   204  This is a thoroughly researched area of computer science, and there are many
   205  ways to achieve it, each with different trade-offs. For example, PBFT (Practical
   206  Byzantine Fault Tolerance) can provide a mechanism for file replicas to
   207  communicate with each other to keep each copy consistent, even in the event
   208  of corruption. Alternatively, in Bitcoin, ordering happens through a process
   209  called mining where competing computers race to solve a cryptographic puzzle
   210  which defines the order that all processes subsequently build upon.
   211  
   212  Hyperledger Fabric has been designed to allow network starters to choose a
   213  consensus mechanism that best represents the relationships that exist between
   214  participants. As with privacy, there is a spectrum of needs; from networks
   215  that are highly structured in their relationships to those that are more
   216  peer-to-peer.
   217  
   218  .. Licensed under Creative Commons Attribution 4.0 International License
   219     https://creativecommons.org/licenses/by/4.0/