Hyperledger fabric 为链码构造描述符失败

Hyperledger fabric 为链码构造描述符失败,hyperledger-fabric,hyperledger-fabric-sdk-js,Hyperledger Fabric,Hyperledger Fabric Sdk Js,我正试图从用户处进行交易,但当我试图获取通道时,我收到以下错误: 微服务日志: error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"mychannel" > createTransaction Error: Cannot do trans

我正试图从用户处进行交易,但当我试图获取通道时,我收到以下错误:

微服务日志:

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
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
    mychannel:
        Consortium: MyConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities
错误:[DiscoveryService]:发送[mychannel]-通道:mychannel接收到的发现错误:为链码构造描述符失败:
CreateTransation错误:无法在区块链中进行交易:DiscoveryService:mychannel错误:无法为链码构建描述符:
在FabricRepository。(/app/microservice/dist/services/blockchain client.js:235:23)
在发电机处。投掷()
被拒绝时(/app/microservice/dist/services/blockchain client.js:6:65)
在处理和拒绝时(内部/process/task_queues.js:97:5)
邮政/结构服务/createTransaction 997.103
对等日志:

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
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
    mychannel:
        Consortium: MyConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities
2020-10-20 20:23:54.218 UTC[discovery.Annowment]func1->DEBU d98端点:peer0.org2.com:7052,InternalEndpoint:,PKI-ID:82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9,元数据:满足主要原则:“\n\013Org2MSP\020\003”
2020-10-20 20:23:54.218 UTC[发现.认可]func1->DEBU d99端点:peer0.org2.com:7052,InternalEndpoint:,PKI-ID:82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9,元数据:不满足主要原则:“\n\007Org2MSP\020\003”:标识是不同MSP的成员(预期Org1MSP,获得Org2MSP)
2020-10-20 20:23:54.218 UTC[discovery]链码查询->ERRO d9a为链码链码构造描述符失败:,:没有对等组合可以满足认可策略
Configtx:

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
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
    mychannel:
        Consortium: MyConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities
mychannel:
联合体:MyConsortium

问题可能来自configtx.yaml,您必须正确放置所有“MSPDir”,并且在发出命令时,必须根据该“MSPDir”设置环境变量。

因此,问题在于为组织创建锚节点的脚本。错误通过bash泄漏。在为两个组织添加锚节点后,问题得到解决,我可以进行事务处理。

有时,如果链码未实例化或未在通道中定义,则会发生这种情况。最好检查Docker容器以了解此错误背后的原因。 如果您正在运行FB测试网络,您可以使用

./monitordocker.sh fabric_test

MSP目录设置正确。如果你仔细观察两次中的一次,你想执行什么事务?您是否已将客户端配置为使用组织的凭据?两个组织都加入频道了吗?智能合约是否实例化?客户端仅配置为使用org2,是的,两个组织都已加入,并且在通道上提交了正确的链码(这两个组织都已批准)。如何为组织添加锚节点?