首页 > 解决方案 > 从使用 Hyperledger 作曲家开始,无法在设计的三个组织上运行作曲家安装

问题描述

我正在通过从一开始就设计 3 个组织来为我的本科论文设置 Hyperledger Composer 区块链(我从一开始就需要 3 个组织,所以部署 2 个组织然后再加入一个,就像 Fabric 和 Composer 中的示例一样。我实际上想要部署在结构中,但我认为我没有时间(我会为我的硕士论文做)

我之前尝试过本教程(创建 2 个组织,然后再加入一个),我可以成功运行 composer network start,但是当我在我正在运行的 3 个组织上运行它时,出现错误

我不确定我是否应该在这里显示我的所有代码,所以也许我会从应该是错误来源的所有 yaml 文件中显示我的 org 3

(显示我添加的代码)

docker-compose-cas.yaml

    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca-org3
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org3.example.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/8d560caca38e3757c9704e68a53b2a3b00027ee0f940a5fd5f20051182c255a6_sk
    ports:
      - "9054:7054"
    command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org3.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/8d560caca38e3757c9704e68a53b2a3b00027ee0f940a5fd5f20051182c255a6_sk -b admin:adminpw -d'
    volumes:
      - ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
    container_name: ca_peerOrg3
    networks:
      - byfn

docker-compose-cli.yaml

peer0.org3.example.com:
    container_name: peer0.org3.example.com
    extends:
      file:  base/docker-compose-base.yaml
      service: peer0.org3.example.com
    networks:
      - byfn

  peer1.org3.example.com:
    container_name: peer1.org3.example.com
    extends:
      file:  base/docker-compose-base.yaml
      service: peer1.org3.example.com
    networks:
      - byfn

docker-compose-cli.yaml

couchdb4:
    container_name: couchdb4
    image: hyperledger/fabric-couchdb
    # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
    # for CouchDB.  This will prevent CouchDB from operating in an "Admin Party" mode.
    environment:
      - COUCHDB_USER=
      - COUCHDB_PASSWORD=
    # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
    # for example map it to utilize Fauxton User Interface in dev environments.
    ports:
      - "9984:5984"
    networks:
      - byfn

  peer0.org3.example.com:
    environment:
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb4:5984
      # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
      # provide the credentials for ledger to connect to CouchDB.  The username and password must
      # match the username and password set for the associated CouchDB.
      - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
      - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
    depends_on:
      - couchdb4

  couchdb5:
    container_name: couchdb5
    image: hyperledger/fabric-couchdb
    # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
    # for CouchDB.  This will prevent CouchDB from operating in an "Admin Party" mode.
    environment:
      - COUCHDB_USER=
      - COUCHDB_PASSWORD=
    # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
    # for example map it to utilize Fauxton User Interface in dev environments.
    ports:
      - "10984:5984"
    networks:
      - byfn

  peer1.org3.example.com:
    environment:
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb5:5984
      # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
      # provide the credentials for ledger to connect to CouchDB.  The username and password must
      # match the username and password set for the associated CouchDB.
      - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
      - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
    depends_on:
      - couchdb5

docker-compose-e2e.yaml

volumes:
  orderer.example.com:
  peer0.org1.example.com:
  peer1.org1.example.com:
  peer0.org2.example.com:
  peer1.org2.example.com:
  peer0.org3.example.com:
  peer1.org3.example.com:

....

  ca2:
    image: hyperledger/fabric-ca:$IMAGE_TAG
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca-org3
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org3.example.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/2e2efd3ddc1ac66712feb13c1747b217ffc2c4fef9dc701c224e084d09c3ba0e_sk
    ports:
      - "9054:7054"
    command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org3.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/2e2efd3ddc1ac66712feb13c1747b217ffc2c4fef9dc701c224e084d09c3ba0e_sk -b admin:adminpw -d'
    volumes:
      - ./crypto-config/peerOrganizations/org3.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
    container_name: ca_peerOrg3
    networks:
      - byfn

  peer0.org3.example.com:
    container_name: peer0.org3.example.com
    extends:
      file:  base/docker-compose-base.yaml
      service: peer0.org3.example.com
    networks:
      - byfn

  peer1.org3.example.com:
    container_name: peer1.org3.example.com
    extends:
      file:  base/docker-compose-base.yaml
      service: peer1.org3.example.com
    networks:
      - byfn


加密配置.yaml

PeerOrgs:
  - Name: Org3
    Domain: org3.example.com
    EnableNodeOUs: true
    Template:
      Count: 2
    Users:
      Count: 1

背书政策.json

"policy": {
        "3-of": [
            {
                "signed-by": 0
            },
            {
                "signed-by": 1
            },
            {
                "signed-by": 2
            }
        ]
    }

配置文件.yaml

Profiles:

    ThreeOrgsOrdererGenesis:
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
                    - *Org3
    ThreeOrgsChannel:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
                - *Org3
            Capabilities:
                <<: *ApplicationCapabilities

运行时总是出现这样的错误:

composer network start -c PeerAdmin@byfn-network-org1 -n trade-network -V 0.2.6-deploy.0 -o endorsementPolicyFile=/tmp/composer/endorsement-policy.json -A warehouse -C ./users/warehouse/admin-pub.pem -A asp -C ./users/asp/admin-pub.pem -A site -C ./users/site/admin-pub.pem

它显示了这样的错误(https://hyperledger.github.io/composer/unstable/tutorials/deploy-to-fabric-multi-org中的第十七步错误):

Starting business network trade-network at version 0.2.6-deploy.0

Processing these Network Admins: 
        userName: warehouse
        userName: asp
        userName: site

✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: Failed to connect to any peer event hubs. It is required that at least 1 event hub has been connected to receive the commit event
Command failed

我不太了解fabric,所以是因为org3的对等体没有正确连接?还是因为我的政策?

标签: hyperledger-fabricblockchainhyperledger-composer

解决方案


推荐阅读