What does each definition in configtx.yaml means in Hyperledger fabric v1.0?

♀尐吖头ヾ 提交于 2019-12-20 15:28:06

问题


This is related to Hyperledger fabric v1.0 network topology. From the example, configtx.yaml contains following definitions:

Profiles:

    TwoOrgsOrdererGenesis:
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
    TwoOrgsChannel:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2

There are two main sections.

  1. TwoOrgsOrdererGenesis This defines the orderer service and the genesis block details.
  2. TwoOrgsChannel This defines the channel details. Such as how many organization/entity are going to be part of the channel.

What I understood from the documentation is Consortiums section defines what are the organizations/entities belongs to a Consortium.

My questions:

  1. What is the role of Consortium?
  2. Can a Consortium entity would have peer nodes running for it's own?
  3. If yes, how to configure in this yaml file?
  4. What is the meaning of <<: line?
  5. What is Application in this context?
  6. Can I define multiple profiles in this yaml file?

appreciate if anyone can explain in details.


回答1:


My questions:

What is the role of Consortium?

A consortium consists of organizations. And organization contains peers or orderer. one channel is matched with one consortium but one consortium can be matched many consortiums.

Can a Consortium entity would have peer nodes running for it's own? If yes, how to configure in this yaml file?

No, but if you want to define consortium, you have to get MSPs about organizations.

What is the meaning of <<: line?

It's a YAML grammar.

What is Application in this context?

channel application like Node.js Application. But now My channel works without the section.

Can I define multiple profiles in this yaml file?

sorry, I don't understand what you want to define profile for.




回答2:


to reply to "Can I define multiple profiles in this yaml file?" the answer is yes. As you can see in this sample file, multiple profiles are here defined.

Profiles are used to defines the configuration of the genesis block and to define the first channel configuration transaction. In the code that you provide TwoOrgsOrdererGenesis should be used as parameter for the configtxgen command

configtxgen -profile SampleSingleMSPSolo -channelID sys-channel -outputBlock ./channel-artifacts/genesis.block

while the second is used to generate the artifacts for the channel transaction

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID channel-name

In the above file you can check some different configurations... I think it is a good starting point to understand the network configuration which is still something I'm trying to fully figure out.




回答3:


Regarding the question "What is the meaning of <<: line?"

yaml files syntax :-

The & marks an alias for the node (in your example &default aliases the development node as "default") and the * references the aliased node with the name "default". The <<: inserts the content of that node.

This type reference are used when - Repeated nodes (objects) are first identified by an anchor (marked with the ampersand - “&”), and are then aliased (referenced with an asterisk - “*”) thereafter.



来源:https://stackoverflow.com/questions/44232088/what-does-each-definition-in-configtx-yaml-means-in-hyperledger-fabric-v1-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!