认可政策无效 [英] Endorsement policy doesn't work

查看:67
本文介绍了认可政策无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用admin部署一个具有三个组织的组织的网络时. 我的endorsement-policy.json如下所示,并且不起作用.

When I use admin deploy a network with one organization include three peers. My endorsement-policy.json as below , and it not work.

{
    "identities": [
        {
            "role": {
                "name": "member",
                "mspId": "Org1MSP"
            }
        }
    ],
    "policy": {
        "1-of": [
            {
                "signed-by": 0
            }      
       ]
    }
}

1.如何设置背书策略? 2.我认为背书的同行是唯一的同行,成员"或管理员"是什么意思?

1.How can I set the endorsement-policy ? 2. I think the endorsing peer is the only a peer , what's the meaning of 'member' or 'admin' ?

所以,我想让所有三个对等端都认可对端端,如何配置它?

So, I want make all of the three peers to be endorsing peers, how to config it ?

推荐答案

让我们从解决您的评论开始:

Let's start from addressing your comment:

不,这应该是一个使用问题.我在一个组织中只有三个同龄人.我需要来自同行认可的所有三个签名.当我使用docker logs dev-peer * ...命令查看每个对等容器的日志时,lt通过随机函数获得不同的值.因此,该事务执行了3次.现在,我只希望无法提交交易.背书政策应该是什么

no.it should be a useage problem.I have three peers in only one org. I need all of three signatures from endorsing peers. When l use docker logs dev-peer*... command to see the log from each peer container .lt get different value by random function.So,the transaction is executed three times. Now,I just want the transaction can’t be submitted. What is the endorsement policy should be

您定义的策略是:

"policy": {
    "1-of": [
        {
            "signed-by": 0
        }      
   ]
}

其中,"signed-by": 0是必须满足此规则的MSP ID的索引. IE.一个对等方的一次背书基本上可以满足背书策略,同时您需要确保所有执行都保持一致,因此,在您的情况下,您希望有不止一个对等方来背书您的交易,因此您需要:

where "signed-by": 0 is the index of the MSP id which has to satisfy this rule. I.e. single endorsement of one peer basically will satisfy the endorsement policy, while you need to make sure all there execution are consistent, therefore in your case you would like to have more than one peer to endorse your transaction, hence you need:

{
    "identities": [
        {
            "role": {
                "name": "member",
                "mspId": "Org1MSP"
            }
        }
    ],
    "policy": {
        "3-of": [
            {
                "signed-by": 0
            },
            {
                "signed-by": 0
            },
            {
                "signed-by": 0
            },
        ]
    }
} 

这意味着Org1MSP的所有3个对等方都必须签署背书以批准交易,而由于您使用的是随机函数,因此它将失败.

which mean all 3 peers from Org1MSP have to signed the endorsement to approve the transaction, while since you are using random function it will fail.

1.如何设置背书策略?

1.How can I set the endorsement-policy ?

您可以在实例化您的链码时提供签注策略,其语法非常简单:

you can provide endorsement policy while instantiating your chaincode, the syntax is very simple:

AND("Org1MSP.member")

基本上说您至少需要得到Org1MSP有效成员的认可.

basically says you need at lest one endorsement from valid member of Org1MSP.

  1. 我认为背书的同行是唯一的同行,成员"或管理员"是什么意思?

memberadmin是实际上为您提供的能力,并且能够在需要特权实体(admin)认可或签名的东西时提供控制能力,或者简单的一个就足够(member) .

member and admin are principle which actually provide you and ability to control whenever there is something need to be endorsed or signed by privileged entity (admin) or a simple one could be suffice (member).

所以,我想让所有三个对等端都认可对端端,如何配置它?

So, I want make all of the three peers to be endorsing peers, how to config it ?

认可对等方是已安装链码的对等方,因此能够调用它并与之交互,不需要明确配置就可以使对等方成为认可对等方,您只需在其上安装链码即可.

endorsing peer is the peer which has chaincode installed on it, hence able to invoke it and interact with it, there is no explicit configuration need to make peer an endorsing peer, all you need is to install chaincode on it.

这篇关于认可政策无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆