简体   繁体   English

Hyperledger Fabric中的背书策略

[英]Endorsement policy in Hyperledger Fabric

I am using Hyperledger Fabric version 1.2. 我正在使用Hyperledger Fabric 1.2版。 I have created a channel with 1 orderer and 10 peer nodes, all belonging to the same organisation. 我创建了一个包含1个订购者和10个对等节点的通道,它们都属于同一组织。 I want to instantiate the chaincode with the endorsement policy such that all the peers of ORG1 are the endorsing peer, not just 1. What is the valid expression for the same? 我想用背书策略实例化链码,以便ORG1的所有对等人都是背书对等人,而不仅仅是1。

Currently using the following policy: 当前正在使用以下策略:

docker exec -e "CORE_PEER_ADDRESS=peer0.org1.example.com:7051" cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n chainname -v 1.0 -c '{"Args":[""]}' -P "AND('Org1MSP.member')"

Fabric documentation contains examples of including peers from different organisations. 架构文档包含一些示例,其中包括来自不同组织的同行。

This can be achived while invoking the chaincode. 这可以在调用链码时实现。 You have to pass the peer addresses of all the peer nodes who you want to act as endorsing peers 您必须传递要充当认可对等方的所有对等节点的对等地址

peer chaincode invoke -o orderer0.abc.com:7050 -C abcchannel -n fabcar --peerAddresses peer0.org1.example.com:7051 --peerAddresses peer1.org1.example.com:7051 -c '{"Args":["initLedger"]}' 对等链代码调用-o orderer0.abc.com:7050 -C abcchannel -n fabcar --peerAddresses peer0.org1.example.com:7051 --peerAddresses peer1.org1.example.com:7051 -c'{“ Args”: [ “initLedger”]}”

Unfortunately! 不幸! there no valid command for that, you can follow two steps if you want to achieve this: 没有有效的命令,如果要实现此目的,可以按照两个步骤操作:

  1. Write your own custom endorsement logic by a plugin. 通过插件编写自己的自定义认可逻辑。 This method is little cumbersome and you can follow this link if you want to do that. 这种方法有点麻烦,如果您想这样做,可以点击此链接。 Pluggable endorsement and validation logic 可插拔背书和验证逻辑

  2. Or, you can have an alternate solution by creating 10 Orgs with 1 peer each and define the endorsement policy through the command that you want as: 或者,您可以通过创建10个组织(每个组织有1个对等体)并通过以下命令定义背书策略来获得替代解决方案:

    -P "OutOf(10, 'Org1.peer', 'Org2.peer', ...., 'Org10.peer')"

But, having all the peers as an endorsing peer is never a good idea as if a peer goes down, you will have to face serious problems as no transaction will be committed 但是,让所有对等方作为认可对等方从来都不是好主意,因为如果某个对等方崩溃了,您将不得不面对严重的问题,因为不会进行任何交易

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM