简体   繁体   English

使用 Fabric Node SDK 向现有 Hyperledger Fabric 网络添加新组织

[英]Adding a new Org to an existing Hyperledger Fabric network using the Fabric Node SDK

Here is where I am at the moment:这是我目前所处的位置:

Fabric version 1.4.1 Using byfn.sh to create Org1, Org2, Orderer etc and bring the channel mychannel up Language: Node using Typescript Fabric 版本 1.4.1 使用 byfn.sh 创建 Org1、Org2、Orger 等并启动频道 mychannel 语言:使用 Typescript 的节点

I have followed the instructions in this tutorial to add a third org Org3 https://medium.com/@kctheservant/add-a-new-organization-on-existing-hyperledger-fabric-network-2c9e303955b2我按照本教程中的说明添加了第三个组织 Org3 https://medium.com/@kctheservant/add-a-new-organization-on-existing-hyperledger-fabric-network-2c9e303955b2

This works great.这很好用。

Now, I would like to add another Org but using the Fabric Node SDK.现在,我想添加另一个 Org,但使用 Fabric Node SDK。 Is that possible?那可能吗?

Scenario is this:场景是这样的:

  1. A network admin logs into a custom UI being developed to manage a Fabric network.网络管理员登录正在开发的自定义 UI 以管理 Fabric 网络。
  2. The admin inputs details such as new Org name, MSP ID, peers info into the UI管理员在 UI 中输入详细信息,例如新组织名称、MSP ID、对等信息
  3. The UI invokes a service layer which will UI 调用一个服务层,它将

    1. Invoke a Fabric Node SDK API to create crypto materials for the new Org b.调用 Fabric 节点 SDK API 为新组织创建加密材料 b。
    2. Invoke Fabric Node SDK API to create the new Org and have it join the channel mychannel调用 Fabric Node SDK API 来创建新的 Org 并让它加入频道 mychannel
    3. Install chaincode to the new Org's peers d.将链码安装到新组织的对等节点 d.
    4. Run some tests of invoke and query chaincode to ensure that the new Org can query and submit transactions运行一些调用和查询链码的测试,以确保新的 Org 可以查询和提交交易

In the last step, I will save the new channel configuration and the new Org configuration to yaml or json files.在最后一步中,我将新的通道配置和新的 Org 配置保存到 yaml 或 json 文件中。

I have looked at the Node SDK and have seen the Organization and Channel methods.我查看了 Node SDK 并查看了OrganizationChannel方法。 However, it seems like the Organization class is not exposed as a type for Typescript, so I am not sure how to use it.但是,似乎 Organization 类没有作为 Typescript 的类型公开,所以我不确定如何使用它。

It would help if someone could explain the methods I need to use to get to what I am trying to do.如果有人可以解释我需要使用的方法来完成我正在尝试做的事情,那将会有所帮助。

I would appreciate any help.我将不胜感激任何帮助。

Thanks in advance.提前致谢。

Actually, the title of the article is misleading.实际上,文章的标题具有误导性。 In the article, you are adding a new org in the existing channel not in the network.在本文中,您将在现有渠道而非网络中添加新组织。

Please take a look at the official documentation.请看一下官方文档。 The same tutorial.同样的教程。
Adding an Org to a Channel 将组织添加到频道

For your requirement, yes we can do the same using the node sdk.根据您的要求,是的,我们可以使用 node sdk 执行相同的操作。

Check out this tutorial.看看这个教程。 update channel config 更新频道配置

In the tutorial, they are updating the channel id to create a new channel with that id.在本教程中,他们正在更新频道 ID 以创建具有该 ID 的新频道。

You can use the same steps to update the organizations.您可以使用相同的步骤来更新组织。

You have to run shell command using either by shell.js or child-process .您必须使用 by shell.jschild-process运行shell命令。

Hope it will clear your doubts.希望它能解开你的疑惑。

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

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