0

I'm trying to query my installed chaincode on hyperledger fabric 2.2 network.

I'm trying test-network . I'm using this command

peer chaincode query -C mychannel -n fabcar -c ‘{“Args”:[“queryAllCars”]}’

but I'm getting this error.

Error: chaincode argument error: invalid character 'â' looking for beginning of value
Usage:
  peer chaincode query [flags]

Flags:
  -C, --channelID string               The channel on which this command should be executed
      --connectionProfile string       Connection profile that provides the necessary connection information for the network. Note: currently only supported for providing peer connection information
  -c, --ctor string                    Constructor message for the chaincode in JSON format (default "{}")
  -h, --help                           help for query
  -x, --hex                            If true, output the query value byte array in hexadecimal. Incompatible with --raw
  -n, --name string                    Name of the chaincode
      --peerAddresses stringArray      The addresses of the peers to connect to
  -r, --raw                            If true, output the query value as raw bytes, otherwise format as a printable string
      --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

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
      --transient string 

               Transient map of arguments in JSON encoding
Adarsha Jha
  • 1,782
  • 2
  • 15
  • 37
  • 1
    Can you try this command `peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}' `? – metadata Jul 17 '20 at 16:34

2 Answers2

0

As commented out by @alpha peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}' will work. the difference is to replace with ' while passing the arguments.

Aditya Arora
  • 303
  • 2
  • 12
0

Please replace quotes ‘ with ' and “ with " . The problem here is it can't able to detect the quotes.