【问题标题】:Shared infrastructure in Hyperledger FabricHyperledger Fabric 中的共享基础架构
【发布时间】:2021-04-05 17:56:04
【问题描述】:

我正在检查一个用例是否可以共享对等点、调用链代码函数并与不同的 MSP 执行事务。这是一个用例,其中一些不愿意在基础设施上花钱但可能希望使用网络运营商运行的区块链网络的组织需要共享环境。

例如,拥有 MSP org1 的网络运营商创建了一个 Hyperledger Fabric 网络。 org4 想加入网络但没有任何对等方。 CA 容器将用于此org4org4 身份是否可以在 org1 对等方上调用事务? 我实际上试过这个。查看下面其余客户端的日志:

[Service Discovery Turned On]
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - start - org4
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer0.org1.com:7051 - org1
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer1.org1.com:7051 - org1
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer1.networkoperator.com:7051 - networkoperator
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer0.networkoperator.com:7051 - networkoperator
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer0.org2.com:7051 - org2
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer1.org2.com:7051 - org2
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer0.org3.com:7051 - org3
2021-04-02T04:19:27.643Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer1.org3.com:7051 - org3
2021-04-02T04:19:27.643Z - debug: [RoundRobinQueryHandler]: constructor: peers=[]

以上日志显示 rest-client 尝试将 MSP id 与 peers 匹配

没有服务发现的日志:

[Service Discovery Turned Off]
2021-04-02T04:39:11.091Z - debug: [Channel]: _getServiceEndpoints - start - org4
2021-04-02T04:39:11.091Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer0.org1.com - org1
2021-04-02T04:39:11.091Z - debug: [Channel]: _getServiceEndpoints - Endorser mspid not matched, not added peer1.org1.com - org1
2021-04-02T04:39:11.091Z - debug: [RoundRobinQueryHandler]: constructor: peers=[]

一般来说,这些组织会加入共享基础架构,当他们准备好使用自己的基础架构时,就会迁移到该基础架构。同时,他们将通过自己的身份调用链码函数

【问题讨论】:

  • 没有对等点的组织肯定可以调用事务,只要它们已被添加到适当的通道。您是否将org4 添加到所有相关频道?
  • 是的,@GariSingh。我已将该组织添加到频道中。我正在使用 HLF 2.3.1
  • 您能发布更多您的客户端代码吗?不确定您正在调用哪些函数
  • @GariSingh 我检查了对等日志2021-04-04 15:24:10.447 UTC [policies] SignatureSetToValidIdentities -> WARN 65875 invalid identity: certificate subject=CN=admin,OU=client serialnumber=529341260981649280325273063095564239165763549342 error="the supplied identity is not valid: x509: certificate signed by unknown authority"
  • org4 身份正在向 org1 的对等方发送交易,而这些对等方正在抛出上述警告

标签: hyperledger-fabric hyperledger hyperledger-chaincode hyperledger-fabric-ca


【解决方案1】:

fabric-sdk 试图将调用者的 MSP ID 与可用的背书者的 MSP ID 进行匹配,但由于没有与调用者的 MSP ID 匹配的对等方,因此整个事务都失败了。我必须禁用服务发现,将特定的对等点添加到目标对等点列表中才能使其正常工作。

一些代码:

const endorsingPeers = channel.getEndorsers('org1');

if (endorsingPeers.length > 0) transaction = transaction.setEndorsingPeers(endorsingPeers);
    
const response_payloads = await  transaction.evaluate(JSON.stringify(args))

【讨论】:

    【解决方案2】:

    在这种情况下,org4 将仅使用网络运营商提供给它的加密材料来连接到网络并调用链代码。跟随对我来说没有意义。

    org4 身份是否可以在 org1 对等点上调用事务?

    据我了解,只要您有 cyrpto 材料可以连接到 HLF,并且您有正确的连接配置文件,org4 运行的 HLF 客户端最终会向所有对等方发布交易,请检查模拟结果HLF 客户端,然后将事务发送给 orderer 以将其提交给对等方。

    因此,在您的情况下,我们将为 org4 创建一个新用户以供使用,然后 org4 将使用该加密材料来调用链码。任何组织提交的交易最终都会被所有参与组织的基础设施执行,因此有人不想贡献基础设施,他们只会使用加密材料连接到 HLF 网络,而不是添加和重用放在对等点上的现有链代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-05
      相关资源
      最近更新 更多