到业务网络的Hyperledger Composer CLI Ping返回AccessException [英] Hyperledger Composer CLI Ping to a Business Network returns AccessException

查看:82
本文介绍了到业务网络的Hyperledger Composer CLI Ping返回AccessException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习Hyperledger Composer,但似乎是一种相对较新的技术,我的意思是教程很少,解决许多问题的方法也很少,教程没有提到遵循命令时可能出现的错误情况,这意味着对于这些错误也没有解决方案.

我已经加入了作曲家频道的社区聊天中,看起来好像它正在Discord中运行,还是在没有回答的情况下问了同样的问题,所以我在SO方面有更好的经验.

这是问题:我已经部署了我的业务网络,安装了它,启动了它,创建了我的网络管理卡并导入了它,然后测试一切是否正常,我必须命令作曲家网络ping --card NAME-OF -MY-ADMIN-CARD

出现此错误:

juan@JuanDeDios:~/proyectos/inovacion/a3-poliza-microservice$ composer network ping --card admin@a3-policy-microservice
Error: transaction returned with failure: AccessException: Participant 'org.hyperledger.composer.system.NetworkAdmin#admin' does not have 'READ' access to resource 'org.hyperledger.composer.system.Network#a3-policy-microservice@0.0.1'
Command failed

我认为它必须与permission.acl文件做一些事情,并向所有人授予所有权限,因此对任何人都没有任何限制,然后再次尝试,但失败了.

所以我以为我必须卸载我的业务网络并重新创建它,我也删除了.bna和network.card文件,因此将再次创建所有内容,但会出现相同的错误结果.

我的另一尝试是更新业务网络,但没有成功,发生了相同的错误,我确信我不会错过

6-.创建了我的资产,参与者和交易 7-.将我的许可规则更改为我的 8.我生成了.bna文件

composer archive create -t dir -n .

9-.然后安装我的bna文件

composer network install --card PeerAdmin@hlfv1 --archiveFile a3-policy-microservice@0.0.1.bna

10-.然后启动我的网络并创建我的网络管理员卡

composer network start --networkName a3-policy-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card

11-.导入了我的卡

composer card import --file networkadmin.card

12-.试图ping我的网络

composer network ping --card admin@a3-poliza-microservice

发生错误

后来,我试图再次创建所有内容,以关闭我的结构并重新启动它,并从第一步开始创建网络.

我的另一尝试是更改权限并升级我的bna网络,但是它也失败了.我的选项用完了

希望此描述不要太久而忽略它.预先感谢

解决方案

感谢您提出的问题!

第一种可能是您的网络名称为a3-policy-network,但您正在ping通名为a3-poliza-microservice的网络-一旦获得正确的ACL(当前,这就是您要解决的错误). /p>

升级过程通常如下:

在执行完第12步后(假设使用正确的网络名称,由于受限的ACL条件而无法对企业网络执行ping操作),您将拥有:

  1. 进行更改以包括您的系统ACL,例如

/** *示例访问控制列表. */

rule SystemACL {
description: "System ACL to permit all access"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}

rule NetworkAdminUser {
description: "Grant business network administrators full access to user resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "**"
action: ALLOW
}

rule NetworkAdminSystem {
description: "Grant business network administrators full access to system resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}

  1. 更新商业网络项目目录中现有package.json中的版本"字段(即,需要在下一个增量中进行更改-例如,将version属性从0.0.1更新为0.0.2.) /p>

  2. 在同一目录中,运行以下命令:

    composer archive create --sourceType dir --sourceName . -a a3-policy-network@0.0.2.bna
    

  3. 现在首先安装新的业务网络代码:

    composer network install --card PeerAdmin@hlfv1 --archiveFile a3-policy-network@0.0.2.bna
    

  4. 然后执行必要的升级步骤(参数的缩写形式为单个-"):

    composer network upgrade -c PeerAdmin@hlfv1 -n a3-policy-network -V 0.0.2
    

  5. 几秒钟后,再次对网络执行ping操作,以查看ACL更改现已生效:

    composer network ping -c a3-policy-network 
    

Im trying to learn Hyperledger Composer but seems to be a relatively new technology, i mean there are few tutorials and few solutions to a lot of questions, tutorial does not mention possible error case when following the commands and which means there are is also no solution for those errors.

I have joined the composer channel in their community chat, looks like its running in Discord or something, and asked the same question without a response, i have a better experience here in SO.

This is the problem: I have deployed my business network, installed it, started it, created my network admin card and imported it, then to test if everything is ok i have to command composer network ping --card NAME-OF-MY-ADMIN-CARD

And this error comes:

juan@JuanDeDios:~/proyectos/inovacion/a3-poliza-microservice$ composer network ping --card admin@a3-policy-microservice
Error: transaction returned with failure: AccessException: Participant 'org.hyperledger.composer.system.NetworkAdmin#admin' does not have 'READ' access to resource 'org.hyperledger.composer.system.Network#a3-policy-microservice@0.0.1'
Command failed

I think that it has to do something with the permission.acl file, and gave permission to everyone to everything so there would not be any restrictions to anyone, and tryied again, but failed.

So i thought i had to uninstall my business network and create it again, i deleted my .bna and my network.card files also so everything would be created again, but the same error result.

My other attempt was to update the business network, but didn't work, the same error happened and I'm sure i didn't miss any step from the tutorial. I do also followed the playground tutorial. What i have not done its to create another app with the Yeoman but i will do if i don't find a solution to this problem which would not require me to create another app.

This were my steps: 1-. Created my app with Yeoman

yo hyperledger-composer:businessnetwork

2-. Selected Apache-2.0 for my license 3-. Created a3-policy-microservice as the name of the business network 4-. Created org.microservice.policy (Yeah i switched names but Im totally aware) 5-. Generated my app with a template selecting the NO option

6-. Created my assets, participants and transactions 7-. Changed my permission rules to mine 8-. I generated the .bna file

composer archive create -t dir -n .

9-. Then installed my bna file

composer network install --card PeerAdmin@hlfv1 --archiveFile a3-policy-microservice@0.0.1.bna

10-. Then started my network and created my networkadmin card

composer network start --networkName a3-policy-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card

11-. Imported my card

composer card import --file networkadmin.card

12-. Tried to ping my network

composer network ping --card admin@a3-poliza-microservice

And the error happens

Later i tried to create everything again shutting down my fabric and started it again and creating the network from the first step.

My other attempt was to change the permissions and upgrade my bna network, but it failed too. Im running out of options

Hope this description its not too long to ignore it. Thanks in advance

解决方案

thanks for the question!

First possibility is that your network name is a3-policy-network but you're pinging a network called a3-poliza-microservice - once you do get the correct ACLs in place (currently, that's the error you're trying to resolve).

The procedure for upgrade would normally be the procedure below:

After your step 12 (where you can't ping the business network due to restrictive ACL conditions, assuming you are using the right network name) you would have:

  1. Make the changes to to include your System ACLs this time eg.

/** * Sample access control list. */

rule SystemACL {
description: "System ACL to permit all access"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}

rule NetworkAdminUser {
description: "Grant business network administrators full access to user resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "**"
action: ALLOW
}

rule NetworkAdminSystem {
description: "Grant business network administrators full access to system resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}

  1. Update the "version" field in your existing package.json in your Business Network project directory (ie need to change it next increment - eg. update the version property from 0.0.1 to 0.0.2.)

  2. From the same directory, run the following command:

    composer archive create --sourceType dir --sourceName . -a a3-policy-network@0.0.2.bna
    

  3. Now install the new business network code firstly:

    composer network install --card PeerAdmin@hlfv1 --archiveFile a3-policy-network@0.0.2.bna
    

  4. Then perform the requisite upgrade step (single '-' for short form of the parameter):

    composer network upgrade -c PeerAdmin@hlfv1 -n a3-policy-network -V 0.0.2
    

  5. After a few seconds, ping the network again to see ACL changes are now in effect:

    composer network ping -c a3-policy-network 
    

这篇关于到业务网络的Hyperledger Composer CLI Ping返回AccessException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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