github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/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 Orderers receive endorsed transactions that are submitted from application 60 clients. The endorsed payload contains the chaincode execution results 61 including the ReadSet and WriteSet information. The orderers only validate 62 the submitter's identity and order transactions, they do not open the 63 endorsed transactions. 64 65 If you do not want the data to go through the orderers at all, then utilize 66 the private data feature of Fabric. Alternatively, you can hash or encrypt 67 the data in the client application before calling chaincode. If you encrypt 68 the data then you will need to provide a means to share the decryption keys. 69 70 Application-side Programming Model 71 ---------------------------------- 72 73 :Question: 74 How do application clients know the outcome of a transaction? 75 76 :Answer: 77 The transaction simulation results are returned to the client by the 78 endorser in the proposal response. If there are multiple endorsers, the 79 client can check that the responses are all the same, and submit the results 80 and endorsements for ordering and commitment. Ultimately the committing peers 81 will validate or invalidate the transaction, and the client becomes 82 aware of the outcome via an event, that the SDK makes available to the 83 application client. 84 85 :Question: 86 How do I query the ledger data? 87 88 :Answer: 89 Within chaincode you can query based on keys. Keys can be queried by range, 90 and composite keys can be modeled to enable equivalence queries against 91 multiple parameters. For example a composite key of (owner,asset_id) can be 92 used to query all assets owned by a certain entity. These key-based queries 93 can be used for read-only queries against the ledger, as well as in 94 transactions that update the ledger. 95 96 If you model asset data as JSON in chaincode and use CouchDB as the state 97 database, you can also perform complex rich queries against the chaincode 98 data values, using the CouchDB JSON query language within chaincode. The 99 application client can perform read-only queries, but these responses are 100 not typically submitted as part of transactions to the ordering service. 101 102 :Question: 103 How do I query the historical data to understand data provenance? 104 105 :Answer: 106 The chaincode API ``GetHistoryForKey()`` will return history of 107 values for a key. 108 109 :Question: 110 How to guarantee the query result is correct, especially when the peer being 111 queried may be recovering and catching up on block processing? 112 113 :Answer: 114 The client can query multiple peers, compare their block heights, compare 115 their query results, and favor the peers at the higher block heights. 116 117 Chaincode (Smart Contracts and Digital Assets) 118 ---------------------------------------------- 119 120 :Question: 121 Does Hechain support smart contract logic? 122 123 :Answer: 124 Yes. We call this feature :ref:`chaincode`. It is our interpretation of the 125 smart contract method/algorithm, with additional features. 126 127 A chaincode is programmatic code deployed on the network, where it is 128 executed and validated by chain validators together during the consensus 129 process. Developers can use chaincodes to develop business contracts, 130 asset definitions, and collectively-managed decentralized applications. 131 132 :Question: 133 How do I create a business contract? 134 135 :Answer: 136 There are generally two ways to develop business contracts: the first way is 137 to code individual contracts into standalone instances of chaincode; the 138 second way, and probably the more efficient way, is to use chaincode to 139 create decentralized applications that manage the life cycle of one or 140 multiple types of business contracts, and let end users instantiate 141 instances of contracts within these applications. 142 143 :Question: 144 How do I create assets? 145 146 :Answer: 147 Users can use chaincode (for business rules) and membership service (for 148 digital tokens) to design assets, as well as the logic that manages them. 149 150 There are two popular approaches to defining assets in most blockchain 151 solutions: the stateless UTXO model, where account balances are encoded 152 into past transaction records; and the account model, where account 153 balances are kept in state storage space on the ledger. 154 155 Each approach carries its own benefits and drawbacks. This blockchain 156 technology does not advocate either one over the other. Instead, one of our 157 first requirements was to ensure that both approaches can be easily 158 implemented. 159 160 :Question: 161 Which languages are supported for writing chaincode? 162 163 :Answer: 164 Chaincode can be written in any programming language and executed in 165 containers. Currently, Go, Node.js and Java chaincode are supported. 166 167 :Question: 168 Does the Hechain have native currency? 169 170 :Answer: 171 No. However, if you really need a native currency for your chain network, 172 you can develop your own native currency with chaincode. One common attribute 173 of native currency is that some amount will get transacted (the chaincode 174 defining that currency will get called) every time a transaction is processed 175 on its chain. 176 177 Differences in Most Recent Releases 178 ----------------------------------- 179 180 :Question: 181 Where can I find what are the highlighted differences between releases? 182 183 :Answer: 184 The differences between any subsequent releases are provided together with 185 the :doc:`releases`. 186 187 :Question: 188 Where to get help for the technical questions not answered above? 189 190 :Answer: 191 Please use `StackOverflow <https://stackoverflow.com/questions/tagged/hyperledger>`__. 192 193 Ordering Service 194 ---------------- 195 196 :Question: 197 **I have an ordering service up and running and want to switch consensus 198 algorithms. How do I do that?** 199 200 :Answer: 201 This is explicitly not supported. 202 203 .. 204 205 :Question: 206 **Can I have an organization act both in an ordering and application role?** 207 208 :Answer: 209 Although this is possible, it is a highly discouraged configuration. By 210 default the ``/Channel/Orderer/BlockValidation`` policy allows any valid 211 certificate of the ordering organizations to sign blocks. If an organization 212 is acting both in an ordering and application role, then this policy should be 213 updated to restrict block signers to the subset of certificates authorized for 214 ordering. 215 216 .. 217 218 :Question: 219 **I want to write a consensus implementation for Fabric. Where do I begin?** 220 221 :Answer: 222 A consensus plugin needs to implement the ``Consenter`` and ``Chain`` 223 interfaces defined in the `consensus package`_. There is a plugin built 224 against raft_ . You can study it to learn more for your own implementation. The ordering service code can be found under 225 the `orderer package`_. 226 227 .. _consensus package: https://github.com/hechain20/hechain/blob/release-2.0/orderer/consensus/consensus.go 228 .. _raft: https://github.com/hechain20/hechain/tree/release-2.0/orderer/consensus/etcdraft 229 .. _orderer package: https://github.com/hechain20/hechain/tree/release-2.0/orderer 230 231 .. 232 233 :Question: 234 **I want to change my ordering service configurations, e.g. batch timeout, 235 after I start the network, what should I do?** 236 237 :Answer: 238 This falls under reconfiguring the network. Please consult the topic on 239 :doc:`commands/configtxlator`. 240 241 BFT 242 ~~~ 243 244 :Question: 245 **When is a BFT version of the ordering service going to be available?** 246 247 :Answer: 248 No date has been set. We are working towards a release during the 2.x cycle, 249 i.e. it will come with a minor version upgrade in Fabric. 250 251 .. Licensed under Creative Commons Attribution 4.0 International License 252 https://creativecommons.org/licenses/by/4.0/