Hyperledger Fabric 0.6 pbft 共识

Hyperledger Fabric 0.6 pbft Consensus

我在远程机器上设置了 Hyperledger fabric (v0.6) 网络。我想为块的承诺启用 pbft 共识。我可以在日志中看到启用了 pbft 共识,并且对等点能够连接到根节点。我在所有 4 个对等点上部署了我的链代码,并在一个点上调用了一个事务。即使很长一段时间后,我也没有在任何对等点中看到任何提交,尽管对等点传播状态发生了很大变化。

以下是我在根节点的 docker-compose.yml 文件:

membersrvc:
   image: hyperledger/fabric-membersrvc
   restart: unless-stopped
   ports:
    - "7054:7054"
   expose:
     - "7054"
   volumes:
     - /var/run/docker.sock:/var/run/docker.sock
   environment:
     - MEMBERSRVC_CA_ACA_ENABLED=true
   command: membersrvc

  vp0:
     image: hyperledger/fabric-peer:latest
     restart: unless-stopped
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     environment:
        - CORE_PEER_ID=vp0
        - CORE_SECURITY_ENABLED=false
        - CORE_SECURITY_ENROLLID=test_vp0
        - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
        - CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
        - CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
        - CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
        - CORE_PEER_ADDRESSAUTODETECT=true
        - CORE_PEER_NETWORKID=dev
        - CORE_LOGGING_LEVEL=debug  #critical, error, warning, notice, info, debug
        # The following section enables pbft consensus
        - CORE_PBFT_GENERAL_BATCHSIZE=1
        - CORE_PBFT_GENERAL_K=2
        - CORE_PBFT_GENERAL_MODE=classic
        - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft  # noops, pbft
        - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s
        # - CORE_NOOPS_BLOCK_TIMEOUT=2s
        # - CORE_NOOPS_BLOCK_WAIT=2s
     ports:
        - "7050:7050"
        - "7051:7051"
     expose:
        - "7051"
        - "7052"
        - "7053"
     links:
        - membersrvc
     command: sh -c "sleep 20; peer node start"

这是每个对等节点的 docker-compose.yml 文件:

vp1:
     image: hyperledger/fabric-peer:latest
     restart: unless-stopped
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     environment:
        - CORE_PEER_DISCOVERY_ROOTNODE=root-node-ip:7051
        - CORE_PEER_ID=vp1
        - CORE_SECURITY_ENABLED=false
        - CORE_SECURITY_ENROLLID=test_vp1
        - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
        - CORE_PEER_PKI_ECA_PADDR=http://root-node-ip:7054
        - CORE_PEER_PKI_TCA_PADDR=http://root-node-ip:7054
        - CORE_PEER_PKI_TLSCA_PADDR=http://root-node-ip:7054
        - CORE_PEER_ADDRESSAUTODETECT=true
        - CORE_PEER_NETWORKID=dev
        - CORE_LOGGING_LEVEL=debug  #critical, error, warning, notice, info, debug
        # The following section enables pbft consensus
        - CORE_PBFT_GENERAL_BATCHSIZE=1
        - CORE_PBFT_GENERAL_K=2
        - CORE_PBFT_GENERAL_MODE=classic
        - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft  # noops, pbft
        - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s
        #- CORE_NOOPS_BLOCK_TIMEOUT=2s
        #- CORE_NOOPS_BLOCK_WAIT=2s
     ports:
        - "7050:7050"
        - "7051:7051"
     expose:
        - "7051"
        - "7052"
        - "7053"
     command: sh -c "sleep 20; peer node start"

任何人都可以帮忙。谢谢

我认为对等方无法使用其 docker 发布的 IP 地址执行握手。我通过将 CORE_PEER_ADDRESSAUTODETECT 设置为 false 来关闭自动检测,并通过将 CORE_PEER_ADDRESS 设置为实例的 public ip 并将 CORE_PEER_DISCOVERY_ROOTNODE 设置为 ip 让对等点相互发现节点将与其账本同步的验证器地址。