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

标签 hyperledger-fabric hyperledger hyperledger-composer

我正在使用 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/

相关文章:

javascript - Hyperledger Composer 查询 Assets 参数

ios - 使用 swift 从 Hyperledger iroha 创建新帐户时出错

hyperledger - Indy-node 在 Ubuntu 上安装失败

hyperledger-fabric - MVCC_READ_CONFLICT 并发提交多个事务时

hyperledger-fabric - Hyperledger Fabric 1.0 中的账本加密

javascript - (hyperledger Composer Playground) 你能在浏览器中看到 console.log ('something' ) 的结果吗?

javascript - 错误 : Expected a Resource or Concept

hyperledger-fabric - super 账本 : Not able to submit a transaction if one peer is down

docker - 在composer中将主机名更改为docker可解析的主机名

hyperledger-fabric - 通过 cryptogen 创建的用户和通过 Fabric CA Server 注册的用户之间的区别