我正在尝试按照official doc
来尝试HLF 2.0链代码生命周期该网络有3个订购节点,每个节点有两个组织,每个对等体
但是在链代码提交中,我得到了错误
committed with status (ENDORSEMENT_POLICY_FAILURE) at peer1.base.right:9051
configtx.yml
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
MSPDir: crypto-config/ordererOrganizations/base.order/msp
Policies:
Readers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Writers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Admins:
Type: Signature
Rule: "OR('OrdererMSP.admin')"
- &Org1
Name: LeftOrgMSP
ID: LeftOrgMSP
MSPDir: crypto-config/peerOrganizations/base.left/msp
Policies:
Readers:
Type: Signature
Rule: "OR('LeftOrgMSP.admin', 'LeftOrgMSP.peer', 'LeftOrgMSP.client','LeftOrgMSP.member')"
Writers:
Type: Signature
Rule: "OR('LeftOrgMSP.admin', 'LeftOrgMSP.client','LeftOrgMSP.peer','LeftOrgMSP.member')"
Admins:
Type: Signature
Rule: "OR('LeftOrgMSP.admin','LeftOrgMSP.peer')"
Endorsement:
Type: Signature
Rule: "OR('LeftOrgMSP.peer')"
AnchorPeers:
- Host: peer1.base.left
Port: 7051
- &Org2
Name: RightOrgMSP
ID: RightOrgMSP
MSPDir: crypto-config/peerOrganizations/base.right/msp
Policies:
Readers:
Type: Signature
Rule: "OR('RightOrgMSP.admin', 'RightOrgMSP.peer', 'RightOrgMSP.client','RightOrgMSP.member')"
Writers:
Type: Signature
Rule: "OR('RightOrgMSP.admin','RightOrgMSP.peer', 'RightOrgMSP.client','RightOrgMSP.member')"
Admins:
Type: Signature
Rule: "OR('RightOrgMSP.admin','RightOrgMSP.peer')"
Endorsement:
Type: Signature
Rule: "OR('RightOrgMSP.peer')"
AnchorPeers:
- Host: peer1.base.right
Port: 9051
Capabilities:
Channel: &ChannelCapabilities
V2_0: true
Orderer: &OrdererCapabilities
V2_0: true
Application: &ApplicationCapabilities
V2_0: true
Application: &ApplicationDefaults
Organizations:
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"
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
Capabilities:
<<: *ApplicationCapabilities
Orderer: &OrdererDefaults
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Organizations:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
Channel: &ChannelDefaults
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
Capabilities:
<<: *ChannelCapabilities
Profiles:
MainChannel:
Consortium: BaseConsortium
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
Capabilities:
<<: *ApplicationCapabilities
Raft:
<<: *ChannelDefaults
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
OrdererType: etcdraft
EtcdRaft:
Consenters:
- Host: orderer1.base.order
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/base.order/orderers/orderer1.base.order/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/base.order/orderers/orderer1.base.order/tls/server.crt
- Host: orderer2.base.order
Port: 8050
ClientTLSCert: crypto-config/ordererOrganizations/base.order/orderers/orderer2.base.order/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/base.order/orderers/orderer2.base.order/tls/server.crt
- Host: orderer3.base.order
Port: 9050
ClientTLSCert: crypto-config/ordererOrganizations/base.order/orderers/orderer3.base.order/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/base.order/orderers/orderer3.base.order/tls/server.crt
Addresses:
- orderer1.base.order:7050
- orderer2.base.order:8050
- orderer3.base.order:9050
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- <<: *OrdererOrg
Consortiums:
BaseConsortium:
Organizations:
- *Org1
- *Org2
在检查读取提交性时,我具有所需的输出
{
"approvals": {
"LeftOrgMSP": true,
"RightOrgMSP": true
}
}
Chaincode批准
peer lifecycle chaincode approveformyorg --channelID basechannel --name fabcar --version 1.0 --init-required --package-id fabcar_1:206a5ce87aefb8b9780b75451523c2aa3ef718ceebaaeae5082ae88ea259b305 --sequence 1 -o orderer1.base.order:7050 --tls --cafile $CA_PATH
Chaincode提交命令
peer lifecycle chaincode commit -o orderer1.base.order:7050 --channelID basechannel --name fabcar --version 1.0 --sequence 1 --init-required --tls true --cafile $ORDER_CA_PATH --peerAddresses peer1.base.right:9051 --tlsRootCertFiles $PATH_RIGHT --peerAddresses peer1.base.left:7051 --tlsRootCertFiles $PATH_LEFT
不确定为什么会收到该错误
答案 0 :(得分:0)
我正在考虑所有对等容器都已启动且MSP名称正确的事实。
似乎缺少块验证策略。
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
答案 1 :(得分:0)
两天前我遇到了同样的问题,我才解决了。提交链码之前,我的配置文件和操作没有任何问题,但是我仍然得到ENDORSEMENT_POLICY_FAILURE。检查调试日志后,我发现您应该同时将链码提交给足够的认可节点以获取足够的签名,以确保认可将会成功,有超过30个组织在我的结构网络中,但是从一开始我就只将链码提交给一个节点,这并不奇怪,我得到了这个错误。