Skip to content

Commit ddd87d2

Browse files
NIKHIL E GUPTAale-linux
authored andcommitted
[FAB-15013] Update tutorials for commands
Update tutorials to reflect queryapprovalstatus and query committed Change-Id: I2a93ba9d8468c5ba499c19ac4c106d2b6de8781a Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com> Signed-off-by: Alessandro Sorniotti <ale.linux@sopit.net>
1 parent a427104 commit ddd87d2

File tree

5 files changed

+60
-42
lines changed

5 files changed

+60
-42
lines changed

docs/source/chaincode4ade.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ the channel ledger.
3939

4040
You also need to include an ``Init`` method that will serve as the initialization
4141
function for your chaincode. This method will be called in order to initialize
42-
the chaincode when it is started or upgraded. By default, this function is never
42+
the chaincode when it is started or upgraded. By default, this function is never
4343
executed. However, you can use the chaincode definition to request that the ``Init``
4444
function be executed. If execution of ``Init`` is requested, fabric will ensure
4545
that ``Init`` is invoked before any other function and is only invoked once.
@@ -49,7 +49,7 @@ the peer CLI to approve the chaincode definition, use the ``--init-required``
4949
flag to request the execution of the ``Init`` function. Then call the ``Init``
5050
function by using the `peer chaincode invoke` command and passing the
5151
``--isInit`` flag. If you are using the Fabric SDK for Node.js, visit
52-
[How to install and start your chaincode](https://fabric-sdk-node.github.io/master/tutorial-chaincode-lifecycle.html). For more information, see :doc:`chaincode4noah`.
52+
`How to install and start your chaincode <https://fabric-sdk-node.github.io/master/tutorial-chaincode-lifecycle.html>`__. For more information, see :doc:`chaincode4noah`.
5353

5454
The other interface in the chaincode "shim" APIs is the ``ChaincodeStubInterface``:
5555

docs/source/chaincode4noah.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@ to agree on how a chaincode will be operated before it can be used on a channel.
2727
The tutorial will discuss how a chaincode operator would use the Fabric
2828
lifecycle perform the following tasks:
2929

30-
- [Install and define a chaincode](#install-and-define-a-chaincode).
31-
- [Upgrade a chaincode](#upgrade-a-chaincode).
32-
- [Migrate to the new Fabric lifecycle](#migrate-to-the-new-fabric-lifecycle).
33-
34-
_Note: The Fabric chaincode lifecycle is being introduced as an Alpha feature in
35-
Fabric v2.0. As a result, some Fabric features cannot be used with chainode that
36-
uses the new Fabric lifecycle:
37-
- *Service Discovery is not supported
38-
- *CouchDB indexes are not supported
30+
- [Install and define a chaincode](#install-and-define-a-chaincode)
31+
- [Upgrade a chaincode](#upgrade-a-chaincode)
32+
- [Migrate to the new Fabric lifecycle](#migrate-to-the-new-fabric-lifecycle)
33+
34+
_Note: The new Fabric chaincode lifecycle has limitations in the v2.0.0 alpha
35+
release. As a result, some Fabric features cannot be used with chainodes that
36+
use the new Fabric lifecycle:
37+
- Service Discovery is not supported
38+
- CouchDB indexes are not supported_
39+
3940
*To use the old lifecycle model to install and instantiate a chaincode, visit the
40-
v1.4 version of the [Chaincode for Operators tutorial](https://hyperledger-fabric.readthedocs.io/en/release-1.4/chaincode4noah.html)_
41+
v1.4 version of the [Chaincode for Operators tutorial](https://hyperledger-fabric.readthedocs.io/en/release-1.4/chaincode4noah.html)*
4142

4243
## Install and define a chaincode
4344

@@ -62,7 +63,7 @@ every organization on a channel needs to complete each step.
6263
This tutorial provides a detailed overview of the operations of the Fabric
6364
chaincode lifecycle rather than the specific commands. To learn more about how
6465
to use the Fabric lifecycle using the Peer CLI, see [Install and define a chaincode](build_network.html#install-define-chaincode)
65-
in the Building your First Network Tutorial or the [peer lifecycle command reference](../commands/peerlifecycle.html).
66+
in the Building your First Network Tutorial or the [peer lifecycle command reference](commands/peerlifecycle.html).
6667
To learn more about how to use the Fabric lifecycle using the Fabric SDK for
6768
Node.js, visit [How to install and start your chaincode](https://fabric-sdk-node.github.io/master/tutorial-chaincode-lifecycle.html).
6869

@@ -161,15 +162,16 @@ chaincode for your organization once, even if you have multiple peers.
161162
### Step Four: Commit the chaincode definition to the channel
162163

163164
Once a sufficient number of channel members have approved a chaincode definition,
164-
one organization can commit the definition to the channel. The channel members
165-
need to communicate that they have approved the definition out of band. The
166-
commit transaction is first submitted to the peers of channel members, who query
167-
the chaincode definition approved for their organizations and endorse the
168-
definition if their organization has approved it. The transaction is then sent
169-
to the ordering service, which then commits the chaincode definition to the
170-
channel. The commit definition transaction needs to be submitted as the
171-
**Organization Administrator**, whose signing certificate is listed as an admin
172-
cert in the MSP of your organization definition.
165+
one organization can commit the definition to the channel. You can use the
166+
``queryapprovalstatus`` command to find which channel members have approved a
167+
definition before committing it to the channel using the peer CLI. The commit
168+
transaction is first submitted to the peers of channel members, who query the
169+
chaincode definition approved for their organizations and endorse the definition
170+
if their organization has approved it. The transaction is then sent to the
171+
ordering service, which then commits the chaincode definition to the channel.
172+
The commit definition transaction needs to be submitted as the **Organization**
173+
**Administrator**, whose signing certificate is listed as an admin cert in the
174+
MSP of your organization definition.
173175

174176
The number of organizations that need to approve a definition before it can be
175177
successfully committed to the channel is governed by the
@@ -234,13 +236,13 @@ number by one and approve a new definition to upgrade the chaincode. The version
234236
parameter is used to track the chaincode binaries, and needs to be changed only
235237
when you upgrade the chaincode binaries.
236238

237-
## Migrating to the new Fabric lifecycle
239+
## Migrate to the new Fabric lifecycle
238240

239-
You can use the Fabric chaincode lifecycle my creating a new channel and setting
240-
the channel capabilities to `V2_0`. You will not be able to use the old lifecycle
241-
to install, instantiate, or update a chaincode on a channels with `V2_0` capabilities
242-
enabled. Migration from the old lifecycle to the new lifecycle is not supported
243-
for the Fabric v2.0 Alpha.
241+
You can use the Fabric chaincode lifecycle by creating a new channel and setting
242+
the channel capabilities to `V2_0`. You will not be able to use the previous
243+
lifecycle to install, instantiate, or update a chaincode on a channels with
244+
`V2_0` capabilities enabled. Migration from the old lifecycle to the new
245+
lifecycle is not supported for the Fabric v2.0 Alpha.
244246

245247
<!--- Licensed under Creative Commons Attribution 4.0 International License
246248
https://creativecommons.org/licenses/by/4.0/ -->

docs/source/channel_update_tutorial.rst

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,10 @@ chaincode package label as a description of the chaincode. Modify the command
627627
accordingly if the channel is running a chaincode written in Java or Node.js.
628628
Issue the following command to install the package on peer0 of Org3:
629629

630-
.. code:: bash
630+
.. code:: bash
631631
632-
# this command installs a chaincode package on your peer
633-
peer lifecycle chaincode install mycc.tar.gz
632+
# this command installs a chaincode package on your peer
633+
peer lifecycle chaincode install mycc.tar.gz
634634
635635
You can also modify the environment variables and reissue the command if you
636636
want to install the chaincode on the second peer of Org3. Note that a second
@@ -678,14 +678,30 @@ for Org3:
678678
# use the --init-required flag to request the ``Init`` function be invoked to initialize the chaincode
679679
peer lifecycle chaincode approveformyorg --channelID $CHANNEL_NAME --name mycc --version 1.0 --init-required --package-id $CC_PACKAGE_ID --sequence 1 --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 --waitForEvent
680680
681-
Since the chaincode definition has already been committed to the channel, you
682-
are ready to use the ``mycc`` chaincode after you approve the definition.
683-
The chaincode definition uses the default endorsement policy, which requires a
684-
majority of organizations on the channel endorse a transaction. This implies
685-
that if an organization is added to or removed from the channel, the endorsement
686-
policy is updated automatically. We previously needed endorsements from Org1 and
687-
Org2 (2 out of 2). Now we need endorsements from two organizations out of Org1,
688-
Org2, and Org3 (2 out of 3).
681+
You can use the ``peer lifecycle chaincode querycommitted`` command to check if
682+
the chaincode definition you have approved has already been committed to the
683+
channel.
684+
685+
.. code:: bash
686+
687+
# use the --name flag to select the chaincode whose definition you want to query
688+
peer lifecycle chaincode querycommitted --channelID $CHANNEL_NAME --name mycc --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
689+
690+
A successful command will return information about the committed definition:
691+
692+
.. code:: bash
693+
694+
Committed chaincode definition for chaincode 'mycc' on channel 'mychannel':
695+
Version: 1, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc
696+
697+
Since the chaincode definition has already been committed, you are ready to use
698+
the ``mycc`` chaincode after you approve the definition. The chaincode definition
699+
uses the default endorsement policy, which requires a majority of organizations
700+
on the channel endorse a transaction. This implies that if an organization is
701+
added to or removed from the channel, the endorsement policy is updated
702+
automatically. We previously needed endorsements from Org1 and Org2 (2 out of 2).
703+
Now we need endorsements from two organizations out of Org1, Org2, and Org3 (2
704+
out of 3).
689705

690706
Query the chaincode to ensure that it has started. Note that you may need to
691707
wait for the chaincode container to start.

docs/source/couchdb_as_state_database.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ CouchDB indexes
108108
.. note:: The Fabric chaincode lifecycle that is being introduced as an Alpha
109109
feature in Fabric v2.0 does not support using indexes with CouchDB. As
110110
a result, the `previous lifecycle process <https://hyperledger-fabric.readthedocs.io/en/release-1.4/chaincode4noah.html>`_ is required to
111-
install and instantiate a chaincode that includes CouchDB indexes. You
111+
install and instantiate a chaincode that includes CouchDB indexes. You
112112
can only use CouchDB indexes with the Fabric v2.0 Alpha if the channel
113113
capabilities are set with V1_4 as the highest version enabled in the
114-
Application Capabilities section of the `configtx.yaml file <https://github.com/hyperledger/fabric/blob/release-2.0/sampleconfig/configtx.yaml>`_.
114+
Application Capabilities section of the `configtx.yaml file <https://github.com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml>`_.
115115
CouchDB indexes will not work on channels with v2_0 capabilities
116116
enabled.
117117

docs/source/pluggable_endorsement_and_validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ The name of the custom plugin needs to be referenced by the chaincode definition
9696
to be used by the chaincode. If you are using the peer CLI to approve the
9797
chaincode definition, use the ``--escc`` and ``--vscc`` flag to select the name
9898
of the custom endorsement or validation library. If you are using the
99-
Fabric SDK for Node.js, visit [How to install and start your chaincode](https://fabric-sdk-node.github.io/master/tutorial-chaincode-lifecycle.html).
99+
Fabric SDK for Node.js, visit `How to install and start your chaincode <https://fabric-sdk-node.github.io/master/tutorial-chaincode-lifecycle.html>`__.
100100
For more information, see :doc:`chaincode4noah`.
101101

102102
.. note:: Hereafter, custom endorsement or validation logic implementation is

0 commit comments

Comments
 (0)