我正在尝试使用以下内容构建Hyperledger Fabric网络
Smartforce [订购者组织]
Falcon.io [ORG1]
Frost.io [ORG2]
我已经使用cryptogen工具生成了所有加密材料。 现在正在寻找使用configtxgen工具构建gensis块。
这里是configtx.yaml
:
Profiles:
TwoOrgOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *Smartforce
Consortiums:
SampleConsortium:
Organizations:
- *BusinessPartner1
- *BusinessPartner2
TwoOrgChannel:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *BusinessPartner1
- *BusinessPartner2
Organizations:
- &Smartforce
Name: smartforce
ID: SmartforceMSP
MSPDir: /home/falcon/iq-smartforce/crypto-config/ordererOrganizations/smartforce.io/msp
- &BusinessPartner1
Name: BusinessPartner1
ID: FalconMSP
MSPDir: /home/falcon/iq-smartforce/crypto-config/peerOrganizations/falcon.io/msp
- &BusinessPartner2
Name: BusinessPartner2
ID: FrostMSP
MSPDir: /home/frost/iq-smartforce/crypto-config/peerOrganizations/frost.io/msp
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- orderer.smartforce.io:7050
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Organizations:
Application: &ApplicationDefaults
Organizations:
当我运行命令时:
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
我收到以下错误:
2018-12-12 14:55:55.834 IST [common/tools/configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen is deprecated. Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
2018-12-12 14:55:55.834 IST [common/tools/configtxgen] main -> INFO 002 Loading configuration
2018-12-12 14:55:55.834 IST [common/tools/configtxgen/localconfig] Load -> CRIT 003 Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced
2018-12-12 14:55:55.834 IST [common/tools/configtxgen] func1 -> CRIT 004 Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced
panic: Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced [recovered]
panic: Error reading configuration: While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced
goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc4201abe30, 0xc42048fd10, 0x1, 0x1)
/w/workspace/fabric-nightly-release-job-release-1.2-x86_64/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:188 +0xbd
main.main.func1()
/w/workspace/fabric-nightly-release-job-release-1.2-x86_64/gopath/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:254 +0x1ae
panic(0xc6ea00, 0xc42048fd00)
/opt/go/go1.10.linux.amd64/src/runtime/panic.go:505 +0x229
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc4201abc80, 0xc420484ae0, 0x2, 0x2)
/w/workspace/fabric-nightly-release-job-release-1.2-x86_64/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:188 +0xbd
github.com/hyperledger/fabric/common/tools/configtxgen/localconfig.Load(0x7ffdcf041294, 0x15, 0x0, 0x0, 0x0, 0x1)
/w/workspace/fabric-nightly-release-job-release-1.2-x86_64/gopath/src/github.com/hyperledger/fabric/common/tools/configtxgen/localconfig/config.go:277 +0x469
main.main()
/w/workspace/fabric-nightly-release-job-release-1.2-x86_64/gopath/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:265 +0xce7
答案 0 :(得分:2)
在YAML中,文件中的所有锚点(以&
开头的标记)需要在对它们的任何引用之前(使用别名,以*
开头的标记)。
因此,在根级别映射中,应将密钥Profiles
及其值放在密钥Organizations
,Orderer
和Application
(及其值)之后: / p>
Organizations:
- &Smartforce
Name: smartforce
ID: SmartforceMSP
MSPDir: /home/falcon/iq-smartforce/crypto-config/ordererOrganizations/smartforce.io/msp
- &BusinessPartner1
Name: BusinessPartner1
ID: FalconMSP
MSPDir: /home/falcon/iq-smartforce/crypto-config/peerOrganizations/falcon.io/msp
- &BusinessPartner2
Name: BusinessPartner2
ID: FrostMSP
MSPDir: /home/frost/iq-smartforce/crypto-config/peerOrganizations/frost.io/msp
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- orderer.smartforce.io:7050
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Organizations:
Application: &ApplicationDefaults
Organizations:
Profiles:
TwoOrgOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *Smartforce
Consortiums:
SampleConsortium:
Organizations:
- *BusinessPartner1
- *BusinessPartner2
TwoOrgChannel:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *BusinessPartner1
- *BusinessPartner2