You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated to use 2.1 modules
Signed-off-by: Ry Jones <ry@linux.com>
Co-authored-by: Matthew B White <mbwhite@users.noreply.github.com>
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Co-authored-by: Ry Jones <ry@linux.com>
This exports two classes that together form the Contract. There can be other code that within the model that is used in a support role.
80
+
This exports two classes that together form the Contract. There can be other code that within the model that is used in a support role.
81
81
*Note that the 'contracts' word is mandatory.*
82
82
83
83
### 4: What do these classes need to contain?
@@ -124,7 +124,7 @@ Note that ALL the functions defined in these modules will be called by the clien
124
124
125
125
- There are 3 functions `setup``setNewAssetValue` and `doubleAssetValue` that can be called by issuing the appropriate invoke client side
126
126
- The `ctx` in the function is a transaction context; each time a invoke is called this will be a new instance that can be used by the function implementation to access apis such as the world state of information on invoking identity.
127
-
- The arguments are split out from the array passed on the invoke.
127
+
- The arguments are split out from the array passed on the invoke.
128
128
- The constructor contains a 'name' to help identify the sets of functions
129
129
130
130
## Running chaincode in development mode
@@ -158,29 +158,29 @@ Will get things working...
158
158
Then you can invoke the chaincode via this command.
@@ -255,17 +255,17 @@ Definitions as per https://www.ietf.org/rfc/rfc2119.txt
255
255
- as per node.js language standard
256
256
- Duplicate function names in a single class is an error
257
257
- Any function that is dynamically added will not be registered as an invokable function
258
-
- There are no specific function that is invoked per Fabric's *init* chaincode spi. The instantiate flow can pass function name and parameters; therefore consider
258
+
- There are no specific function that is invoked per Fabric's *init* chaincode spi. The instantiate flow can pass function name and parameters; therefore consider
259
259
a dedicated function that will be called for new chaincode deployments, and for upgrade deployments.
260
260
261
261
## Restrictions on programming in side a Contract function
262
262
263
263
Hyperledger Fabric's consensus algorithm permits the ability to use general purpose languages; rather than a more restrictive language. But the following restrictions apply
264
264
265
265
- Functions should not create random variables, or use any function whose return values are functions of the current time or location of execution
266
-
- i.e. the function will be executed in another context (i.e. peer process). This could potentially be in a different time zone in a different locale.
266
+
- i.e. the function will be executed in another context (i.e. peer process). This could potentially be in a different time zone in a different locale.
267
267
- Functions should be away that they may read state, and write state. But they are producing a set of changes that will be applied to the state. The implication is that updates to the state
268
-
may not be read back.
268
+
may not be read back.
269
269
270
270
```
271
271
let v1 = getState("key")
@@ -276,9 +276,9 @@ let v2 = getState("key")
276
276
v2=="world" // is false, v2 is "hello"
277
277
```
278
278
279
-
In any subsequent invocation, the value would be seen to be updated.
279
+
In any subsequent invocation, the value would be seen to be updated.
280
280
281
-
Note that if you have use any Flux architecture implications such as Redux, the above restrictions will be familiar.
281
+
Note that if you have use any Flux architecture implications such as Redux, the above restrictions will be familiar.
This exports two classes that together form the Contract. There can be other code that within the model that is used in a support role.
80
+
This exports two classes that together form the Contract. There can be other code that within the model that is used in a support role.
81
81
*Note that the 'contracts' word is mandatory.*
82
82
83
83
### 4: What do these classes need to contain?
@@ -124,7 +124,7 @@ Note that ALL the functions defined in these modules will be called by the clien
124
124
125
125
- There are 3 functions `setup``setNewAssetValue` and `doubleAssetValue` that can be called by issuing the appropriate invoke client side
126
126
- The `ctx` in the function is a transaction context; each time a invoke is called this will be a new instance that can be used by the function implementation to access apis such as the world state of information on invoking identity.
127
-
- The arguments are split out from the array passed on the invoke.
127
+
- The arguments are split out from the array passed on the invoke.
128
128
- The constructor contains a 'name' to help identify the sets of functions
129
129
130
130
## Running chaincode in development mode
@@ -158,29 +158,29 @@ Will get things working...
158
158
Then you can invoke the chaincode via this command.
@@ -255,17 +255,17 @@ Definitions as per https://www.ietf.org/rfc/rfc2119.txt
255
255
- as per node.js language standard
256
256
- Duplicate function names in a single class is an error
257
257
- Any function that is dynamically added will not be registered as an invokable function
258
-
- There are no specific function that is invoked per Fabric's *init* chaincode spi. The instantiate flow can pass function name and parameters; therefore consider
258
+
- There are no specific function that is invoked per Fabric's *init* chaincode spi. The instantiate flow can pass function name and parameters; therefore consider
259
259
a dedicated function that will be called for new chaincode deployments, and for upgrade deployments.
260
260
261
261
## Restrictions on programming in side a Contract function
262
262
263
263
Hyperledger Fabric's consensus algorithm permits the ability to use general purpose languages; rather than a more restrictive language. But the following restrictions apply
264
264
265
265
- Functions should not create random variables, or use any function whose return values are functions of the current time or location of execution
266
-
- i.e. the function will be executed in another context (i.e. peer process). This could potentially be in a different time zone in a different locale.
266
+
- i.e. the function will be executed in another context (i.e. peer process). This could potentially be in a different time zone in a different locale.
267
267
- Functions should be away that they may read state, and write state. But they are producing a set of changes that will be applied to the state. The implication is that updates to the state
268
-
may not be read back.
268
+
may not be read back.
269
269
270
270
```
271
271
let v1 = getState("key")
@@ -276,9 +276,9 @@ let v2 = getState("key")
276
276
v2=="world" // is false, v2 is "hello"
277
277
```
278
278
279
-
In any subsequent invocation, the value would be seen to be updated.
279
+
In any subsequent invocation, the value would be seen to be updated.
280
280
281
-
Note that if you have use any Flux architecture implications such as Redux, the above restrictions will be familiar.
281
+
Note that if you have use any Flux architecture implications such as Redux, the above restrictions will be familiar.
0 commit comments