How to package the couchdb indexes in external chaincode build?

505 Views Asked by At

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?

1

There are 1 best solutions below

1
On

Inside code.tar.gz:

[email protected] -> 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).