fabric-docs-i18n
fabric-docs-i18n copied to clipboard
[ja_JP] Key Concepts / Fabric chaincode lifecycle
Original HTML: https://hyperledger-fabric.readthedocs.io/en/release-2.5/chaincode_lifecycle.html Original Source: https://github.com/hyperledger/fabric/blob/e1e8e2e52aa4fc543360d245fe6554a0eaf81183/docs/source/chaincode_lifecycle.md
diff --git a/docs/source/chaincode_lifecycle.md b/docs/source/chaincode_lifecycle.md
index 8a27f7886..f2f743db4 100644
--- a/docs/source/chaincode_lifecycle.md
+++ b/docs/source/chaincode_lifecycle.md
@@ -54,7 +54,7 @@ every organization on a channel needs to complete each step.
3. **Approve a chaincode definition for your organization:** Every organization
that will use the chaincode needs to complete this step. The chaincode
definition needs to be approved by a sufficient number of organizations
- to satisfy the channel's LifecycleEndorsment policy (a majority, by default)
+ to satisfy the channel's LifecycleEndorsement policy (a majority, by default)
before the chaincode can be started on the channel.
4. **Commit the chaincode definition to the channel:** The commit transaction
needs to be submitted by one organization once the required number of
@@ -134,12 +134,15 @@ consistent across organizations:
- **Name:** The name that applications will use when invoking the chaincode.
- **Version:** A version number or value associated with a given chaincodes
package. If you upgrade the chaincode binaries, you need to change your
- chaincode version as well.
-- **Sequence:** The number of times the chaincode has been defined. This value
+ chaincode version as well. Versions may contain any characters,
+ but it is typical to use a format such as `v1.2.3`. The version is not checked by the peer,
+ it is only an indicator intended to help organizations coordinate as they update their chaincode logic.
+- **Sequence:** The number of times the chaincode has been defined on a channel. This value
is an integer, and is used to keep track of chaincode upgrades. For example,
- when you first install and approve a chaincode definition, the sequence number
- will be 1. When you next upgrade the chaincode, the sequence number will be
- incremented to 2.
+ when you first approve and commit a chaincode definition on a channel, the sequence number
+ must be set to 1. When you next upgrade the chaincode or update the chaincode definition,
+ increment the sequence number to 2. The sequence number is used by the peer to
+ ensure that all organizations stay in sync regarding the chaincode definitions that they approve and commit.
- **Endorsement Policy:** Which organizations need to execute and validate the
transaction output. The endorsement policy can be expressed as a string passed
to the CLI, or it can reference a policy in the channel config. By
@@ -178,6 +181,13 @@ consistent across organizations:
you increment the chaincode version. You can pass `--isInit` and initialize the
chaincode using any function in your chaincode.
+ Note that in most scenarios it is recommended to embed initialization logic into chaincode rather than use the chaincode lifecycle mechanism described above.
+ Chaincode functions often perform checks against existing state, and initialization state can be implemented like any other chaincode state and be checked in subsequent chaincode function calls.
+ Handling initialization state within chaincode logic rather than with the chaincode lifecycle
+ mechanism has the benefit that you are not limited to a single initialization function,
+ rather you are in full control of initialization logic and can call your own
+ functions that initialize state from an application consistent with how all other application functions are called.
+
The chaincode definition also includes the **Package Identifier**. This is a
required parameter for each organization that wants to use the chaincode. The
package ID does not need to be the same for all organizations. An organization