github.com/s7techlab/cckit@v0.10.5/gateway/doc.md (about) 1 # Protocol Documentation 2 <a name="top"></a> 3 4 ## Table of Contents 5 6 - [chaincode.proto](#chaincode.proto) 7 - [BlockLimit](#cckit.gateway.BlockLimit) 8 - [ChaincodeEvent](#cckit.gateway.ChaincodeEvent) 9 - [ChaincodeEvents](#cckit.gateway.ChaincodeEvents) 10 - [ChaincodeEventsRequest](#cckit.gateway.ChaincodeEventsRequest) 11 - [ChaincodeEventsStreamRequest](#cckit.gateway.ChaincodeEventsStreamRequest) 12 - [ChaincodeExecRequest](#cckit.gateway.ChaincodeExecRequest) 13 - [ChaincodeInput](#cckit.gateway.ChaincodeInput) 14 - [ChaincodeInput.TransientEntry](#cckit.gateway.ChaincodeInput.TransientEntry) 15 - [ChaincodeInstanceEventsRequest](#cckit.gateway.ChaincodeInstanceEventsRequest) 16 - [ChaincodeInstanceEventsStreamRequest](#cckit.gateway.ChaincodeInstanceEventsStreamRequest) 17 - [ChaincodeInstanceExecRequest](#cckit.gateway.ChaincodeInstanceExecRequest) 18 - [ChaincodeInstanceInvokeRequest](#cckit.gateway.ChaincodeInstanceInvokeRequest) 19 - [ChaincodeInstanceQueryRequest](#cckit.gateway.ChaincodeInstanceQueryRequest) 20 - [ChaincodeInvokeRequest](#cckit.gateway.ChaincodeInvokeRequest) 21 - [ChaincodeLocator](#cckit.gateway.ChaincodeLocator) 22 - [ChaincodeQueryRequest](#cckit.gateway.ChaincodeQueryRequest) 23 - [RawJson](#cckit.gateway.RawJson) 24 25 - [InvocationType](#cckit.gateway.InvocationType) 26 27 28 - [ChaincodeEventsService](#cckit.gateway.ChaincodeEventsService) 29 - [ChaincodeInstanceEventsService](#cckit.gateway.ChaincodeInstanceEventsService) 30 - [ChaincodeInstanceService](#cckit.gateway.ChaincodeInstanceService) 31 - [ChaincodeService](#cckit.gateway.ChaincodeService) 32 33 34 - [Scalar Value Types](#scalar-value-types) 35 36 37 38 <a name="chaincode.proto"></a> 39 <p align="right"><a href="#top">Top</a></p> 40 41 ## chaincode.proto 42 Gateway to network/chaincode 43 Two types of gateways: 1. Gateway to all chaincodes in Network 2. Gateway to some concrete chaincode instance in some channel 44 45 46 <a name="cckit.gateway.BlockLimit"></a> 47 48 ### BlockLimit 49 Block limit number for event stream subscription or event list 50 Values can be negative 51 52 53 | Field | Type | Label | Description | 54 | ----- | ---- | ----- | ----------- | 55 | num | [int64](#int64) | | Block number | 56 57 58 59 60 61 62 <a name="cckit.gateway.ChaincodeEvent"></a> 63 64 ### ChaincodeEvent 65 66 67 68 | Field | Type | Label | Description | 69 | ----- | ---- | ----- | ----------- | 70 | event | [protos.ChaincodeEvent](#protos.ChaincodeEvent) | | | 71 | block | [uint64](#uint64) | | | 72 | tx_timestamp | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | 73 | payload | [RawJson](#cckit.gateway.RawJson) | | | 74 75 76 77 78 79 80 <a name="cckit.gateway.ChaincodeEvents"></a> 81 82 ### ChaincodeEvents 83 84 85 86 | Field | Type | Label | Description | 87 | ----- | ---- | ----- | ----------- | 88 | locator | [ChaincodeLocator](#cckit.gateway.ChaincodeLocator) | | | 89 | from_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 90 | to_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 91 | items | [ChaincodeEvent](#cckit.gateway.ChaincodeEvent) | repeated | | 92 93 94 95 96 97 98 <a name="cckit.gateway.ChaincodeEventsRequest"></a> 99 100 ### ChaincodeEventsRequest 101 Chaincode events list request 102 103 104 | Field | Type | Label | Description | 105 | ----- | ---- | ----- | ----------- | 106 | locator | [ChaincodeLocator](#cckit.gateway.ChaincodeLocator) | | | 107 | from_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 108 | to_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 109 | event_name | [string](#string) | repeated | | 110 | limit | [uint32](#uint32) | | | 111 112 113 114 115 116 117 <a name="cckit.gateway.ChaincodeEventsStreamRequest"></a> 118 119 ### ChaincodeEventsStreamRequest 120 Chaincode events stream request 121 122 123 | Field | Type | Label | Description | 124 | ----- | ---- | ----- | ----------- | 125 | locator | [ChaincodeLocator](#cckit.gateway.ChaincodeLocator) | | | 126 | from_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 127 | to_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 128 | event_name | [string](#string) | repeated | | 129 130 131 132 133 134 135 <a name="cckit.gateway.ChaincodeExecRequest"></a> 136 137 ### ChaincodeExecRequest 138 Chaincode execution specification 139 140 141 | Field | Type | Label | Description | 142 | ----- | ---- | ----- | ----------- | 143 | locator | [ChaincodeLocator](#cckit.gateway.ChaincodeLocator) | | | 144 | type | [InvocationType](#cckit.gateway.InvocationType) | | | 145 | input | [ChaincodeInput](#cckit.gateway.ChaincodeInput) | | | 146 147 148 149 150 151 152 <a name="cckit.gateway.ChaincodeInput"></a> 153 154 ### ChaincodeInput 155 Chaincode invocation input 156 157 158 | Field | Type | Label | Description | 159 | ----- | ---- | ----- | ----------- | 160 | args | [bytes](#bytes) | repeated | Input contains the arguments for invocation. | 161 | transient | [ChaincodeInput.TransientEntry](#cckit.gateway.ChaincodeInput.TransientEntry) | repeated | TransientMap contains data (e.g. cryptographic material) that might be used to implement some form of application-level confidentiality. The contents of this field are supposed to always be omitted from the transaction and excluded from the ledger. | 162 163 164 165 166 167 168 <a name="cckit.gateway.ChaincodeInput.TransientEntry"></a> 169 170 ### ChaincodeInput.TransientEntry 171 172 173 174 | Field | Type | Label | Description | 175 | ----- | ---- | ----- | ----------- | 176 | key | [string](#string) | | | 177 | value | [bytes](#bytes) | | | 178 179 180 181 182 183 184 <a name="cckit.gateway.ChaincodeInstanceEventsRequest"></a> 185 186 ### ChaincodeInstanceEventsRequest 187 188 189 190 | Field | Type | Label | Description | 191 | ----- | ---- | ----- | ----------- | 192 | from_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 193 | to_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 194 | event_name | [string](#string) | repeated | | 195 | limit | [uint32](#uint32) | | | 196 197 198 199 200 201 202 <a name="cckit.gateway.ChaincodeInstanceEventsStreamRequest"></a> 203 204 ### ChaincodeInstanceEventsStreamRequest 205 206 207 208 | Field | Type | Label | Description | 209 | ----- | ---- | ----- | ----------- | 210 | from_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 211 | to_block | [BlockLimit](#cckit.gateway.BlockLimit) | | | 212 | event_name | [string](#string) | repeated | | 213 214 215 216 217 218 219 <a name="cckit.gateway.ChaincodeInstanceExecRequest"></a> 220 221 ### ChaincodeInstanceExecRequest 222 223 224 225 | Field | Type | Label | Description | 226 | ----- | ---- | ----- | ----------- | 227 | type | [InvocationType](#cckit.gateway.InvocationType) | | | 228 | input | [ChaincodeInput](#cckit.gateway.ChaincodeInput) | | | 229 230 231 232 233 234 235 <a name="cckit.gateway.ChaincodeInstanceInvokeRequest"></a> 236 237 ### ChaincodeInstanceInvokeRequest 238 239 240 241 | Field | Type | Label | Description | 242 | ----- | ---- | ----- | ----------- | 243 | input | [ChaincodeInput](#cckit.gateway.ChaincodeInput) | | | 244 245 246 247 248 249 250 <a name="cckit.gateway.ChaincodeInstanceQueryRequest"></a> 251 252 ### ChaincodeInstanceQueryRequest 253 254 255 256 | Field | Type | Label | Description | 257 | ----- | ---- | ----- | ----------- | 258 | input | [ChaincodeInput](#cckit.gateway.ChaincodeInput) | | | 259 260 261 262 263 264 265 <a name="cckit.gateway.ChaincodeInvokeRequest"></a> 266 267 ### ChaincodeInvokeRequest 268 269 270 271 | Field | Type | Label | Description | 272 | ----- | ---- | ----- | ----------- | 273 | locator | [ChaincodeLocator](#cckit.gateway.ChaincodeLocator) | | | 274 | input | [ChaincodeInput](#cckit.gateway.ChaincodeInput) | | | 275 276 277 278 279 280 281 <a name="cckit.gateway.ChaincodeLocator"></a> 282 283 ### ChaincodeLocator 284 Chaincode locator - channel name and chaincode name 285 286 287 | Field | Type | Label | Description | 288 | ----- | ---- | ----- | ----------- | 289 | chaincode | [string](#string) | | Chaincode name | 290 | channel | [string](#string) | | Channel name | 291 292 293 294 295 296 297 <a name="cckit.gateway.ChaincodeQueryRequest"></a> 298 299 ### ChaincodeQueryRequest 300 301 302 303 | Field | Type | Label | Description | 304 | ----- | ---- | ----- | ----------- | 305 | locator | [ChaincodeLocator](#cckit.gateway.ChaincodeLocator) | | | 306 | input | [ChaincodeInput](#cckit.gateway.ChaincodeInput) | | | 307 308 309 310 311 312 313 <a name="cckit.gateway.RawJson"></a> 314 315 ### RawJson 316 317 318 319 | Field | Type | Label | Description | 320 | ----- | ---- | ----- | ----------- | 321 | value | [bytes](#bytes) | | | 322 323 324 325 326 327 328 329 330 <a name="cckit.gateway.InvocationType"></a> 331 332 ### InvocationType 333 Chaincode invocation type 334 335 | Name | Number | Description | 336 | ---- | ------ | ----------- | 337 | INVOCATION_TYPE_QUERY | 0 | Simulation | 338 | INVOCATION_TYPE_INVOKE | 1 | Simulation and applying to ledger | 339 340 341 342 343 344 345 346 <a name="cckit.gateway.ChaincodeEventsService"></a> 347 348 ### ChaincodeEventsService 349 Chaincode events subscription service 350 351 | Method Name | Request Type | Response Type | Description | 352 | ----------- | ------------ | ------------- | ------------| 353 | EventsStream | [ChaincodeEventsStreamRequest](#cckit.gateway.ChaincodeEventsStreamRequest) | [ChaincodeEvent](#cckit.gateway.ChaincodeEvent) stream | Chaincode events stream | 354 | Events | [ChaincodeEventsRequest](#cckit.gateway.ChaincodeEventsRequest) | [ChaincodeEvents](#cckit.gateway.ChaincodeEvents) | Chaincode events | 355 356 357 <a name="cckit.gateway.ChaincodeInstanceEventsService"></a> 358 359 ### ChaincodeInstanceEventsService 360 Chaincode instance events subscription service 361 362 | Method Name | Request Type | Response Type | Description | 363 | ----------- | ------------ | ------------- | ------------| 364 | EventsStream | [ChaincodeInstanceEventsStreamRequest](#cckit.gateway.ChaincodeInstanceEventsStreamRequest) | [ChaincodeEvent](#cckit.gateway.ChaincodeEvent) stream | Chaincode events stream | 365 | Events | [ChaincodeInstanceEventsRequest](#cckit.gateway.ChaincodeInstanceEventsRequest) | [ChaincodeEvents](#cckit.gateway.ChaincodeEvents) | Chaincode events s | 366 367 368 <a name="cckit.gateway.ChaincodeInstanceService"></a> 369 370 ### ChaincodeInstanceService 371 Chaincode instance communication service. Channel/chaincode already fixed. 372 373 | Method Name | Request Type | Response Type | Description | 374 | ----------- | ------------ | ------------- | ------------| 375 | Exec | [ChaincodeInstanceExecRequest](#cckit.gateway.ChaincodeInstanceExecRequest) | [.protos.Response](#protos.Response) | Exec: Query or Invoke | 376 | Query | [ChaincodeInstanceQueryRequest](#cckit.gateway.ChaincodeInstanceQueryRequest) | [.protos.Response](#protos.Response) | Query chaincode on home peer. Do NOT send to orderer. | 377 | Invoke | [ChaincodeInstanceInvokeRequest](#cckit.gateway.ChaincodeInstanceInvokeRequest) | [.protos.Response](#protos.Response) | Invoke chaincode on peers, according to endorsement policy and the SEND to orderer | 378 | EventsStream | [ChaincodeInstanceEventsStreamRequest](#cckit.gateway.ChaincodeInstanceEventsStreamRequest) | [ChaincodeEvent](#cckit.gateway.ChaincodeEvent) stream | Chaincode events stream | 379 | Events | [ChaincodeInstanceEventsRequest](#cckit.gateway.ChaincodeInstanceEventsRequest) | [ChaincodeEvents](#cckit.gateway.ChaincodeEvents) | Chaincode events | 380 381 382 <a name="cckit.gateway.ChaincodeService"></a> 383 384 ### ChaincodeService 385 Chaincode communication service. Allows to locate channel/chaincode. 386 387 | Method Name | Request Type | Response Type | Description | 388 | ----------- | ------------ | ------------- | ------------| 389 | Exec | [ChaincodeExecRequest](#cckit.gateway.ChaincodeExecRequest) | [.protos.Response](#protos.Response) | Exec: Query or Invoke | 390 | Query | [ChaincodeQueryRequest](#cckit.gateway.ChaincodeQueryRequest) | [.protos.Response](#protos.Response) | Query chaincode on home peer. Do NOT send to orderer. | 391 | Invoke | [ChaincodeInvokeRequest](#cckit.gateway.ChaincodeInvokeRequest) | [.protos.Response](#protos.Response) | Invoke chaincode on peers, according to endorsement policy and the SEND to orderer | 392 | EventsStream | [ChaincodeEventsStreamRequest](#cckit.gateway.ChaincodeEventsStreamRequest) | [ChaincodeEvent](#cckit.gateway.ChaincodeEvent) stream | Chaincode events stream | 393 | Events | [ChaincodeEventsRequest](#cckit.gateway.ChaincodeEventsRequest) | [ChaincodeEvents](#cckit.gateway.ChaincodeEvents) | Chaincode events | 394 395 396 397 398 399 ## Scalar Value Types 400 401 | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | 402 | ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | 403 | <a name="double" /> double | | double | double | float | float64 | double | float | Float | 404 | <a name="float" /> float | | float | float | float | float32 | float | float | Float | 405 | <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | 406 | <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | 407 | <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | 408 | <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | 409 | <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | 410 | <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | 411 | <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | 412 | <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | 413 | <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | 414 | <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | 415 | <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | 416 | <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | 417 | <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | 418