qq_48425324 2023-05-24 18:21 采纳率: 0%
浏览 51
已结题

fabric区块链 共识算法

fabric V2.4,在configtx.yaml配置文件中配置smart BFT共识报错
在生成创世区块时,报错‘Profiles[BFTTwoOrgsApplicationGenesis].Orderer' has invalid keys: ConsenterMapping, SmartBFT
我的配置文件具体如下
Organizations:
    - &OrdererOrg
        Name: OrdererOrg
        ID: OrdererMSP
        MSPDir: ./crypto-config/ordererOrganizations/example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"

    - &Org1
        Name: Org1MSP
        ID: Org1MSP
        MSPDir: ./crypto-config/peerOrganizations/org1.example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org1MSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('Org1MSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('Org1MSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('Org1MSP.member')"

        AnchorPeers:
            - Host: peer0.org1.example.com
              Port: 7051

    - &Org2
        Name: Org2MSP
        ID: Org2MSP
        MSPDir: ./crypto-config/peerOrganizations/org2.example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org2MSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('Org2MSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('Org2MSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('Org2MSP.member')"

        AnchorPeers:
            - Host: peer0.org2.example.com
              Port: 8051


Capabilities:
    Channel: &ChannelCapabilities
        V2_0: true
    Orderer: &OrdererCapabilities
        V2_0: true
    Application: &ApplicationCapabilities
        V2_5: true

Application: &ApplicationDefaults

    Organizations:

    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        LifecycleEndorsement:
            Type: ImplicitMeta
            Rule: "MAJORITY Endorsement"
        Endorsement:
            Type: ImplicitMeta
            Rule: "MAJORITY Endorsement"

    Capabilities:
        <<: *ApplicationCapabilities

Orderer: &OrdererDefaults

    BatchTimeout: 20s

    # Batch Size: Controls the number of messages batched into a block
    BatchSize:

        MaxMessageCount: 10

        AbsoluteMaxBytes: 99 MB

        PreferredMaxBytes: 512 KB

    Organizations:

    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        # BlockValidation specifies what signatures must be included in the block
        # from the orderer for the peer to validate it.
        BlockValidation:
            Type: ImplicitMeta
            Rule: "ANY Writers"

Channel: &ChannelDefaults

    Policies:
        # Who may invoke the 'Deliver' API
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        # Who may invoke the 'Broadcast' API
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        # By default, who may modify elements at this config level
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    Capabilities:
        <<: *ChannelCapabilities

Profiles:
    TwoOrgsChannel:
        Consortium: SampleConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities
    
    TwoOrgsOrdererGenesis:
        <<: *ChannelDefaults
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2

    BFTTwoOrgsApplicationGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Addresses:
                - orderer.example.com:7050
                - orderer1.example.com:8050
                - orderer2.example.com:9050
            Organizations:
                - *OrdererOrg
            Capabilities: *OrdererCapabilities
            OrdererType: BFT
            SmartBFT:
                RequestBatchMaxCount: 100
                RequestBatchMaxInterval: 50ms
                RequestForwardTimeout: 2s
                RequestComplainTimeout: 20s
                RequestAutoRemoveTimeout: 3m0s
                ViewChangeResendInterval: 5s
                ViewChangeTimeout: 20s
                LeaderHeartbeatTimeout: 1m0s
                CollectTimeout: 1s
                RequestBatchMaxBytes: 10485760
                IncomingMessageBufferSize: 200
                RequestPoolSize: 400
                LeaderHeartbeatCount: 10
            ConsenterMapping:
            - ID: 1
              Host: orderer.example.com
              Port: 7050
              MSPID: OrdererMSP
              Identity: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem
              ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
              ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
            - ID: 2
              Host: orderer1.example.com
              Port: 8050
              MSPID: OrdererMSP
              Identity: ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp/signcerts/orderer1.example.com-cert.pem
              ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt
              ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt
            - ID: 3
              Host: orderer2.example.com
              Port: 9050
              MSPID: OrdererMSP
              Identity: ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp/signcerts/orderer2.example.com-cert.pem
              ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
              ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities: *ApplicationCapabilities
具体报错信息如下所示

img

我的https://img-mid.csdnimg.cn/release/static/image/mid/ask/520643329486144.png "#left")

该怎么改错

如何修改配置文件?
  • 写回答

5条回答 默认 最新

  • 鱼弦 全栈领域优质创作者 2023-05-25 11:25
    关注
    获得4.50元问题酬金

    根据您提供的配置文件和报错信息,可以看出问题出在BFTTwoOrgsApplicationGenesis配置中的Orderer部分。报错信息指出SmartBFT和ConsenterMapping是无效的键。这是因为在Fabric v2.4中,SmartBFT和ConsenterMapping不应该在Orderer部分中出现,而应该在Orderer的子部分EtcdRaft中定义。

    所以,您需要将SmartBFT和ConsenterMapping移动到Orderer.EtcdRaft的子部分中。以下是您的配置文件进行修改后的示例:

    BFTTwoOrgsApplicationGenesis:
      <<: *ChannelDefaults
      Orderer:
        <<: *OrdererDefaults
        OrdererType: etcdraft
        EtcdRaft:
          Consenters:
            - Host: orderer.example.com
              Port: 7050
              ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
              ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
            - Host: orderer1.example.com
              Port: 8050
              ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt
              ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt
            - Host: orderer2.example.com
              Port: 9050
              ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
              ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
          Options:
            RequestTimeout: 2s
            ElectionTick: 10
            HeartbeatTick: 1
            MaxInflightBlocks: 5
            SnapshotIntervalSize: 20 MB
            TickInterval: 500ms
            BatchSize:
              MaxCount: 100
              AbsoluteMaxBytes: 99 MB
              PreferredMaxBytes: 512 KB
            Consenters:
              - Host: orderer.example.com
                Port: 7050
                ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
                ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
              - Host: orderer1.example.com
                Port: 8050
                ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt
                ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt
              - Host: orderer2.example.com
                Port: 9050
                ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
                ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
              - RequestTimeout: 2s
                ClientTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
                ServerTLSCert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
                Host: orderer.example.com
                Port: 7050
                Cert: ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem
                ID: myid
        Capabilities:
          <<: *OrdererCapabilities
        Organizations:
          - *OrdererOrg
      Application:
        <<: *ApplicationDefaults
        Organizations:
          - *Org1
          - *Org2
        Capabilities:
          <<: *ApplicationCapabilities
    
    

    在上述配置中,Orderer.EtcdRaft子部分中包含了Consenters和Options。Consenters定义了所有的共识节点,包括orderer.example.com、orderer1.example.com和orderer2.example.com,以及它们的TLS证书。Options定义了一些共识相关的选项,例如RequestTimeout、ElectionTick等等。

    在Orderer.EtcdRaft的子部分中,您还可以看到ConsenterMapping和SmartBFT被删除了。ConsenterMapping现在是不需要的,因为我们已经在Consenters中显式地定义了所有的共识节点。而SmartBFT则不应该在这里出现,因为它是与etcdraft共识类型无关的。

    修改后的配置文件应该可以解决您的问题。如果还有其他问题,请随时问我。

    评论

报告相同问题?

问题事件

  • 系统已结题 6月1日
  • 创建了问题 5月24日

悬赏问题

  • ¥15 35114 SVAC视频验签的问题
  • ¥15 impedancepy
  • ¥15 在虚拟机环境下完成以下,要求截图!
  • ¥15 求往届大挑得奖作品(ppt…)
  • ¥15 如何在vue.config.js中读取到public文件夹下window.APP_CONFIG.API_BASE_URL的值
  • ¥50 浦育平台scratch图形化编程
  • ¥20 求这个的原理图 只要原理图
  • ¥15 vue2项目中,如何配置环境,可以在打完包之后修改请求的服务器地址
  • ¥20 微信的店铺小程序如何修改背景图
  • ¥15 UE5.1局部变量对蓝图不可见