1

I am trying to do a transaction from the user but when I am trying to get the channel then I am getting this error:

Microservice Logs:

error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"mychannel" >
createTransaction Error: Cannot do transaction in blockchain: DiscoveryService: mychannel error: failed constructing descriptor for chaincodes:<name:"mychannel" >
at FabricRepository.<anonymous> (/app/microservice/dist/services/blockchain-client.js:235:23)
at Generator.throw (<anonymous>)
at rejected (/app/microservice/dist/services/blockchain-client.js:6:65)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
POST /fabric-service/createTransaction 997.103

Peer Logs:

2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d98 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata:  satisfies principal principal:"\n\013Org2MSP\020\003" 
2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d99 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata:  doesn't satisfy principal principal:"\n\007Org2MSP\020\003"  : the identity is a member of a different MSP (expected Org1MSP, got Org2MSP)
2020-10-20 20:23:54.218 UTC [discovery] chaincodeQuery -> ERRO d9a Failed constructing descriptor for chaincode chaincodes:<name:"mychannel" > ,: no peer combination can satisfy the endorsement policy

Configtx:

    mychannel:
        Consortium: MyConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities

Overall if I am doing the same transaction from org1 Peer I am getting similar error at the peer both are failing. If I remove an organization from the consortium it is working from that org but not when both are there

Any idea how to resolve this??

Paradox
  • 327
  • 3
  • 19
  • What transaction are you trying to execute? Have you configured well you client to use the credentials of the organization? Have both organizations join the channel? Is the smart contract instantiated? – Urko Oct 24 '20 at 12:58
  • The client is configured only to use org2 and yes both orgs have joined and proper chaincode is commited on the channel(Which is approved by both of them). – Paradox Oct 25 '20 at 18:14

3 Answers3

4

Generally, this error occurs if the chaincode name used in the transaction doesn't match the name used when the chaincode is deployed into the network.

Sometimes this happens if the Chaincode isn't instantiated or isn't defined in the channel. It is better to inspect Docker containers to know about the reason behind this error and make sure that the chaincode names are the same(be aware of upper/lower cases) If you are running FB test network you can use

./monitordocker.sh fabric_test
Badr Bellaj
  • 11,560
  • 2
  • 43
  • 44
1

So the problem was with the script to create anchor peer for the organization the error was leaking through bash. After adding anchor peers for both organizations things resolved, and I am able to do transactions.

Paradox
  • 327
  • 3
  • 19
0

The problem may be come from configtx.yaml, you have to place all the "MSPDir" properly and when you will give command, you have to set environment variable according to that "MSPDir".

Ta-seen Junaid
  • 366
  • 1
  • 6