github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/docs/source/Fabric-FAQ.rst (about) 1 Hyperledger Fabric FAQ 2 ====================== 3 4 Endorsement 5 ----------- 6 7 **Endorsement architecture**: 8 9 Q. How many peers in the network need to endorse a transaction? 10 11 A. The number of peers required to endorse a transaction is driven by the endorsement 12 policy that is specified at chaincode deployment time. 13 14 Q. Does an application client need to connect to all peers? 15 16 A. Clients only need to connect to as many peers as are required by the 17 endorsement policy for the chaincode. 18 19 Security & Access Control 20 ------------------------- 21 22 **Data Privacy and Access Control**: 23 24 Q. How do I ensure data privacy? 25 26 A. There are various aspects to data privacy. 27 First, you can segregate your network into channels, where each channel 28 represents a subset of participants that are authorized to see the data 29 for the chaincodes that are deployed to that channel. 30 Second, within a channel you can restrict the input data to chaincode to the 31 set of endorsers only, by using visibility settings. The visibility setting 32 will determine whether input and output chaincode data is included in the 33 submitted transaction, versus just output data. 34 Third, you can hash or encrypt the data before calling chaincode. If you hash 35 the data then you will need to provide a means to share the source data. 36 If you encrypt the data then you will need to provide a means to share the 37 decryption keys. 38 Fourth, you can restrict data access to certain roles in your organization, by 39 building access control into the chaincode logic. 40 Fifth, ledger data at rest can be encrypted via file system encryption on 41 the peer, and data in-transit is encrypted via TLS. 42 43 Q. Do the orderers see the transaction data? 44 45 A. No, the orderers only order transactions, they do not open the transactions. 46 If you do not want the data to go through the orderers at all, and you are only 47 concerned about the input data, then you can use visibility settings. The 48 visibility setting will determine whether input and output chaincode data is 49 included in the submitted transaction, versus just output data. Therefore, 50 the input data can be private to the endorsers only. 51 If you do not want the orderers to see chaincode output, then you can hash or 52 encrypt the data before calling chaincode. If you hash the data then you will 53 need to provide a meansto share the source data. If you encrypt the data then 54 you will need to provide a means to share the decryption keys. 55 56 Application-side Programming Model 57 ---------------------------------- 58 59 **Transaction execution result**: 60 61 Q. How do application clients know the outcome of a transaction? 62 63 A. The transaction simulation results are returned to the client by the 64 endorser in the proposal response. If there are multiple endorsers, the 65 client can check that the responses are all the same, and submit the results 66 and endorsements for ordering and commitment. Ultimately the committing peers 67 will validate or invalidate the transaction, and the client becomes 68 aware of the outcome via an event, that the SDK makes available to the 69 application client. 70 71 **Ledger queries**: 72 73 Q. How do I query the ledger data? 74 75 A. Within chaincode you can query based on keys. Keys can be queried by range, 76 and composite keys can be modeled to enable equivalence queries against multiple 77 parameters. For example a composite key of (owner,asset_id) can be used to 78 query all assets owned by a certain entity. These key-based queries can be used 79 for read-only queries against the ledger, as well as in transactions that 80 update the ledger. 81 82 If you model asset data as JSON in chaincode and use CouchDB as the state 83 database, you can also perform complex rich queries against the chaincode 84 data values, using the CouchDB JSON query language within chaincode. The 85 application client can perform read-only queries, but these responses are 86 not typically submitted as part of transactions to the ordering service. 87 88 Q. How do I query the historical data to understand data provenance? 89 90 A. The chaincode API ``GetHistoryForKey()`` will return history of 91 values for a key. 92 93 Q. How to guarantee the query result is correct, especially when the peer being 94 queried may be recovering and catching up on block processing? 95 96 A. The client can query multiple peers, compare their block heights, compare 97 their query results, and favor the peers at the higher block heights. 98 99 Chaincode (Smart Contracts and Digital Assets) 100 ---------------------------------------------- 101 102 Q. Does Hyperledger Fabric support smart contract logic? 103 104 A. Yes. We call this feature :ref:`chaincode`. It is our interpretation of the 105 smart contract method/algorithm, with additional features. 106 107 A chaincode is programmatic code deployed on the network, where it is 108 executed and validated by chain validators together during the consensus 109 process. Developers can use chaincodes to develop business contracts, 110 asset definitions, and collectively-managed decentralized applications. 111 112 Q. How do I create a business contract? 113 114 A. There are generally two ways to develop business contracts: the first way is 115 to code individual contracts into standalone instances of chaincode; the 116 second way, and probably the more efficient way, is to use chaincode to 117 create decentralized applications that manage the life cycle of one or 118 multiple types of business contracts, and let end users instantiate 119 instances of contracts within these applications. 120 121 Q. How do I create assets? 122 123 A. Users can use chaincode (for business rules) and membership service (for digital tokens) to 124 design assets, as well as the logic that manages them. 125 126 There are two popular approaches to defining assets in most blockchain 127 solutions: the stateless UTXO model, where account balances are encoded 128 into past transaction records; and the account model, where account 129 balances are kept in state storage space on the ledger. 130 131 Each approach carries its own benefits and drawbacks. This blockchain 132 technology does not advocate either one over the other. Instead, one of our 133 first requirements was to ensure that both approaches can be easily 134 implemented. 135 136 Q. Which languages are supported for writing chaincode? 137 138 A. Chaincode can be written in any programming language and executed in 139 containers. The first fully supported chaincode language is Golang. 140 141 Support for additional languages and the development of a templating language 142 have been discussed, and more details will be released in the near future. 143 144 It is also possible to build Hyperledger Fabric applications using 145 `Hyperledger Composer <https://hyperledger.github.io/composer/>`__. 146 147 Q. Does the Hyperledger Fabric have native currency? 148 149 A. No. However, if you really need a native currency for your chain network, 150 you can develop your own native currency with chaincode. One common attribute 151 of native currency is that some amount will get transacted (the chaincode 152 defining that currency will get called) every time a transaction is processed 153 on its chain. 154 155 Differences in Most Recent Releases 156 ----------- 157 Q. As part of the v1.0.0 release, what are the highlight differences between v0.6 and v1.0? 158 159 A. The differences between any subsequent releases are provided together with the 160 `Release Notes <http://hyperledger-fabric.readthedocs.io/en/latest/releases.html>`__. 161 Since Fabric is a pluggable modular framework, you can refer to the `design-docs 162 <https://wiki.hyperleger.org/projects/fabric/design-docs>`__ for further information of these difference. 163 164 Q. Where to get help for the technical questions not answered above? 165 166 A. Please use `StackOverflow <https://stackoverflow.com/questions/tagged/hyperledger>`__. 167 168 169 .. Licensed under Creative Commons Attribution 4.0 International License 170 https://creativecommons.org/licenses/by/4.0/