gpt4 book ai didi

hyperledger-fabric - 调用链代码时 Hyperledger 认可失败 - 失败 : signature set did not satisfy policy

转载 作者:行者123 更新时间:2023-12-04 15:50:31 24 4
gpt4 key购买 nike

当我使用背书策略'1-of':[{ 'signed-by': 0 }, { 'signed-by': 1 }] 然后一切正常,但是如果我使用 '2-of':[{ 'signed-by': 0 }, { 'signed-by': 1 }] 调用事务失败,如下所示错误:

架构对等错误日志:

Validate -> ERRO 078 VSCC error: stateBasedValidator.Validate failed, err validation of endorsement policy for chaincode mycc in tx 4:0 failed: signature set did not satisfy policy 2019-01-02 07:24:40.782 UTC [committer.txvalidator] validateTx -> ERRO 079 VSCCValidateTx for transaction txId = 815553b7cabb383f59d4abd3c2bdc3deda5b74169048e3b3b837f46adbd85099 returned error: validation of endorsement policy for chaincode mycc in tx 4:0 failed: signature set did not satisfy policy

Node-SDK 日志显示以下内容

[2019-01-02 02:24:40.826] [ERROR] invoke-chaincode - The invoke chaincode transaction was invalid, code:ENDORSEMENT_POLICY_FAILURE [2019-01-02 02:24:40.827] [ERROR] invoke-chaincode - Error: The invoke chaincode transaction was invalid, code:ENDORSEMENT_POLICY_FAILURE

解决这个问题的任何帮助都将非常有帮助

最佳答案

我在自己的系统上运行环境,确定这不是链代码的问题,而是正在发送的调用请求的问题。

因此在 testAPI.sh 和 testInvoke.sh 中发出的调用请求是

TRX_ID=$(curl -s -X POST \
http://localhost:4000/channels/mychannel/chaincodes/mycc \
-H "authorization: Bearer $ORG1_TOKEN" \
-H "content-type: application/json" \
-d '{
"peers": **["peer0.org1.example.com","peer1.org1.example.com"]**,
"fcn":"invoke",
"operation":"commit",
"args": ["commitPrivate","uuid3","uuid2-Owner"]
}')

我们可以看到背书被发送给 org 1 中的两个对等点,而 org 2 中没有。但是,2-of 策略并不是说它需要来自 org 1 和 org 2 中任何对等点的 2 签名,而是它需要来自 org 1 和 org 2 中的同级的签名。我们可以从背书策略文档中看到这一点,https://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies.html#endorsement-policy-syntax .

Similarly, OutOf(2, 'Org1.member', 'Org2.member') is equivalent to AND('Org1.member', 'Org2.member')

因此,如果您将请求更改为

TRX_ID=$(curl -s -X POST \
http://localhost:4000/channels/mychannel/chaincodes/mycc \
-H "authorization: Bearer $ORG1_TOKEN" \
-H "content-type: application/json" \
-d '{
"peers": **["peer0.org1.example.com","peer1.org2.example.com"]**,
"fcn":"invoke",
"operation":"commit",
"args": ["commitPrivate","uuid3","uuid2-Owner"]
}')

它会起作用。

关于hyperledger-fabric - 调用链代码时 Hyperledger 认可失败 - 失败 : signature set did not satisfy policy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54033274/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com