0

While running the following command, I'm getting the above error.

Command:

./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go

More details:

Query installed successful on peer0.org1 on channel
Using organization 1
 + peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /home/haritam/fabric-samples/test-network/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem --channelID mychannel --name basic --version 1.0 --package-id

Perform chaincode operations:
'package|install|queryinstalled|getinstalledpackage|approveformyorg|queryapproved|checkcommitreadiness|commit|querycommitted'

Usage:
   peer lifecycle chaincode '[command]'

Available Commands:
   approveformyorg Approve the chaincode definition for my org.
   checkcommitreadiness Check whether a chaincode definition is ready to be committed on a channel.
   commit Commit the chaincode definition on the channel. getinstalledpackage Get an installed chaincode package from a peer. install Install a chaincode.
   package Package a chaincode
   queryapproved Query an 'org'\''s' approved chaincode definition from its peer.
   querycommitted Query the committed chaincode definitions by channel on a peer.
   queryinstalled Query the installed chaincodes on a peer.

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)'
  -h, --help help for chaincode
      --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
      --tlsHandshakeTimeShift duration The amount of time to shift backwards for certificate expiration checks during TLS handshakes with the orderer endpoint

Use '"peer' lifecycle chaincode '[command]' '--help"' for more information about a command. --sequence 1
 + res=1
Error: invalid argument "duration" for "--connTimeout" flag: time: invalid duration duration
Usage:
   peer lifecycle chaincode approveformyorg [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 approveformyorg
      --init-required                  Whether the chaincode requires invoking 'init'
  -n, --name string                    Name of the chaincode
      --package-id string              The identifier of the chaincode install package
      --peerAddresses stringArray      The addresses of the peers to connect to
      --sequence int                   The sequence number of the chaincode definition for the channel
      --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
      --waitForEvent                   Whether to wait for the event from each peer's deliver filtered service signifying that the transaction has been committed successfully (default true)
      --waitForEventTimeout duration   Time to wait for the event from each peer's deliver filtered service signifying that the 'invoke' transaction has been committed successfully (default 30s)

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
      --tlsHandshakeTimeShift duration      The amount of time to shift backwards for certificate expiration checks during TLS handshakes with the orderer endpoint

Chaincode definition approved on peer0.org1 on channel 'mychannel' failed
Deploying chaincode failed

Was trying to deploy a chaincode on mychannel while following the documentation tutorial.

https://hyperledger-fabric.readthedocs.io/en/latest/test_network.html

myeongkil kim
  • 2,465
  • 4
  • 16
  • 22

1 Answers1

2

The approveForMyOrg() function in test-network/scripts/ccutils.sh doesn't get the results of the PACKAGE_ID from the queryInstalled() function. But queryInstalled() does spit out the PACKAGE_ID in the log.txt file. So a workaround would be to update the approveForMyOrg() function to the below. But you would probably want to just make it a globally available var or something.

function approveForMyOrg() {
  ORG=$1
  setGlobals $ORG
  set -x
  PACKAGE=$(cat log.txt)
  peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "$ORDERER_CA" --channelID $CHANNEL_NAME --name ${CC_NAME} --connTimeout 3s --version ${CC_VERSION} --package-id $PACKAGE --sequence ${CC_SEQUENCE} ${INIT_REQUIRED} ${CC_END_POLICY} ${CC_COLL_CONFIG} >&log.txt
  res=$?
  { set +x; } 2>/dev/null
  cat log.txt
  verifyResult $res "Chaincode definition approved on peer0.org${ORG} on channel '$CHANNEL_NAME' failed"
  successln "Chaincode definition approved on peer0.org${ORG} on channel '$CHANNEL_NAME'"
}
Nate Nolan
  • 31
  • 4