Hyperledger fabric 如何查看链码定义?

Hyperledger fabric 如何查看链码定义?,hyperledger-fabric,Hyperledger Fabric,Fabric文档详细解释了什么是链码定义,以及它在链码的生命周期和治理中扮演的角色。它说,组织需要批准定义才能使用链码。它没有解释的是,如何在批准链码定义之前查看它 问题:是否有查看链码定义的命令?或者是否有我遗漏的另一个工作流,以便组织可以在批准定义之前研究它?批准的参数就是定义。可以将链码定义视为执行和验证链码事务所需的所有参数。您通过提供定义,因此,实际上不可能在不知道定义的情况下执行批准 一般来说,定义在带外获得同意,然后所有参与组织批准外部同意的定义。但是,如果您在网络上,并且希望发现

Fabric文档详细解释了什么是链码定义,以及它在链码的生命周期和治理中扮演的角色。它说,组织需要批准定义才能使用链码。它没有解释的是,如何在批准链码定义之前查看它


问题:是否有查看链码定义的命令?或者是否有我遗漏的另一个工作流,以便组织可以在批准定义之前研究它?

批准的参数就是定义。可以将链码定义视为执行和验证链码事务所需的所有参数。您通过提供定义,因此,实际上不可能在不知道定义的情况下执行批准


一般来说,定义在带外获得同意,然后所有参与组织批准外部同意的定义。但是,如果您在网络上,并且希望发现其他成员已批准了哪些内容,或者提交了哪些定义,则可以通过对等CLI提供许多查询实用程序。您可以使用查看组织已批准的定义,您可以使用查看组织已批准的特定定义,您可以使用或查看当前提交的定义。

批准的参数就是定义。可以将链码定义视为执行和验证链码事务所需的所有参数。您通过提供定义,因此,实际上不可能在不知道定义的情况下执行批准


一般来说,定义在带外获得同意,然后所有参与组织批准外部同意的定义。但是,如果您在网络上,并且希望发现其他成员已批准了哪些内容,或者提交了哪些定义,则可以通过对等CLI提供许多查询实用程序。您可以使用查看组织已批准的定义,您可以使用查看组织已批准的特定定义,您可以使用或查看当前提交的定义。

步骤1:每个组织必须同意具有唯一哈希值和标签的链码包,他们都可能从开发人员那里获得链码包,如果有人试图更改链码上的某些内容,那么链码包将给出与其他包不同的哈希值

第2步:每个组织都将在这些对等方上安装chaincode包

步骤3:之后,每个组织都会得到一个相同的包ID,它是该链码包的哈希值和标签的组合。您可以通过“peer lifecycle chaincode queryinstalled”命令获得它

第4步:现在您可以从您的组织批准与channelID、名称、版本、init required等相同的包ID。在批准之前,您还可以检查检查提交情况

步骤5:要使用channelID、名称、版本、init required、sequence 1等检查相同软件包ID的CheckCommitterency,请执行以下命令。如果得到足够的批准,就可以提交了

因此,每个组织都会批准自己的链码以及其他定义,如channelID、名称、版本、init required等&由于系统原因,欺诈活动不会获得足够的批准

Check whether a chaincode definition is ready to be committed on a channel.

Usage:
  peer lifecycle chaincode checkcommitreadiness [flags]

Flags:
      --channel-config-policy string   The endorsement policy associated to this chaincode specified as a channel config policy reference
  -C, --channelID string               The channel on which this command should be executed
      --collections-config string      The fully qualified path to the collection JSON file including the file name
      --connectionProfile string       The fully qualified path to the connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
  -E, --endorsement-plugin string      The name of the endorsement plugin to be used for this chaincode
  -h, --help                           help for checkcommitreadiness
      --init-required                  Whether the chaincode requires invoking 'init'
  -n, --name string                    Name of the chaincode
  -O, --output string                  The output format for query results. Default is human-readable plain-text. json is currently the only supported format.
      --peerAddresses stringArray      The addresses of the peers to connect to
      --sequence int                   The sequence number of the chaincode definition for the channel (default 1)
      --signature-policy string        The endorsement policy associated to this chaincode specified as a signature policy
      --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
  -V, --validation-plugin string       The name of the validation plugin to be used for this chaincode
  -v, --version string                 Version of the chaincode

Global Flags:
      --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with the orderer endpoint
      --connTimeout duration                Timeout for client to connect (default 3s)
      --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
  -o, --orderer string                      Ordering service endpoint
      --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer.
      --tls                                 Use TLS when communicating with the orderer endpoint

如前所述。

第1步:每个组织必须就具有唯一散列值和标签的链码包达成一致,他们都可能从开发人员处获得链码包,如果有人试图更改链码上的某些内容,该链码包将给出与其他包不同的散列值

第2步:每个组织都将在这些对等方上安装chaincode包

步骤3:之后,每个组织都会得到一个相同的包ID,它是该链码包的哈希值和标签的组合。您可以通过“peer lifecycle chaincode queryinstalled”命令获得它

第4步:现在您可以从您的组织批准与channelID、名称、版本、init required等相同的包ID。在批准之前,您还可以检查检查提交情况

步骤5:要使用channelID、名称、版本、init required、sequence 1等检查相同软件包ID的CheckCommitterency,请执行以下命令。如果得到足够的批准,就可以提交了

因此,每个组织都会批准自己的链码以及其他定义,如channelID、名称、版本、init required等&由于系统原因,欺诈活动不会获得足够的批准

Check whether a chaincode definition is ready to be committed on a channel.

Usage:
  peer lifecycle chaincode checkcommitreadiness [flags]

Flags:
      --channel-config-policy string   The endorsement policy associated to this chaincode specified as a channel config policy reference
  -C, --channelID string               The channel on which this command should be executed
      --collections-config string      The fully qualified path to the collection JSON file including the file name
      --connectionProfile string       The fully qualified path to the connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
  -E, --endorsement-plugin string      The name of the endorsement plugin to be used for this chaincode
  -h, --help                           help for checkcommitreadiness
      --init-required                  Whether the chaincode requires invoking 'init'
  -n, --name string                    Name of the chaincode
  -O, --output string                  The output format for query results. Default is human-readable plain-text. json is currently the only supported format.
      --peerAddresses stringArray      The addresses of the peers to connect to
      --sequence int                   The sequence number of the chaincode definition for the channel (default 1)
      --signature-policy string        The endorsement policy associated to this chaincode specified as a signature policy
      --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
  -V, --validation-plugin string       The name of the validation plugin to be used for this chaincode
  -v, --version string                 Version of the chaincode

Global Flags:
      --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with the orderer endpoint
      --connTimeout duration                Timeout for client to connect (default 3s)
      --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
  -o, --orderer string                      Ordering service endpoint
      --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer.
      --tls                                 Use TLS when communicating with the orderer endpoint
如前所述