问题
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.
- TwoOrgsOrdererGenesis This defines the orderer service and the genesis block details.
- 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:
- What is the role of Consortium?
- Can a Consortium entity would have peer nodes running for it's own?
- If yes, how to configure in this yaml file?
- What is the meaning of <<: line?
- What is Application in this context?
- 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