gpt4 book ai didi

hyperledger-fabric - Hyperledger Composer 发出身份信息但缺少名片

转载 作者:行者123 更新时间:2023-12-02 08:23:31 24 4
gpt4 key购买 nike

我正在使用 Node.js 应用程序和“composer-client”npm 模块进行概念验证。

我尝试了不同的命令,例如添加参与者、添加 Assets 和执行交易,一切似乎都正常工作。

但是,当我尝试颁发新身份时,我没有得到预期的结果。我使用以下代码执行 Node.js 应用程序:

var businessNetwork = new BusinessNetworkConnection();
return businessNetwork.connect('admin@tutorial-network')
.then(() => {
return businessNetwork.issueIdentity('org.acme.biznet.Trader#Trader_001', 'usr001')
})
.then((result) => {
console.log(`userID = ${result.userID}`);
console.log(`userSecret = ${result.userSecret}`);
})
.catch((error) => {
console.error(error);
});

然后,UserId 和 UserSecret 将显示在控制台日志中。之后,我尝试对业务网络执行 ping 操作:

var businessNetwork = new BusinessNetworkConnection();
return businessNetwork.connect('usr001@tutorial-network')
.then(() => {
return businessNetwork.ping();
})
.then((result) => {
console.log(`participant = ${result.participant ? result.participant : '<no participant found>'}`);
})
.catch((error) => {
console.error(error);
});

但是,我收到以下错误消息:

{ Error: Card not found: usr001@tutorial-network
at IdCard.fromDirectory.catch.cause (/home/user.name/git_repositories/nodejs/first.blockchain.test/node_modules/composer-common/lib/cardstore/filesystemcardstore.js:73:27)
at <anonymous>
cause:
{ Error: Unable to read card directory: /home/user.name/.composer/cards/user001@tutorial-network

如果我执行命令composer Identity list -c admin@tutorial-network,我会得到以下输出:

$class:      org.hyperledger.composer.system.Identity
identityId: 9b49f67c262c0ae23e1e0c4a8dc61c4a12b5119df2b6a49fa2e02fa56b8818c3
name: usr001
issuer: 27c582d674ddf0f230854814b7cfd04553f3d0eac55e37d915386c614a5a1de9
certificate:
state: ISSUED
participant: resource:org.acme.biznet.Trader#Trader_001

但是,我找不到名片。

最佳答案

这对我有用。我使用的是 Composer 0.15.1。

var businessNetwork = new BusinessNetworkConnection();

return businessNetwork.connect('admin@carauction-network')
.then(() => {
return businessNetwork.ping();
})
.then((result) => {
console.log(`participant = ${result.participant ? result.participant : '<no participant found>'}`);
})
.catch((error) => {
console.error(error);
});

输出是这样的

linux1@fabric:~/eventclient$ node event.js
participant = org.hyperledger.composer.system.NetworkAdmin#admin

您可能需要将身份证导入钱包?

composer card import --file networkadmin.card

关于hyperledger-fabric - Hyperledger Composer 发出身份信息但缺少名片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47341554/

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