github.com/Hnampk/fabric@v2.1.1+incompatible/docs/source/Fabric-FAQ.rst (about)

     1  Frequently Asked Questions
     2  ==========================
     3  
     4  Endorsement
     5  -----------
     6  
     7  **Endorsement architecture**:
     8  
     9  :Question:
    10    How many peers in the network need to endorse a transaction?
    11  
    12  :Answer:
    13    The number of peers required to endorse a transaction is driven by the
    14    endorsement policy that is specified in the chaincode definition.
    15  
    16  :Question:
    17    Does an application client need to connect to all peers?
    18  
    19  :Answer:
    20    Clients only need to connect to as many peers as are required by the
    21    endorsement policy for the chaincode.
    22  
    23  Security & Access Control
    24  -------------------------
    25  
    26  :Question:
    27    How do I ensure data privacy?
    28  
    29  :Answer:
    30    There are various aspects to data privacy. First, you can segregate your
    31    network into channels, where each channel represents a subset of participants
    32    that are authorized to see the data for the chaincodes that are deployed to
    33    that channel.
    34  
    35    Second, you can use `private-data <private-data/private-data.html>`_ to keep ledger data private from
    36    other organizations on the channel. A private data collection allows a
    37    defined subset of organizations on a channel the ability to endorse, commit,
    38    or query private data without having to create a separate channel.
    39    Other participants on the channel receive only a hash of the data.
    40    For more information refer to the :doc:`private_data_tutorial` tutorial.
    41    Note that the key concepts topic also explains `when to use private data instead of a channel <private-data/private-data.html#when-to-use-a-collection-within-a-channel-vs-a-separate-channel>`_.
    42  
    43    Third, as an alternative to Fabric hashing the data using private data,
    44    the client application can hash or encrypt the data before calling
    45    chaincode. If you hash the data then you will need to provide a means to
    46    share the source data. If you encrypt the data then you will need to provide
    47    a means to share the decryption keys.
    48  
    49    Fourth, you can restrict data access to certain roles in your organization, by
    50    building access control into the chaincode logic.
    51  
    52    Fifth, ledger data at rest can be encrypted via file system encryption on the
    53    peer, and data in-transit is encrypted via TLS.
    54  
    55  :Question:
    56    Do the orderers see the transaction data?
    57  
    58  :Answer:
    59    No, the orderers only order transactions, they do not open the transactions.
    60    If you do not want the data to go through the orderers at all, then utilize
    61    the private data feature of Fabric.  Alternatively, you can hash or encrypt
    62    the data in the client application before calling chaincode. If you encrypt
    63    the data then you will need to provide a means to share the decryption keys.
    64  
    65  Application-side Programming Model
    66  ----------------------------------
    67  
    68  :Question:
    69    How do application clients know the outcome of a transaction?
    70  
    71  :Answer:
    72    The transaction simulation results are returned to the client by the
    73    endorser in the proposal response.  If there are multiple endorsers, the
    74    client can check that the responses are all the same, and submit the results
    75    and endorsements for ordering and commitment. Ultimately the committing peers
    76    will validate or invalidate the transaction, and the client becomes
    77    aware of the outcome via an event, that the SDK makes available to the
    78    application client.
    79  
    80  :Question:
    81    How do I query the ledger data?
    82  
    83  :Answer:
    84    Within chaincode you can query based on keys. Keys can be queried by range,
    85    and composite keys can be modeled to enable equivalence queries against
    86    multiple parameters. For example a composite key of (owner,asset_id) can be
    87    used to query all assets owned by a certain entity. These key-based queries
    88    can be used for read-only queries against the ledger, as well as in
    89    transactions that update the ledger.
    90  
    91    If you model asset data as JSON in chaincode and use CouchDB as the state
    92    database, you can also perform complex rich queries against the chaincode
    93    data values, using the CouchDB JSON query language within chaincode. The
    94    application client can perform read-only queries, but these responses are
    95    not typically submitted as part of transactions to the ordering service.
    96  
    97  :Question:
    98    How do I query the historical data to understand data provenance?
    99  
   100  :Answer:
   101    The chaincode API ``GetHistoryForKey()`` will return history of
   102    values for a key.
   103  
   104  :Question:
   105    How to guarantee the query result is correct, especially when the peer being
   106    queried may be recovering and catching up on block processing?
   107  
   108  :Answer:
   109    The client can query multiple peers, compare their block heights, compare
   110    their query results, and favor the peers at the higher block heights.
   111  
   112  Chaincode (Smart Contracts and Digital Assets)
   113  ----------------------------------------------
   114  
   115  :Question:
   116    Does Hyperledger Fabric support smart contract logic?
   117  
   118  :Answer:
   119    Yes. We call this feature :ref:`chaincode`. It is our interpretation of the
   120    smart contract method/algorithm, with additional features.
   121  
   122    A chaincode is programmatic code deployed on the network, where it is
   123    executed and validated by chain validators together during the consensus
   124    process. Developers can use chaincodes to develop business contracts,
   125    asset definitions, and collectively-managed decentralized applications.
   126  
   127  :Question:
   128    How do I create a business contract?
   129  
   130  :Answer:
   131    There are generally two ways to develop business contracts: the first way is
   132    to code individual contracts into standalone instances of chaincode; the
   133    second way, and probably the more efficient way, is to use chaincode to
   134    create decentralized applications that manage the life cycle of one or
   135    multiple types of business contracts, and let end users instantiate
   136    instances of contracts within these applications.
   137  
   138  :Question:
   139    How do I create assets?
   140  
   141  :Answer:
   142    Users can use chaincode (for business rules) and membership service (for
   143    digital tokens) to design assets, as well as the logic that manages them.
   144  
   145    There are two popular approaches to defining assets in most blockchain
   146    solutions: the stateless UTXO model, where account balances are encoded
   147    into past transaction records; and the account model, where account
   148    balances are kept in state storage space on the ledger.
   149  
   150    Each approach carries its own benefits and drawbacks. This blockchain
   151    technology does not advocate either one over the other. Instead, one of our
   152    first requirements was to ensure that both approaches can be easily
   153    implemented.
   154  
   155  :Question:
   156    Which languages are supported for writing chaincode?
   157  
   158  :Answer:
   159    Chaincode can be written in any programming language and executed in
   160    containers. Currently, Go, Node.js and Java chaincode are supported.
   161  
   162  :Question:
   163    Does the Hyperledger Fabric have native currency?
   164  
   165  :Answer:
   166    No. However, if you really need a native currency for your chain network,
   167    you can develop your own native currency with chaincode. One common attribute
   168    of native currency is that some amount will get transacted (the chaincode
   169    defining that currency will get called) every time a transaction is processed
   170    on its chain.
   171  
   172  Differences in Most Recent Releases
   173  -----------------------------------
   174  
   175  :Question:
   176    Where can I find what  are the highlighted differences between releases?
   177  
   178  :Answer:
   179    The differences between any subsequent releases are provided together with
   180    the :doc:`releases`.
   181  
   182  :Question:
   183    Where to get help for the technical questions not answered above?
   184  
   185  :Answer:
   186    Please use `StackOverflow <https://stackoverflow.com/questions/tagged/hyperledger>`__.
   187  
   188  Ordering Service
   189  ----------------
   190  
   191  :Question:
   192    **I have an ordering service up and running and want to switch consensus
   193    algorithms. How do I do that?**
   194  
   195  :Answer:
   196    This is explicitly not supported.
   197  
   198  ..
   199  
   200  :Question:
   201    **What is the orderer system channel?**
   202  
   203  :Answer:
   204    The orderer system channel (sometimes called ordering system channel) is the
   205    channel the orderer is initially bootstrapped with. It is used to orchestrate
   206    channel creation. The orderer system channel defines consortia and the initial
   207    configuration for new channels. At channel creation time, the organization
   208    definition in the consortium, the ``/Channel`` group's values and policies, as
   209    well as the ``/Channel/Orderer`` group's values and policies, are all combined
   210    to form the new initial channel definition.
   211  
   212  ..
   213  
   214  :Question:
   215    **If I update my application channel, should I update my orderer system
   216    channel?**
   217  
   218  :Answer:
   219    Once an application channel is created, it is managed independently of any
   220    other channel (including the orderer system channel). Depending on the
   221    modification, the change may or may not be desirable to port to other
   222    channels. In general, MSP changes should be synchronized across all channels,
   223    while policy changes are more likely to be specific to a particular channel.
   224  
   225  ..
   226  
   227  :Question:
   228    **Can I have an organization act both in an ordering and application role?**
   229  
   230  :Answer:
   231    Although this is possible, it is a highly discouraged configuration. By
   232    default the ``/Channel/Orderer/BlockValidation`` policy allows any valid
   233    certificate of the ordering organizations to sign blocks. If an organization
   234    is acting both in an ordering and application role, then this policy should be
   235    updated to restrict block signers to the subset of certificates authorized for
   236    ordering.
   237  
   238  ..
   239  
   240  :Question:
   241    **I want to write a consensus implementation for Fabric. Where do I begin?**
   242  
   243  :Answer:
   244    A consensus plugin needs to implement the ``Consenter`` and ``Chain``
   245    interfaces defined in the `consensus package`_. There is a plugin built
   246    against raft_ . You can study it to learn more for your own implementation. The ordering service code can be found under
   247    the `orderer package`_.
   248  
   249  .. _consensus package: https://github.com/hyperledger/fabric/blob/release-2.0/orderer/consensus/consensus.go
   250  .. _raft: https://github.com/hyperledger/fabric/tree/release-2.0/orderer/consensus/etcdraft
   251  .. _orderer package: https://github.com/hyperledger/fabric/tree/release-2.0/orderer
   252  
   253  ..
   254  
   255  :Question:
   256    **I want to change my ordering service configurations, e.g. batch timeout,
   257    after I start the network, what should I do?**
   258  
   259  :Answer:
   260    This falls under reconfiguring the network. Please consult the topic on
   261    :doc:`commands/configtxlator`.
   262  
   263  BFT
   264  ~~~
   265  
   266  :Question:
   267    **When is a BFT version of the ordering service going to be available?**
   268  
   269  :Answer:
   270    No date has been set. We are working towards a release during the 2.x cycle,
   271    i.e. it will come with a minor version upgrade in Fabric.
   272  
   273  .. Licensed under Creative Commons Attribution 4.0 International License
   274     https://creativecommons.org/licenses/by/4.0/