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

     1  Hyperledger Fabric Model
     2  ========================
     3  
     4  This section outlines the key design features woven into Hyperledger Fabric that
     5  fulfill its promise of a comprehensive, yet customizable, enterprise blockchain solution:
     6  
     7  * :ref:`Assets` --- Asset definitions enable the exchange of almost anything with
     8    monetary value over the network, from whole foods to antique cars to currency
     9    futures.
    10  * :ref:`Chaincode` --- Chaincode execution is partitioned from transaction ordering,
    11    limiting the required levels of trust and verification across node types, and
    12    optimizing network scalability and performance.
    13  * :ref:`Ledger-Features` --- The immutable, shared ledger encodes the entire
    14    transaction history for each channel, and includes SQL-like query capability
    15    for efficient auditing and dispute resolution.
    16  * :ref:`Privacy` --- Channels and private data collections enable private and
    17    confidential multi-lateral transactions that are usually required by
    18    competing businesses and regulated industries that exchange assets on a common
    19    network.
    20  * :ref:`Security-Membership-Services` --- Permissioned membership provides a
    21    trusted blockchain network, where participants know that all transactions can
    22    be detected and traced by authorized regulators and auditors.
    23  * :ref:`Consensus` --- A unique approach to consensus enables the
    24    flexibility and scalability needed for the enterprise.
    25  
    26  .. _Assets:
    27  
    28  Assets
    29  ------
    30  
    31  Assets can range from the tangible (real estate and hardware) to the intangible
    32  (contracts and intellectual property).  Hyperledger Fabric provides the
    33  ability to modify assets using chaincode transactions.
    34  
    35  Assets are represented in Hyperledger Fabric as a collection of
    36  key-value pairs, with state changes recorded as transactions on a :ref:`Channel`
    37  ledger.  Assets can be represented in binary and/or JSON form.
    38  
    39  .. _Chaincode:
    40  
    41  Chaincode
    42  ---------
    43  
    44  Chaincode is software defining an asset or assets, and the transaction instructions for
    45  modifying the asset(s); in other words, it's the business logic.  Chaincode enforces the rules for reading
    46  or altering key-value pairs or other state database information. Chaincode functions execute against
    47  the ledger's current state database and are initiated through a transaction proposal. Chaincode execution
    48  results in a set of key-value writes (write set) that can be submitted to the network and applied to
    49  the ledger on all peers.
    50  
    51  .. _Ledger-Features:
    52  
    53  Ledger Features
    54  ---------------
    55  
    56  The ledger is the sequenced, tamper-resistant record of all state transitions in the fabric.  State
    57  transitions are a result of chaincode invocations ('transactions') submitted by participating
    58  parties.  Each transaction results in a set of asset key-value pairs that are committed to the
    59  ledger as creates, updates, or deletes.
    60  
    61  The ledger is comprised of a blockchain ('chain') to store the immutable, sequenced record in
    62  blocks, as well as a state database to maintain current fabric state.  There is one ledger per
    63  channel. Each peer maintains a copy of the ledger for each channel of which they are a member.
    64  
    65  Some features of a Fabric ledger:
    66  
    67  - Query and update ledger using key-based lookups, range queries, and composite key queries
    68  - Read-only queries using a rich query language (if using CouchDB as state database)
    69  - Read-only history queries --- Query ledger history for a key, enabling data provenance scenarios
    70  - Transactions consist of the versions of keys/values that were read in chaincode (read set) and keys/values that were written in chaincode (write set)
    71  - Transactions contain signatures of every endorsing peer and are submitted to ordering service
    72  - Transactions are ordered into blocks and are "delivered" from an ordering service to peers on a channel
    73  - Peers validate transactions against endorsement policies and enforce the policies
    74  - Prior to appending a block, a versioning check is performed to ensure that states for assets that were read have not changed since chaincode execution time
    75  - There is immutability once a transaction is validated and committed
    76  - A channel's ledger contains a configuration block defining policies, access control lists, and other pertinent information
    77  - Channels contain :ref:`MSP` instances allowing for crypto materials to be derived from different certificate authorities
    78  
    79  See the :doc:`ledger` topic for a deeper dive on the databases, storage structure, and "query-ability."
    80  
    81  .. _Privacy:
    82  
    83  Privacy
    84  -------
    85  
    86  Hyperledger Fabric employs an immutable ledger on a per-channel basis, as well as
    87  chaincode that can manipulate and modify the current state of assets (i.e. update
    88  key-value pairs).  A ledger exists in the scope of a channel --- it can be shared
    89  across the entire network (assuming every participant is operating on one common
    90  channel) --- or it can be privatized to include only a specific set of participants.
    91  
    92  In the latter scenario, these participants would create a separate channel and
    93  thereby isolate/segregate their transactions and ledger.  In order to solve
    94  scenarios that want to bridge the gap between total transparency and privacy,
    95  chaincode can be installed only on peers that need to access the asset states
    96  to perform reads and writes (in other words, if a chaincode is not installed on
    97  a peer, it will not be able to properly interface with the ledger).
    98  
    99  When a subset of organizations on that channel need to keep their transaction
   100  data confidential, a private data collection (collection) is used to segregate
   101  this data in a private database, logically separate from the channel ledger,
   102  accessible only to the authorized subset of organizations.
   103  
   104  Thus, channels keep transactions private from the broader network whereas
   105  collections keep data private between subsets of organizations on the channel.
   106  
   107  To further obfuscate the data, values within chaincode can be encrypted
   108  (in part or in total) using common cryptographic algorithms such as AES before
   109  sending transactions to the ordering service and appending blocks to the ledger.
   110  Once encrypted data has been written to the ledger, it can be decrypted only by
   111  a user in possession of the corresponding key that was used to generate the cipher
   112  text.
   113  
   114  See the :doc:`private-data-arch` topic for more details on how to achieve
   115  privacy on your blockchain network.
   116  
   117  .. _Security-Membership-Services:
   118  
   119  Security & Membership Services
   120  ------------------------------
   121  
   122  Hyperledger Fabric underpins a transactional network where all participants have
   123  known identities.  Public Key Infrastructure is used to generate cryptographic
   124  certificates which are tied to organizations, network components, and end users
   125  or client applications.  As a result, data access control can be manipulated and
   126  governed on the broader network and on channel levels.  This "permissioned" notion
   127  of Hyperledger Fabric, coupled with the existence and capabilities of channels,
   128  helps address scenarios where privacy and confidentiality are paramount concerns.
   129  
   130  See the :doc:`msp` topic to better understand cryptographic
   131  implementations, and the sign, verify, authenticate approach used in
   132  Hyperledger Fabric.
   133  
   134  .. _Consensus:
   135  
   136  Consensus
   137  ---------
   138  
   139  In distributed ledger technology, consensus has recently become synonymous with
   140  a specific algorithm, within a single function. However, consensus encompasses more
   141  than simply agreeing upon the order of transactions, and this differentiation is
   142  highlighted in Hyperledger Fabric through its fundamental role in the entire
   143  transaction flow, from proposal and endorsement, to ordering, validation and commitment.
   144  In a nutshell, consensus is defined as the full-circle verification of the correctness of
   145  a set of transactions comprising a block.
   146  
   147  Consensus is achieved ultimately when the order and results of a block's
   148  transactions have met the explicit policy criteria checks. These checks and balances
   149  take place during the lifecycle of a transaction, and include the usage of
   150  endorsement policies to dictate which specific members must endorse a certain
   151  transaction class, as well as system chaincodes to ensure that these policies
   152  are enforced and upheld.  Prior to commitment, the peers will employ these
   153  system chaincodes to make sure that enough endorsements are present, and that
   154  they were derived from the appropriate entities.  Moreover, a versioning check
   155  will take place during which the current state of the ledger is agreed or
   156  consented upon, before any blocks containing transactions are appended to the ledger.
   157  This final check provides protection against double spend operations and other
   158  threats that might compromise data integrity, and allows for functions to be
   159  executed against non-static variables.
   160  
   161  In addition to the multitude of endorsement, validity and versioning checks that
   162  take place, there are also ongoing identity verifications happening in all
   163  directions of the transaction flow.  Access control lists are implemented on
   164  hierarchical layers of the network (ordering service down to channels), and
   165  payloads are repeatedly signed, verified and authenticated as a transaction proposal passes
   166  through the different architectural components.  To conclude, consensus is not
   167  merely limited to the agreed upon order of a batch of transactions; rather,
   168  it is an overarching characterization that is achieved as a byproduct of the ongoing
   169  verifications that take place during a transaction's journey from proposal to
   170  commitment.
   171  
   172  Check out the :doc:`txflow` diagram for a visual representation
   173  of consensus.
   174  
   175  .. Licensed under Creative Commons Attribution 4.0 International License
   176     https://creativecommons.org/licenses/by/4.0/