0
votes

I have set up a hyperledger fabric network shown below: org1: peer0.org1 org2: peer0.org2

chaincodes: 1:deed.js 2:bor.js

I have installed chaincode deed.js on org1 and org2 peers. I have installed bor.js only on org2 peer.

I have approved chaincode deed.js on org1 and org2 peers. I have committed chaincode bor.js on org1 and org2 peers.

I have invoked chaincode deed.js using org1 and org2 peers. I have invoked chaincode bor.js using org2 peer.

Querying deed.js works fine. But querying bor.js is throwing an error:

Error: endorsement failure during query. response: status:500 message:"make sure the chaincode bor has been successfully defined on channel mychannel and try again: chaincode definition for 'bor' exists, but chaincode is not installed" .

I know the error is due to the reason that I have not installed chaincode bor.js on org1, but my project is such that I must install bor.js smart contract only on org2 but not on org1.

My endorsement policy for applications section of configtx.yaml is defined below:

Application: &ApplicationDefaults

# Organizations is the list of orgs which are defined as participants on
# the application side of the network
Organizations:

# Policies defines the set of policies at this level of the config tree
# For Application policies, their canonical path is
#   /Channel/Application/<PolicyName>
Policies:
    Readers:
        Type: ImplicitMeta
        Rule: "ANY Readers"
    Writers:
        Type: ImplicitMeta
        Rule: "ANY Writers"
    Admins:
        Type: ImplicitMeta
        Rule: "MAJORITY Admins"
    LifecycleEndorsement:
        Type: ImplicitMeta
        Rule: "MAJORITY Endorsement"
    Endorsement:
        Type: ImplicitMeta
        Rule: "MAJORITY Endorsement"

Capabilities:
    <<: *ApplicationCapabilities

Is there any way to perform the query operation on bor.js chaincode without an error by installing bor.js only on org2 peer?.

1

1 Answers

0
votes

If I am correct you created one channel and you are trying to install 2 chain codes.

Check whether you have correctly installed your deed and bor chain codes on your resp peers. Check with these commands: peer chaincode list --installed peer chaincode list --instantiated -C yourchannelname If 2 chaincode exist then cross-check your CouchDB whether the data stores into a ledger or not. If data is storing in your CouchDB, then check your command and the peer on which you are querying or invoking. If any queries I can help you