Skip to content

Commit 368b151

Browse files
committed
[FAB-9318] Update docs with multi endorse policy
Now that the CLI supports multiple endorsements, this CR updates the documentation to use a more robust example endorsement policy of "AND (..)" instead of "OR (...)". Change-Id: I0239558a4e2a698d62d171ba2b62733ada7e8be9 Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
1 parent d72c7a4 commit 368b151

File tree

4 files changed

+37
-28
lines changed

4 files changed

+37
-28
lines changed

docs/source/build_network.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ completion, it should report the following in your terminal window:
208208
209209
Query Result: 90
210210
2017-05-16 17:08:15.158 UTC [main] main -> INFO 008 Exiting.....
211-
===================== Query on peer1.org2 on channel 'mychannel' is successful =====================
211+
===================== Query successful on peer1.org2 on channel 'mychannel' =====================
212212
213213
===================== All GOOD, BYFN execution completed =====================
214214
@@ -680,9 +680,9 @@ argument. This is our policy where we specify the required level of endorsement
680680
for a transaction against this chaincode to be validated.
681681

682682
In the command below you’ll notice that we specify our policy as
683-
``-P "OR ('Org1MSP.peer','Org2MSP.peer')"``. This means that we need
684-
“endorsement” from a peer belonging to Org1 **OR** Org2 (i.e. only one endorsement).
685-
If we changed the syntax to ``AND`` then we would need two endorsements.
683+
``-P "AND ('Org1MSP.peer','Org2MSP.peer')"``. This means that we need
684+
“endorsement” from a peer belonging to Org1 **AND** Org2 (i.e. two endorsement).
685+
If we changed the syntax to ``OR`` then we would need only one endorsement.
686686

687687
**Golang**
688688

@@ -691,7 +691,7 @@ If we changed the syntax to ``AND`` then we would need two endorsements.
691691
# be sure to replace the $CHANNEL_NAME environment variable if you have not exported it
692692
# if you did not install your chaincode with a name of mycc, then modify that argument as well
693693
694-
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
694+
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
695695
696696
**Node.js**
697697

@@ -705,7 +705,7 @@ If we changed the syntax to ``AND`` then we would need two endorsements.
705705
# if you did not install your chaincode with a name of mycc, then modify that argument as well
706706
# notice that we must pass the -l flag after the chaincode name to identify the language
707707
708-
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
708+
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
709709
710710
See the `endorsement
711711
policies <http://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies.html>`__
@@ -743,7 +743,7 @@ update the state DB. The syntax for invoke is as follows:
743743
744744
# be sure to set the -C and -n flags appropriately
745745
746-
peer chaincode invoke -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}'
746+
peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]}'
747747
748748
Query
749749
^^^^^
@@ -816,8 +816,8 @@ What's happening behind the scenes?
816816

817817
- The instantiation also passes in an argument for the endorsement
818818
policy. The policy is defined as
819-
``-P "OR ('Org1MSP.peer','Org2MSP.peer')"``, meaning that any
820-
transaction must be endorsed by a peer tied to Org1 or Org2.
819+
``-P "AND ('Org1MSP.peer','Org2MSP.peer')"``, meaning that any
820+
transaction must be endorsed by a peer tied to Org1 and Org2.
821821

822822
- A query against the value of "a" is issued to ``peer0.org1.example.com``. The
823823
chaincode was previously installed on ``peer0.org1.example.com``, so this will start
@@ -869,7 +869,7 @@ You should see the following output:
869869
2017-05-16 17:08:01.367 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: E61DB37F4E8B0D32C9FE10E3936BA9B8CD278FAA1F3320B08712164248285C54
870870
Query Result: 90
871871
2017-05-16 17:08:15.158 UTC [main] main -> INFO 008 Exiting.....
872-
===================== Query on peer1.org2 on channel 'mychannel' is successful =====================
872+
===================== Query successful on peer1.org2 on channel 'mychannel' =====================
873873
874874
===================== All GOOD, BYFN execution completed =====================
875875

docs/source/chaincode4noah.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ the state with ``john`` and ``0``, the command would look like the following:
229229

230230
.. code:: bash
231231
232-
peer chaincode instantiate -n sacc -v 1.0 -c '{"Args":["john","0"]}' -P "OR ('Org1.member','Org2.member')"
232+
peer chaincode instantiate -n sacc -v 1.0 -c '{"Args":["john","0"]}' -P "AND ('Org1.member','Org2.member')"
233233
234234
.. note:: Note the endorsement policy (CLI uses polish notation), which requires an
235-
endorsement from either member of Org1 or Org2 for all transactions to
236-
**sacc**. That is, either Org1 or Org2 must sign the
235+
endorsement from both a member of Org1 and Org2 for all transactions to
236+
**sacc**. That is, both Org1 and Org2 must sign the
237237
result of executing the `Invoke` on **sacc** for the transactions to
238238
be valid.
239239

docs/source/commands/peerchaincode.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Usage:
7979
peer chaincode install [flags]
8080
8181
Flags:
82+
--connectionProfile string Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
8283
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
8384
-h, --help help for install
8485
-l, --lang string Language the chaincode is written in (default "golang")
@@ -111,6 +112,7 @@ Usage:
111112
Flags:
112113
-C, --channelID string The channel on which this command should be executed
113114
--collections-config string The file containing the configuration for the chaincode's collection
115+
--connectionProfile string Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
114116
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
115117
-E, --escc string The name of the endorsement system chaincode to be used for this chaincode
116118
-h, --help help for instantiate
@@ -144,6 +146,7 @@ Usage:
144146
145147
Flags:
146148
-C, --channelID string The channel on which this command should be executed
149+
--connectionProfile string Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
147150
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
148151
-h, --help help for invoke
149152
-n, --name string Name of the chaincode
@@ -172,6 +175,7 @@ Usage:
172175
173176
Flags:
174177
-C, --channelID string The channel on which this command should be executed
178+
--connectionProfile string Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
175179
-h, --help help for list
176180
--installed Get the installed chaincodes on a peer
177181
--instantiated Get the instantiated chaincodes on a channel
@@ -231,13 +235,13 @@ Usage:
231235
232236
Flags:
233237
-C, --channelID string The channel on which this command should be executed
238+
--connectionProfile string Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
234239
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
235240
-h, --help help for query
236241
-x, --hex If true, output the query value byte array in hexadecimal. Incompatible with --raw
237242
-n, --name string Name of the chaincode
238243
--peerAddresses stringArray The addresses of the peers to connect to
239244
-r, --raw If true, output the query value as raw bytes, otherwise format as a printable string
240-
-t, --tid string Name of a custom ID generation algorithm (hashing and decoding) e.g. sha256base64
241245
--tlsRootCertFiles stringArray If TLS is enabled, the paths to the TLS root cert files of the peers to connect to. The order and number of certs specified should match the --peerAddresses flag
242246
243247
Global Flags:
@@ -285,6 +289,7 @@ Usage:
285289
286290
Flags:
287291
-C, --channelID string The channel on which this command should be executed
292+
--connectionProfile string Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
288293
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
289294
-E, --escc string The name of the endorsement system chaincode to be used for this chaincode
290295
-h, --help help for upgrade
@@ -322,7 +327,7 @@ instantiates the chaincode named `mycc` at version `1.0` on channel
322327

323328
```
324329
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
325-
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
330+
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
326331
327332
2018-02-22 16:33:53.324 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
328333
2018-02-22 16:33:53.324 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
@@ -334,7 +339,7 @@ instantiates the chaincode named `mycc` at version `1.0` on channel
334339
network with TLS disabled:
335340
336341
```
337-
peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
342+
peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
338343
339344
340345
2018-02-22 16:34:09.324 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
@@ -346,11 +351,13 @@ instantiates the chaincode named `mycc` at version `1.0` on channel
346351
347352
Here is an example of the `peer chaincode invoke` command:
348353
349-
* Invoke the chaincode named `mycc` at version `1.0` on channel
350-
`mychannel`, requesting to move 10 units from variable `a` to variable `b`
354+
* Invoke the chaincode named `mycc` at version `1.0` on channel `mychannel`
355+
on `peer0.org1.example.com:7051` and `peer0.org2.example.com:7051` (the
356+
peers defined by `--peerAddresses`), requesting to move 10 units from
357+
variable `a` to variable `b`:
351358
352359
```
353-
peer chaincode invoke -o orderer.example.com:7050 -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
360+
peer chaincode invoke -o orderer.example.com:7050 -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --peerAddresses peer0.org2.example.com:7051 -c '{"Args":["invoke","a","b","10"]}'
354361
355362
2018-02-22 16:34:27.069 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
356363
2018-02-22 16:34:27.069 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
@@ -470,7 +477,7 @@ upgrades the chaincode named `mycc` at version `1.0` on channel
470477
471478
```
472479
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
473-
peer chaincode upgrade -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
480+
peer chaincode upgrade -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
474481
.
475482
.
476483
.
@@ -494,7 +501,7 @@ upgrades the chaincode named `mycc` at version `1.0` on channel
494501
network with TLS disabled:
495502
496503
```
497-
peer chaincode upgrade -o orderer.example.com:7050 -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
504+
peer chaincode upgrade -o orderer.example.com:7050 -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
498505
.
499506
.
500507
.

docs/wrappers/peer_chaincode_postscript.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ instantiates the chaincode named `mycc` at version `1.0` on channel
1111

1212
```
1313
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
14-
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
14+
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
1515
1616
2018-02-22 16:33:53.324 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
1717
2018-02-22 16:33:53.324 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
@@ -23,7 +23,7 @@ instantiates the chaincode named `mycc` at version `1.0` on channel
2323
network with TLS disabled:
2424
2525
```
26-
peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
26+
peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
2727
2828
2929
2018-02-22 16:34:09.324 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
@@ -35,11 +35,13 @@ instantiates the chaincode named `mycc` at version `1.0` on channel
3535
3636
Here is an example of the `peer chaincode invoke` command:
3737
38-
* Invoke the chaincode named `mycc` at version `1.0` on channel
39-
`mychannel`, requesting to move 10 units from variable `a` to variable `b`
38+
* Invoke the chaincode named `mycc` at version `1.0` on channel `mychannel`
39+
on `peer0.org1.example.com:7051` and `peer0.org2.example.com:7051` (the
40+
peers defined by `--peerAddresses`), requesting to move 10 units from
41+
variable `a` to variable `b`:
4042
4143
```
42-
peer chaincode invoke -o orderer.example.com:7050 -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
44+
peer chaincode invoke -o orderer.example.com:7050 -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --peerAddresses peer0.org2.example.com:7051 -c '{"Args":["invoke","a","b","10"]}'
4345
4446
2018-02-22 16:34:27.069 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
4547
2018-02-22 16:34:27.069 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
@@ -159,7 +161,7 @@ upgrades the chaincode named `mycc` at version `1.0` on channel
159161
160162
```
161163
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
162-
peer chaincode upgrade -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
164+
peer chaincode upgrade -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
163165
.
164166
.
165167
.
@@ -183,7 +185,7 @@ upgrades the chaincode named `mycc` at version `1.0` on channel
183185
network with TLS disabled:
184186
185187
```
186-
peer chaincode upgrade -o orderer.example.com:7050 -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
188+
peer chaincode upgrade -o orderer.example.com:7050 -C mychannel -n mycc -v 1.2 -c '{"Args":["init","a","100","b","200","c","300"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
187189
.
188190
.
189191
.

0 commit comments

Comments
 (0)