github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+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, Golang, 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 are two plugins built 246 against these interfaces already: raft_ and kafka_. You can study them to take 247 cues for your own implementation. The ordering service code can be found under 248 the `orderer package`_. 249 250 .. _consensus package: https://github.com/hyperledger/fabric/blob/master/orderer/consensus/consensus.go 251 .. _raft: https://github.com/hyperledger/fabric/tree/master/orderer/consensus/etcdraft 252 .. _kafka: https://github.com/hyperledger/fabric/tree/master/orderer/consensus/kafka 253 .. _orderer package: https://github.com/hyperledger/fabric/tree/master/orderer 254 255 .. 256 257 :Question: 258 **I want to change my ordering service configurations, e.g. batch timeout, 259 after I start the network, what should I do?** 260 261 :Answer: 262 This falls under reconfiguring the network. Please consult the topic on 263 :doc:`commands/configtxlator`. 264 265 Solo 266 ~~~~ 267 268 :Question: 269 **How can I deploy Solo in production?** 270 271 :Answer: 272 Solo is not intended for production. It is not, and will never be, fault 273 tolerant. It has been deprecated in favor of Raft and may be removed in a 274 future release. 275 276 Kafka 277 ~~~~~ 278 279 :Question: 280 **How do I remove a node from the ordering service?** 281 282 :Answer: 283 This is a two step-process: 284 285 1. Add the node's certificate to the relevant orderer's MSP CRL to prevent peers/clients from connecting to it. 286 2. Prevent the node from connecting to the Kafka cluster by leveraging standard Kafka access control measures such as TLS CRLs, or firewalling. 287 288 .. 289 290 :Question: 291 **I have never deployed a Kafka/ZK cluster before, and I want to use the 292 Kafka-based ordering service. How do I proceed?** 293 294 :Answer: 295 The Hyperledger Fabric documentation assumes the reader generally has the 296 operational expertise to setup, configure, and manage a Kafka cluster 297 (see :ref:`kafka-caveat`). If you insist on proceeding without such expertise, 298 you should complete, *at a minimum*, the first 6 steps of the 299 `Kafka Quickstart guide`_ before experimenting with the Kafka-based ordering 300 service. You can also consult `this sample configuration file`_ for a brief 301 explanation of the sensible defaults for Kafka/ZooKeeper. 302 303 .. _Kafka Quickstart guide: https://kafka.apache.org/quickstart 304 .. _this sample configuration file: https://github.com/hyperledger/fabric/blob/release-1.1/bddtests/dc-orderer-kafka.yml 305 306 .. 307 308 :Question: 309 **Where can I find a Docker composition for a network that uses the 310 Kafka-based ordering service?** 311 312 :Answer: 313 Consult `the end-to-end CLI example`_. 314 315 .. _the end-to-end CLI example: https://github.com/hyperledger/fabric/blob/release-1.3/examples/e2e_cli/docker-compose-e2e.yaml 316 317 .. 318 319 :Question: 320 **Why is there a ZooKeeper dependency in the Kafka-based ordering service?** 321 322 :Answer: 323 Kafka uses it internally for coordination between its brokers. 324 325 .. 326 327 :Question: 328 **I'm trying to follow the BYFN example and get a "service unavailable" error, 329 what should I do?** 330 331 :Answer: 332 Check the ordering service's logs. A "Rejecting deliver request because of 333 consenter error" log message is usually indicative of a connection problem 334 with the Kafka cluster. Ensure that the Kafka cluster is set up properly, and 335 is reachable by the ordering service's nodes. 336 337 BFT 338 ~~~ 339 340 :Question: 341 **When is a BFT version of the ordering service going to be available?** 342 343 :Answer: 344 No date has been set. We are working towards a release during the 1.x cycle, 345 i.e. it will come with a minor version upgrade in Fabric. Track FAB-33_ for 346 updates. 347 348 .. _FAB-33: https://jira.hyperledger.org/browse/FAB-33 349 350 .. Licensed under Creative Commons Attribution 4.0 International License 351 https://creativecommons.org/licenses/by/4.0/