Documentation
¶
Index ¶
- Constants
- func DefaultConfigTemplate(conf *Profile) (*cb.ConfigGroup, error)
- func DoInspectBlock(inspectBlock string) error
- func DoInspectChannelCreateTx(inspectChannelCreateTx string) error
- func DoOutputBlock(config *Profile, channelID, outputBlock string) error
- func DoOutputChannelCreateTx(conf, baseProfile *Profile, channelID, outputChannelCreateTx string) error
- func DoPrintOrg(t *TopLevel, printOrg string) error
- func GetOutputBlock(config *Profile, channelID string) (*cb.Block, error)
- func HasSkippedForeignOrgs(conf *Profile) error
- func MakeChannelCreationTransaction(channelID string, signer identity.SignerSerializer, conf *Profile) (*cb.Envelope, error)
- func MakeChannelCreationTransactionFromTemplate(channelID string, signer identity.SignerSerializer, conf *Profile, ...) (*cb.Envelope, error)
- func MakeChannelCreationTransactionWithSystemChannelContext(channelID string, signer identity.SignerSerializer, ...) (*cb.Envelope, error)
- func NewApplicationGroup(conf *Application) (*cb.ConfigGroup, error)
- func NewApplicationOrgGroup(conf *Organization) (*cb.ConfigGroup, error)
- func NewChannelCreateConfigUpdate(channelID string, conf *Profile, templateConfig *cb.ConfigGroup) (*cb.ConfigUpdate, error)
- func NewChannelGroup(conf *Profile) (*cb.ConfigGroup, error)
- func NewConsortiumGroup(conf *Consortium) (*cb.ConfigGroup, error)
- func NewConsortiumOrgGroup(conf *Organization) (*cb.ConfigGroup, error)
- func NewConsortiumsGroup(conf map[string]*Consortium) (*cb.ConfigGroup, error)
- func NewOrdererGroup(conf *Orderer, channelCapabilities map[string]bool) (*cb.ConfigGroup, error)
- func NewOrdererOrgGroup(conf *Organization, channelCapabilities map[string]bool) (*cb.ConfigGroup, error)
- func WriteOutputBlock(block *cb.Block, outputBlock string) error
- type AnchorPeer
- type Application
- type BatchSize
- type Bootstrapper
- type ConsensusMetadata
- type Consenter
- type Consortium
- type Orderer
- type Organization
- type Policy
- type Profile
- type TopLevel
Constants ¶
const ( // EtcdRaft The type key for etcd based RAFT consensus. EtcdRaft = "etcdraft" BFT = "BFT" Arma = "arma" )
const ( // SampleInsecureSoloProfile references the sample profile which does not // include any MSPs and uses solo for ordering. SampleInsecureSoloProfile = "SampleInsecureSolo" // SampleDevModeSoloProfile references the sample profile which requires // only basic membership for admin privileges and uses solo for ordering. SampleDevModeSoloProfile = "SampleDevModeSolo" // SampleSingleMSPSoloProfile references the sample profile which includes // only the sample MSP and uses solo for ordering. SampleSingleMSPSoloProfile = "SampleSingleMSPSolo" // SampleDevModeEtcdRaftProfile references the sample profile used for testing // the etcd/raft-based ordering service. SampleDevModeEtcdRaftProfile = "SampleDevModeEtcdRaft" // SampleAppChannelInsecureSoloProfile references the sample profile which // does not include any MSPs and uses solo for ordering. SampleAppChannelInsecureSoloProfile = "SampleAppChannelInsecureSolo" // SampleAppChannelEtcdRaftProfile references the sample profile used for // testing the etcd/raft-based ordering service using the channel // participation API. SampleAppChannelEtcdRaftProfile = "SampleAppChannelEtcdRaft" // SampleAppChannelSmartBftProfile references the sample profile used for // testing the smartbft-based ordering service using the channel // participation API. SampleAppChannelSmartBftProfile = "SampleAppChannelSmartBft" // SampleSingleMSPChannelProfile references the sample profile which // includes only the sample MSP and is used to create a channel SampleSingleMSPChannelProfile = "SampleSingleMSPChannel" // SampleFabricX references the sample profile used for // testing the arma-based ordering service and the scalable committer. SampleFabricX = "SampleFabricX" // TwoOrgsSampleFabricX references the sample two organizations profile used for // testing the arma-based ordering service and the scalable committer. TwoOrgsSampleFabricX = "TwoOrgsSampleFabricX" // SampleConsortiumName is the sample consortium from the // sample configtx.yaml SampleConsortiumName = "SampleConsortium" // SampleOrgName is the name of the sample org in the sample profiles SampleOrgName = "SampleOrg" // AdminRoleAdminPrincipal is set as AdminRole to cause the MSP role of // type Admin to be used as the admin principal default AdminRoleAdminPrincipal = "Role.ADMIN" )
const ( // ConsensusTypeSolo identifies the solo consensus implementation. ConsensusTypeSolo = "solo" // ConsensusTypeEtcdRaft identifies the Raft-based consensus implementation. ConsensusTypeEtcdRaft = "etcdraft" // ConsensusTypeBFT identifies the BFT-based consensus implementation. ConsensusTypeBFT = "BFT" // ConsensusTypeArma identifies the Arma consensus implementation. ConsensusTypeArma = "arma" // BlockValidationPolicyKey TODO BlockValidationPolicyKey = "BlockValidation" // OrdererAdminsPolicy is the absolute path to the orderer admins policy OrdererAdminsPolicy = "/Channel/Orderer/Admins" // SignaturePolicyType is the 'Type' string for signature policies SignaturePolicyType = "Signature" // ImplicitMetaPolicyType is the 'Type' string for implicit meta policies ImplicitMetaPolicyType = "ImplicitMeta" )
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigTemplate ¶
func DefaultConfigTemplate(conf *Profile) (*cb.ConfigGroup, error)
DefaultConfigTemplate generates a config template based on the assumption that the input profile is a channel creation template and no system channel context is available.
func DoInspectBlock ¶
DoInspectBlock inspects a block from a file.
func DoInspectChannelCreateTx ¶
DoInspectChannelCreateTx inspects a config TX from a file.
func DoOutputBlock ¶
DoOutputBlock generates a genesis block and writes it to a file.
func DoOutputChannelCreateTx ¶
func DoOutputChannelCreateTx(conf, baseProfile *Profile, channelID, outputChannelCreateTx string) error
DoOutputChannelCreateTx generate a config TX and writes it to a file.
func DoPrintOrg ¶
DoPrintOrg prints organization info.
func GetOutputBlock ¶
GetOutputBlock generates a genesis block.
func HasSkippedForeignOrgs ¶
HasSkippedForeignOrgs is used to detect whether a configuration includes org definitions which should not be parsed because this tool is being run in a context where the user does not have access to that org's info
func MakeChannelCreationTransaction ¶
func MakeChannelCreationTransaction( channelID string, signer identity.SignerSerializer, conf *Profile, ) (*cb.Envelope, error)
MakeChannelCreationTransaction is a handy utility function for creating transactions for channel creation. It assumes the invoker has no system channel context so ignores all but the application section. Deprecated
func MakeChannelCreationTransactionFromTemplate ¶
func MakeChannelCreationTransactionFromTemplate( channelID string, signer identity.SignerSerializer, conf *Profile, template *cb.ConfigGroup, ) (*cb.Envelope, error)
MakeChannelCreationTransactionFromTemplate creates a transaction for creating a channel. It uses the given template to produce the config update set. Usually, the caller will want to invoke MakeChannelCreationTransaction or MakeChannelCreationTransactionWithSystemChannelContext.
func MakeChannelCreationTransactionWithSystemChannelContext ¶
func MakeChannelCreationTransactionWithSystemChannelContext( channelID string, signer identity.SignerSerializer, conf, systemChannelConf *Profile, ) (*cb.Envelope, error)
MakeChannelCreationTransactionWithSystemChannelContext is a utility function for creating channel creation txes. It requires a configuration representing the orderer system channel to allow more sophisticated channel creation transactions modifying pieces of the configuration like the orderer set. Deprecated
func NewApplicationGroup ¶
func NewApplicationGroup(conf *Application) (*cb.ConfigGroup, error)
NewApplicationGroup returns the application component of the channel configuration. It defines the organizations which are involved in application logic like chaincodes, and how these members may interact with the orderer. It sets the mod_policy of all elements to "Admins".
func NewApplicationOrgGroup ¶
func NewApplicationOrgGroup(conf *Organization) (*cb.ConfigGroup, error)
NewApplicationOrgGroup returns an application org component of the channel configuration. It defines the crypto material for the organization (its MSP) as well as its anchor peers for use by the gossip network. It sets the mod_policy of all elements to "Admins".
func NewChannelCreateConfigUpdate ¶
func NewChannelCreateConfigUpdate( channelID string, conf *Profile, templateConfig *cb.ConfigGroup, ) (*cb.ConfigUpdate, error)
NewChannelCreateConfigUpdate generates a ConfigUpdate which can be sent to the orderer to create a new channel. Optionally, the channel group of the ordering system channel may be passed in, and the resulting ConfigUpdate will extract the appropriate versions from this file.
func NewChannelGroup ¶
func NewChannelGroup(conf *Profile) (*cb.ConfigGroup, error)
NewChannelGroup defines the root of the channel configuration. It defines basic operating principles like the hashing algorithm used for the blocks, as well as the location of the ordering service. It will recursively call into the NewOrdererGroup, NewConsortiumsGroup, and NewApplicationGroup depending on whether these sub-elements are set in the configuration. All mod_policy values are set to "Admins" for this group, with the exception of the OrdererAddresses value which is set to "/Channel/Orderer/Admins".
func NewConsortiumGroup ¶
func NewConsortiumGroup(conf *Consortium) (*cb.ConfigGroup, error)
NewConsortiumGroup returns a consortiums component of the channel configuration. Each consortium defines the organizations which may be involved in channel creation, as well as the channel creation policy the orderer checks at channel creation time to authorize the action. It sets the mod_policy of all elements to "/Channel/Orderer/Admins".
func NewConsortiumOrgGroup ¶
func NewConsortiumOrgGroup(conf *Organization) (*cb.ConfigGroup, error)
NewConsortiumOrgGroup returns an org component of the channel configuration. It defines the crypto material for the organization (its MSP). It sets the mod_policy of all elements to "Admins".
func NewConsortiumsGroup ¶
func NewConsortiumsGroup(conf map[string]*Consortium) (*cb.ConfigGroup, error)
NewConsortiumsGroup returns the consortiums component of the channel configuration. This element is only defined for the ordering system channel. It sets the mod_policy for all elements to "/Channel/Orderer/Admins".
func NewOrdererGroup ¶
NewOrdererGroup returns the orderer component of the channel configuration. It defines parameters of the ordering service about how large blocks should be, how frequently they should be emitted, etc. as well as the organizations of the ordering network. It sets the mod_policy of all elements to "Admins". This group is always present in any channel configuration.
func NewOrdererOrgGroup ¶
func NewOrdererOrgGroup(conf *Organization, channelCapabilities map[string]bool) (*cb.ConfigGroup, error)
NewOrdererOrgGroup returns an orderer org component of the channel configuration. It defines the crypto material for the organization (its MSP). It sets the mod_policy of all elements to "Admins". channelCapabilities map[string]bool
Types ¶
type AnchorPeer ¶
AnchorPeer encodes the necessary fields to identify an anchor peer.
type Application ¶
type Application struct {
Organizations []*Organization `yaml:"Organizations"`
Capabilities map[string]bool `yaml:"Capabilities"`
Policies map[string]*Policy `yaml:"Policies"`
ACLs map[string]string `yaml:"ACLs"`
}
Application encodes the application-level configuration needed in config transactions.
type BatchSize ¶
type BatchSize struct {
MaxMessageCount uint32 `yaml:"MaxMessageCount"`
AbsoluteMaxBytes uint32 `yaml:"AbsoluteMaxBytes"`
PreferredMaxBytes uint32 `yaml:"PreferredMaxBytes"`
}
BatchSize contains configuration affecting the size of batches.
type Bootstrapper ¶
type Bootstrapper struct {
// contains filtered or unexported fields
}
Bootstrapper is a wrapper around NewChannelConfigGroup which can produce genesis blocks
func New ¶
func New(config *Profile) *Bootstrapper
New creates a new Bootstrapper for generating genesis blocks
func NewBootstrapper ¶
func NewBootstrapper(config *Profile) (*Bootstrapper, error)
NewBootstrapper creates a bootstrapper but returns an error instead of panic-ing
func (*Bootstrapper) GenesisBlock ¶
func (bs *Bootstrapper) GenesisBlock() *cb.Block
GenesisBlock produces a genesis block for the default test channel id
func (*Bootstrapper) GenesisBlockForChannel ¶
func (bs *Bootstrapper) GenesisBlockForChannel(channelID string) *cb.Block
GenesisBlockForChannel produces a genesis block for a given channel ID
func (*Bootstrapper) GenesisChannelGroup ¶
func (bs *Bootstrapper) GenesisChannelGroup() *cb.ConfigGroup
type ConsensusMetadata ¶
type ConsensusMetadata struct {
Path string `yaml:"Path"`
}
type Consortium ¶
type Consortium struct {
Organizations []*Organization `yaml:"Organizations"`
}
Consortium represents a group of organizations which may create channels with each other
type Orderer ¶
type Orderer struct {
OrdererType string `yaml:"OrdererType"`
Addresses []string `yaml:"Addresses"`
BatchTimeout time.Duration `yaml:"BatchTimeout"`
BatchSize BatchSize `yaml:"BatchSize"`
ConsenterMapping []*Consenter `yaml:"ConsenterMapping"`
EtcdRaft *etcdraft.ConfigMetadata `yaml:"EtcdRaft"`
SmartBFT *smartbft.Options `yaml:"SmartBFT"`
Arma *ConsensusMetadata `yaml:"Arma"`
Organizations []*Organization `yaml:"Organizations"`
MaxChannels uint64 `yaml:"MaxChannels"`
Capabilities map[string]bool `yaml:"Capabilities"`
Policies map[string]*Policy `yaml:"Policies"`
}
Orderer contains configuration associated to a channel.
type Organization ¶
type Organization struct {
Name string `yaml:"Name"`
ID string `yaml:"ID"`
MSPDir string `yaml:"MSPDir"`
MSPType string `yaml:"MSPType"`
Policies map[string]*Policy `yaml:"Policies"`
// Note: Viper deserialization does not seem to care for
// embedding of types, so we use one organization struct
// for both orderers and applications.
AnchorPeers []*AnchorPeer `yaml:"AnchorPeers"`
OrdererEndpoints []*types.OrdererEndpoint `yaml:"OrdererEndpoints"`
// AdminPrincipal is deprecated and may be removed in a future release
// it was used for modifying the default policy generation, but policies
// may now be specified explicitly so it is redundant and unnecessary
AdminPrincipal string `yaml:"AdminPrincipal"`
// SkipAsForeign indicates that this org definition is actually unknown to this
// instance of the tool, so, parsing of this org's parameters should be ignored.
SkipAsForeign bool
}
Organization encodes the organization-level configuration needed in config transactions.
type Profile ¶
type Profile struct {
Consortium string `yaml:"Consortium"`
Application *Application `yaml:"Application"`
Orderer *Orderer `yaml:"Orderer"`
Consortiums map[string]*Consortium `yaml:"Consortiums"`
Capabilities map[string]bool `yaml:"Capabilities"`
Policies map[string]*Policy `yaml:"Policies"`
}
Profile encodes orderer/application configuration combinations for the configtxgen tool.
func Load ¶
Load returns the orderer/application config combination that corresponds to a given profile. Config paths may optionally be provided and will be used in place of the FABRIC_CFG_PATH env variable.
func (*Profile) CompleteInitialization ¶
CompleteInitialization fills default values and amend relative paths to absolute according to the given directory.
type TopLevel ¶
type TopLevel struct {
Profiles map[string]*Profile `yaml:"Profiles"`
Organizations []*Organization `yaml:"Organizations"`
Channel *Profile `yaml:"Channel"`
Application *Application `yaml:"Application"`
Orderer *Orderer `yaml:"Orderer"`
Capabilities map[string]map[string]bool `yaml:"Capabilities"`
}
TopLevel consists of the structs used by the configtxgen tool.
func LoadTopLevel ¶
LoadTopLevel simply loads the configtx.yaml file into the structs above and completes their initialization. Config paths may optionally be provided and will be used in place of the FABRIC_CFG_PATH env variable.
Note, for environment overrides to work properly within a profile, Load should be used instead.