@@ -20,6 +20,8 @@ option go_package = "github.com/hyperledger/fabric/protos/peer";
20
20
21
21
package protos ;
22
22
23
+ import "peer/chaincode.proto" ;
24
+
23
25
/*
24
26
The flow to get a generic transaction approved goes as follows:
25
27
@@ -140,3 +142,119 @@ message Proposal {
140
142
// ChaincodeAction message.
141
143
bytes extension = 3 ;
142
144
}
145
+
146
+ //-------- the Chaincode Proposal -----------
147
+
148
+ /*
149
+ The flow to get a CHAINCODE transaction approved goes as follows:
150
+
151
+ 1. client sends proposal to endorser
152
+ ====================================
153
+
154
+ The proposal is basically a request to do something on a chaincode, that will
155
+ result on some action - some change in the state of a chaincode and/or some
156
+ data to be committed to the ledger; a proposal in general contains a header
157
+ (with some metadata describing it, such as the type, the identity of the
158
+ invoker, the time, the ID of the chain, a cryptographic nonce..) and a payload
159
+ (the chaincode ID, invocation arguments..). Optionally, it may contain actions
160
+ that the endorser may be asked to endorse, to emulate a submitting peer. A
161
+ chaincode proposal contains the following messages:
162
+
163
+ SignedProposal
164
+ |\_ Signature (signature on the Proposal message by the creator specified in the header)
165
+ \_ Proposal
166
+ |\_ Header (the header for this proposal)
167
+ |\_ ChaincodeProposalPayload (the payload for this proposal)
168
+ \_ ChaincodeAction (the actions for this proposal - optional for a proposal)
169
+
170
+ 2. endorser sends proposal response back to client
171
+ ==================================================
172
+
173
+ The proposal response contains an endorser's response to a client's proposal. A
174
+ proposal response contains a success/error code, a response payload and a
175
+ signature (also referred to as endorsement) over the response payload. The
176
+ response payload contains a hash of the proposal (to securely link this
177
+ response to the corresponding proposal), a description of the action resulting
178
+ from the proposal and the endorser's signature over its payload. Formally, a
179
+ chaincode proposal response contains the following messages:
180
+
181
+ ProposalResponse
182
+ |\_ Endorsement (the endorser's signature over the whole response payload)
183
+ \_ ProposalResponsePayload
184
+ \_ ChaincodeAction (the actions for this proposal)
185
+
186
+ 3. client assembles endorsements into a transaction
187
+ ===================================================
188
+
189
+ A transaction message assembles one or more proposals and corresponding
190
+ responses into a message to be sent to orderers. After ordering, (batches of)
191
+ transactions are delivered to committing peers for validation and final
192
+ delivery into the ledger. A transaction contains one or more actions. Each of
193
+ them contains a header (same as that of the proposal that requested it), a
194
+ proposal payload (same as that of the proposal that requested it), a
195
+ description of the resulting action and signatures from each of the endorsers
196
+ that endorsed the action.
197
+
198
+ SignedTransaction
199
+ |\_ Signature (signature on the Transaction message by the creator specified in the header)
200
+ \_ Transaction
201
+ \_ TransactionAction (1...n)
202
+ |\_ Header (1) (the header of the proposal that requested this action)
203
+ \_ ChaincodeActionPayload (1)
204
+ |\_ ChaincodeProposalPayload (1) (payload of the proposal that requested this action)
205
+ \_ ChaincodeEndorsedAction (1)
206
+ |\_ Endorsement (1...n) (endorsers' signatures over the whole response payload)
207
+ \_ ProposalResponsePayload
208
+ \_ ChaincodeAction (the actions for this proposal)
209
+ */
210
+
211
+ // ChaincodeHeaderExtension is the Header's extentions message to be used when
212
+ // the Header's type is CHAINCODE. This extensions is used to specify which
213
+ // chaincode to invoke and what should appear on the ledger.
214
+ message ChaincodeHeaderExtension {
215
+
216
+ // The PayloadVisibility field controls to what extent the Proposal's payload
217
+ // (recall that for the type CHAINCODE, it is ChaincodeProposalPayload
218
+ // message) field will be visible in the final transaction and in the ledger.
219
+ // Ideally, it would be configurable, supporting at least 3 main “visibility
220
+ // modes”:
221
+ // 1. all bytes of the payload are visible;
222
+ // 2. only a hash of the payload is visible;
223
+ // 3. nothing is visible.
224
+ // Notice that the visibility function may be potentially part of the ESCC.
225
+ // In that case it overrides PayloadVisibility field. Finally notice that
226
+ // this field impacts the content of ProposalResponsePayload.proposalHash.
227
+ bytes payloadVisibility = 1 ;
228
+
229
+ // The ID of the chaincode to target.
230
+ ChaincodeID chaincodeID = 2 ;
231
+ }
232
+
233
+ // ChaincodeProposalPayload is the Proposal's payload message to be used when
234
+ // the Header's type is CHAINCODE. It contains the arguments for this
235
+ // invocation.
236
+ message ChaincodeProposalPayload {
237
+
238
+ // Input contains the arguments for this invocation. If this invocation
239
+ // deploys a new chaincode, ESCC/VSCC are part of this field.
240
+ bytes Input = 1 ;
241
+
242
+ // Transient contains data (e.g. cryptographic material) that might be used
243
+ // to implement some form of application-level confidentiality. The contents
244
+ // of this field are supposed to always be omitted from the transaction and
245
+ // excluded from the ledger.
246
+ bytes Transient = 2 ;
247
+ }
248
+
249
+ // ChaincodeAction contains the actions the events generated by the execution
250
+ // of the chaincode.
251
+ message ChaincodeAction {
252
+
253
+ // This field contains the read set and the write set produced by the
254
+ // chaincode executing this invocation.
255
+ bytes results = 1 ;
256
+
257
+ // This field contains the events generated by the chaincode executing this
258
+ // invocation.
259
+ bytes events = 2 ;
260
+ }
0 commit comments