2

I am trying to install and deploy the chaincode as external service following the instructions here

I have created the couchdb indexes following the instructions here and package the chaincode as:

  • package the META-INF directory along with the connection.json which outputs "code.tar.gz"
  • package the META-INF directory along with "code.tar.gz" and "metadata.json" which outputs "cc_name.tgz"

Both of these methods resulted in error while installing the chaincode using peer lifecycle command.

I installed the chaincode without packaging the META-INF (couchd indexes) and everything works as expected. But for blockchain application I have few situations where I need to query data from couchdb and update the assets in the ledger.

What's the correct way to package the couchdb indexes when deploying the chaincode externally?

Pierre.Vriens
  • 2,117
  • 75
  • 29
  • 42
Niraj Kumar
  • 211
  • 2
  • 6

1 Answers1

5

Inside code.tar.gz:

mychaincode@0.0.1.tar.gz -> code.tar.gz-> META-INF/statedb/couchdb/indexes/myindex.json.

Anyway, I would advise to use IBM Blockchain Platform VSCode extension to ease the packaging and other kind of operations.

To make use of your indexes, use use_index in your rich queries (https://docs.couchdb.org/en/3.1.1/api/database/find.html).

kekomal
  • 2,179
  • 11
  • 12
  • 1
    thanks! my issue was i hadn't copied over the META-INF in the build and release scripts as mentioned in the docs: https://hyperledger-fabric.readthedocs.io/en/release-2.2/cc_launcher.html – Niraj Kumar Sep 10 '21 at 06:33