github.com/tenywen/fabric@v1.0.0-beta.0.20170620030522-a5b1ed380643/docs/source/Fabric-FAQ.rst (about) 1 Hyperledger Fabric FAQs 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 represents a subset of 28 participants that are authorized to see the data for the chaincodes that are deployed 29 to that channel. 30 Second, within a channel you can restrict the input data to chaincode to the set of 31 endorsers only, by using visibility settings. The visibility setting will determine 32 whether input and output chaincode data is included in the submitted transaction, versus just 33 output data. 34 Third, you can hash or encrypt the data before calling chaincode. If you hash 35 the data then you will need a way to share the source data outside of fabric. If you encrypt 36 the data then you will need a way to share the decryption keys outside of fabric. 37 Fourth, you can restrict data access to certain roles in your organization, by building 38 access control into the chaincode logic. 39 Fifth, ledger data at rest can be encrypted via file system encryption on the peer, and data in 40 transit is encrypted via TLS. 41 42 Q. Do the orderers see the transaction data? 43 44 A. No, the orderers only order transactions, they do not open the transactions. 45 If you do not want the data to go through the orderers at all, and you are only concerned 46 about the input data, then you can use visibility settings. The visibility setting will determine 47 whether input and output chaincode data is included in the submitted transaction, versus just 48 output data. Therefore the input data can be private to the endorsers only. 49 If you do not want the orderers to see chaincode output, then you can hash or encrypt the data 50 before calling chaincode. If you hash the data then you will need a way to share the source data 51 outside of fabric. If you encrypt the data then you will need a way to share the decryption keys 52 outside of fabric. 53 54 Application-side Programming Model 55 ---------------------------------- 56 57 **Transaction execution result**: 58 59 Q. How do application clients know the outcome of a transaction? 60 61 A. The transaction simulation results are returned to the client by the endorser in the proposal 62 response. If there are multiple endorsers, the client can check that the responses are all the 63 same, and submit the results and endorsements for ordering and commitment. 64 Ultimately the committing peers will validate or invalidate the transaction, and the client becomes 65 aware of the outcome via an event, that the SDK makes available to the application client. 66 67 **Ledger queries**: 68 69 Q. How do I query the ledger data? 70 71 Within chaincode you can query based on keys. Keys can be queried by range, and composite keys can 72 be modeled to enable equivalence queries against multiple parameters. For example a composite 73 key of (owner,asset_id) can be used to query all assets owned by a certain entity. These key-based 74 queries can be used for read-only queries against the ledger, as well as in transactions that 75 update the ledger. 76 77 If you model asset data as JSON in chaincode and use CouchDB as the state database, you can also 78 perform complex rich queries against the chaincode data values, using the CouchDB JSON query 79 language within chaincode. The application client can perform read-only queries, but these 80 responses are not typically submitted as part of transactions to the ordering service. 81 82 Q. How do I query the historical data to understand data provenance? 83 84 A. The chaincode API ``GetHistoryForKey()`` will return history of 85 values for a key. 86 87 Q. How to guarantee the query result is correct, especially when the peer being 88 queried may be recovering and catching up on block processing? 89 90 A. The client can query multiple peers, compare their block heights, compare their query results, 91 and favor the peers at the higher block heights. 92 93 Chaincode (Smart Contracts and Digital Assets) 94 ---------------------------------------------- 95 96 * Does the fabric implementation support smart contract logic? 97 98 Yes. Chaincode is the fabric’s interpretation of the smart contract 99 method/algorithm, with additional features. 100 101 A chaincode is programmatic code deployed on the network, where it is 102 executed and validated by chain validators together during the consensus 103 process. Developers can use chaincodes to develop business contracts, 104 asset definitions, and collectively-managed decentralized applications. 105 106 * How do I create a business contract using the fabric? 107 108 There are generally two ways to develop business contracts: the first way is to 109 code individual contracts into standalone instances of chaincode; the 110 second way, and probably the more efficient way, is to use chaincode to 111 create decentralized applications that manage the life cycle of one or 112 multiple types of business contracts, and let end users instantiate 113 instances of contracts within these applications. 114 115 * How do I create assets using the fabric? 116 117 Users can use chaincode (for business rules) and membership service (for digital tokens) to 118 design assets, as well as the logic that manages them. 119 120 There are two popular approaches to defining assets in most blockchain 121 solutions: the stateless UTXO model, where account balances are encoded 122 into past transaction records; and the account model, where account 123 balances are kept in state storage space on the ledger. 124 125 Each approach carries its own benefits and drawbacks. This blockchain 126 fabric does not advocate either one over the other. Instead, one of our 127 first requirements was to ensure that both approaches can be easily 128 implemented with tools available in the fabric. 129 130 * Which languages are supported for writing chaincode? 131 132 Chaincode can be written in any programming language and executed in containers 133 inside the fabric context layer. We are also looking into developing a 134 templating language (such as Apache Velocity) that can either get 135 compiled into chaincode or have its interpreter embedded into a 136 chaincode container. 137 138 The fabric's first fully supported chaincode language is Golang, and 139 support for JavaScript and Java is planned for 2016. Support for 140 additional languages and the development of a fabric-specific templating 141 language have been discussed, and more details will be released in the 142 near future. 143 144 * Does the fabric have native currency? 145 146 No. However, if you really need a native currency for your chain network, you can develop your own 147 native currency with chaincode. One common attribute of native currency 148 is that some amount will get transacted (the chaincode defining that 149 currency will get called) every time a transaction is processed on its 150 chain. 151 152 Identity Management (Membership Service) 153 ---------------------------------------- 154 155 * What is unique about the fabric's Membership Service module? 156 157 One of the things that makes the Membership Service module stand out from 158 the pack is our implementation of the latest advances in cryptography. 159 160 In addition to ensuring private, auditable transactions, our Membership 161 Service module introduces the concept of enrollment and transaction 162 certificates. This innovation ensures that only verified owners can 163 create asset tokens, allowing an infinite number of transaction 164 certificates to be issued through parent enrollment certificates while 165 guaranteeing the private keys of asset tokens can be regenerated if 166 lost. 167 168 Issuers also have the ability revoke transaction certificates or 169 designate them to expire within a certain timeframe, allowing greater 170 control over the asset tokens they have issued. 171 172 Like most other modules on Fabric, you can always replace the 173 default module with another membership service option should the need 174 arise. 175 176 * Does its Membership Service make Fabric a centralized solution? 177 178 No. The only role of the Membership Service module is to issue digital 179 certificates to validated entities that want to participate in the 180 network. It does not execute transactions nor is it aware of how or when 181 these certificates are used in any particular network. 182 183 However, because certificates are the way networks regulate and manage 184 their users, the module serves a central regulatory and organizational 185 role. 186 187 .. Licensed under Creative Commons Attribution 4.0 International License 188 https://creativecommons.org/licenses/by/4.0/