Documentation ¶
Overview ¶
Package configtx provides utilities to create and modify a channel configuration transaction. Channel transactions contain the configuration data defining members and policies for a system or application channel and can be used to either create or modify existing channels. Both the creation of a new channel or modification of an existing channel outputs an unsigned transaction represented in a protobuf binary format that must be signed by the requisite number of members such that the transaction fulfills the channel's modification policy.
See https://hyperledger-fabric.readthedocs.io/en/master/configtx.html#anatomy-of-a-configuration for an in-depth description of channel configuration's anatomy.
Index ¶
- Constants
- func NewCreateChannelTx(channelConfig Channel, channelID string) (*cb.ConfigUpdate, error)
- func NewEnvelope(c *cb.ConfigUpdate, signatures ...*cb.ConfigSignature) (*cb.Envelope, error)
- func NewEnvelope1(marshaledUpdate []byte, signatures ...*cb.ConfigSignature) (*cb.Envelope, error)
- func NewMarshaledCreateChannelTx(channelConfig Channel, channelID string) ([]byte, error)
- func NewSystemChannelGenesisBlock(channelConfig Channel, channelID string) (*cb.Block, error)
- type Address
- type Application
- type ApplicationGroup
- func (a *ApplicationGroup) ACLs() (map[string]string, error)
- func (a *ApplicationGroup) AddCapability(capability string) error
- func (a *ApplicationGroup) Capabilities() ([]string, error)
- func (a *ApplicationGroup) Configuration() (Application, error)
- func (a *ApplicationGroup) Organization(name string) *ApplicationOrg
- func (a *ApplicationGroup) Policies() (map[string]Policy, error)
- func (a *ApplicationGroup) RemoveACLs(acls []string) error
- func (a *ApplicationGroup) RemoveCapability(capability string) error
- func (a *ApplicationGroup) RemoveOrganization(orgName string)
- func (a *ApplicationGroup) RemovePolicy(policyName string) error
- func (a *ApplicationGroup) SetACLs(acls map[string]string) error
- func (a *ApplicationGroup) SetOrganization(org Organization) error
- func (a *ApplicationGroup) SetPolicy(modPolicy, policyName string, policy Policy) error
- type ApplicationOrg
- func (a *ApplicationOrg) AddAnchorPeer(newAnchorPeer Address) error
- func (a *ApplicationOrg) AnchorPeers() ([]Address, error)
- func (a *ApplicationOrg) Configuration() (Organization, error)
- func (a *ApplicationOrg) CreateMSPCRL(signingIdentity *SigningIdentity, certs ...*x509.Certificate) (*pkix.CertificateList, error)
- func (a *ApplicationOrg) MSP() (MSP, error)
- func (a *ApplicationOrg) Policies() (map[string]Policy, error)
- func (a *ApplicationOrg) RemoveAnchorPeer(anchorPeerToRemove Address) error
- func (a *ApplicationOrg) RemovePolicy(policyName string) error
- func (a *ApplicationOrg) SetMSP(updatedMSP MSP) error
- func (a *ApplicationOrg) SetPolicy(modPolicy, policyName string, policy Policy) error
- type Channel
- type ChannelGroup
- func (c *ChannelGroup) AddCapability(capability string) error
- func (c *ChannelGroup) Capabilities() ([]string, error)
- func (c *ChannelGroup) Configuration() (Channel, error)
- func (c *ChannelGroup) Policies() (map[string]Policy, error)
- func (c *ChannelGroup) RemoveCapability(capability string) error
- func (c *ChannelGroup) RemovePolicy(policyName string) error
- func (c *ChannelGroup) SetPolicy(modPolicy, policyName string, policy Policy) error
- type ConfigTx
- func (c *ConfigTx) Application() *ApplicationGroup
- func (c *ConfigTx) Channel() *ChannelGroup
- func (c *ConfigTx) ComputeMarshaledUpdate(channelID string) ([]byte, error)
- func (c *ConfigTx) ComputeUpdate(channelID string) (*cb.ConfigUpdate, error)
- func (c *ConfigTx) Consortium(name string) *ConsortiumGroup
- func (c *ConfigTx) Consortiums() *ConsortiumsGroup
- func (c *ConfigTx) Orderer() *OrdererGroup
- func (c *ConfigTx) OriginalConfig() *cb.Config
- func (c *ConfigTx) UpdatedConfig() *cb.Config
- type Consortium
- type ConsortiumGroup
- func (c *ConsortiumGroup) Configuration() (Consortium, error)
- func (c *ConsortiumGroup) Organization(name string) *ConsortiumOrg
- func (c *ConsortiumGroup) RemoveOrganization(name string)
- func (c *ConsortiumGroup) SetChannelCreationPolicy(policy Policy) error
- func (c *ConsortiumGroup) SetOrganization(org Organization) error
- type ConsortiumOrg
- func (c *ConsortiumOrg) Configuration() (Organization, error)
- func (c *ConsortiumOrg) CreateMSPCRL(signingIdentity *SigningIdentity, certs ...*x509.Certificate) (*pkix.CertificateList, error)
- func (c *ConsortiumOrg) MSP() (MSP, error)
- func (c *ConsortiumOrg) Policies() (map[string]Policy, error)
- func (c *ConsortiumOrg) RemovePolicy(name string)
- func (c *ConsortiumOrg) SetMSP(updatedMSP MSP) error
- func (c *ConsortiumOrg) SetPolicy(name string, policy Policy) error
- type ConsortiumsGroup
- type MSP
- type Orderer
- type OrdererGroup
- func (o *OrdererGroup) AddCapability(capability string) error
- func (o *OrdererGroup) AddConsenter(consenter orderer.Consenter) error
- func (o *OrdererGroup) Capabilities() ([]string, error)
- func (o *OrdererGroup) Configuration() (Orderer, error)
- func (o *OrdererGroup) Organization(name string) *OrdererOrg
- func (o *OrdererGroup) Policies() (map[string]Policy, error)
- func (o *OrdererGroup) RemoveCapability(capability string) error
- func (o *OrdererGroup) RemoveConsenter(consenter orderer.Consenter) error
- func (o *OrdererGroup) RemoveOrganization(name string)
- func (o *OrdererGroup) RemovePolicy(policyName string) error
- func (o *OrdererGroup) SetConfiguration(ord Orderer) error
- func (o *OrdererGroup) SetOrganization(org Organization) error
- func (o *OrdererGroup) SetPolicy(modPolicy, policyName string, policy Policy) error
- type OrdererOrg
- func (o *OrdererOrg) Configuration() (Organization, error)
- func (o *OrdererOrg) CreateMSPCRL(signingIdentity *SigningIdentity, certs ...*x509.Certificate) (*pkix.CertificateList, error)
- func (o *OrdererOrg) MSP() (MSP, error)
- func (o *OrdererOrg) Policies() (map[string]Policy, error)
- func (o *OrdererOrg) RemoveEndpoint(endpoint Address) error
- func (o *OrdererOrg) RemovePolicy(policyName string) error
- func (o *OrdererOrg) SetEndpoint(endpoint Address) error
- func (o *OrdererOrg) SetMSP(updatedMSP MSP) error
- func (o *OrdererOrg) SetPolicy(modPolicy, policyName string, policy Policy) error
- type Organization
- type Policy
- type SigningIdentity
- func (s *SigningIdentity) CreateConfigSignature(configUpdate *cb.ConfigUpdate) (*cb.ConfigSignature, error)
- func (s *SigningIdentity) CreateConfigSignature1(marshaledUpdate []byte) (*cb.ConfigSignature, error)
- func (s *SigningIdentity) Public() crypto.PublicKey
- func (s *SigningIdentity) Sign(reader io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)
- func (s *SigningIdentity) SignEnvelope(e *cb.Envelope) error
Constants ¶
const ( // ConsortiumKey is the key for the ConfigValue of a // Consortium. ConsortiumKey = "Consortium" // HashingAlgorithmKey is the key for the ConfigValue of a // HashingAlgorithm. HashingAlgorithmKey = "HashingAlgorithm" // BlockDataHashingStructureKey is the key for the ConfigValue // of a BlockDataHashingStructure. BlockDataHashingStructureKey = "BlockDataHashingStructure" // OrdererAddressesKey is the key for the ConfigValue, OrdererAddresses. OrdererAddressesKey = "OrdererAddresses" // CapabilitiesKey is the key for the ConfigValue, capabilities. // CapabiltiesKey can be used at the channel, application, and orderer levels. CapabilitiesKey = "Capabilities" // EndpointsKey is the key for the ConfigValue, Endpoints in // a OrdererOrgGroup. EndpointsKey = "Endpoints" // MSPKey is the key for the ConfigValue, MSP. MSPKey = "MSP" // AdminsPolicyKey is the key used for the admin policy. AdminsPolicyKey = "Admins" // ReadersPolicyKey is the key used for the read policy. ReadersPolicyKey = "Readers" // WritersPolicyKey is the key used for the write policy. WritersPolicyKey = "Writers" // EndorsementPolicyKey is the key used for the endorsement policy. EndorsementPolicyKey = "Endorsement" // LifecycleEndorsementPolicyKey is the key used for the lifecycle endorsement // policy. LifecycleEndorsementPolicyKey = "LifecycleEndorsement" // BlockValidationPolicyKey is the key used for the block validation policy in // the OrdererOrgGroup. BlockValidationPolicyKey = "BlockValidation" // ChannelCreationPolicyKey is the key used in the consortium config to denote // the policy to be used in evaluating whether a channel creation request // is authorized. ChannelCreationPolicyKey = "ChannelCreationPolicy" // ChannelGroupKey is the group name for the channel config. ChannelGroupKey = "Channel" // ConsortiumsGroupKey is the group name for the consortiums config. ConsortiumsGroupKey = "Consortiums" // OrdererGroupKey is the group name for the orderer config. OrdererGroupKey = "Orderer" // ApplicationGroupKey is the group name for the Application config. ApplicationGroupKey = "Application" // ACLsKey is the name of the ACLs config. ACLsKey = "ACLs" // AnchorPeersKey is the key name for the AnchorPeers ConfigValue. AnchorPeersKey = "AnchorPeers" // ImplicitMetaPolicyType is the 'Type' string for implicit meta policies. ImplicitMetaPolicyType = "ImplicitMeta" // SignaturePolicyType is the 'Type' string for signature policies. SignaturePolicyType = "Signature" )
const YEAR = 365 * 24 * time.Hour
YEAR is a time duration for a standard 365 day year.
Variables ¶
This section is empty.
Functions ¶
func NewCreateChannelTx ¶
func NewCreateChannelTx(channelConfig Channel, channelID string) (*cb.ConfigUpdate, error)
NewCreateChannelTx creates a create channel config update transaction using the provided application channel configuration.
func NewEnvelope ¶
func NewEnvelope(c *cb.ConfigUpdate, signatures ...*cb.ConfigSignature) (*cb.Envelope, error)
NewEnvelope creates an envelope with the provided config update and config signatures.
func NewEnvelope1 ¶
NewEnvelope creates an envelope with the provided marshaled config update and config signatures. TODO NewEnvelope -> NewEnvelope1
func NewMarshaledCreateChannelTx ¶
NewMarshaledCreateChannelTx creates a create channel config update transaction using the provided application channel configuration and returns the marshaled bytes.
Types ¶
type Application ¶
type Application struct { Organizations []Organization Capabilities []string Policies map[string]Policy ACLs map[string]string }
Application is a copy of the orderer configuration with the addition of an anchor peers list in the organization definition.
type ApplicationGroup ¶
type ApplicationGroup struct {
// contains filtered or unexported fields
}
ApplicationGroup encapsulates the part of the config that controls application channels.
func (*ApplicationGroup) ACLs ¶
func (a *ApplicationGroup) ACLs() (map[string]string, error)
ACLs returns a map of ACLS for given config application.
func (*ApplicationGroup) AddCapability ¶
func (a *ApplicationGroup) AddCapability(capability string) error
AddCapability sets capability to the provided channel config. If the provided capability already exist in current configuration, this action will be a no-op.
func (*ApplicationGroup) Capabilities ¶
func (a *ApplicationGroup) Capabilities() ([]string, error)
Capabilities returns a map of enabled application capabilities from the updated config.
func (*ApplicationGroup) Configuration ¶
func (a *ApplicationGroup) Configuration() (Application, error)
Configuration returns the existing application configuration values from a config transaction as an Application type. This can be used to retrieve existing values for the application prior to updating the application configuration.
func (*ApplicationGroup) Organization ¶
func (a *ApplicationGroup) Organization(name string) *ApplicationOrg
Organization returns the application org from the updated config.
func (*ApplicationGroup) Policies ¶
func (a *ApplicationGroup) Policies() (map[string]Policy, error)
Policies returns a map of policies for the application config group in the updatedconfig.
func (*ApplicationGroup) RemoveACLs ¶
func (a *ApplicationGroup) RemoveACLs(acls []string) error
RemoveACLs a list of ACLs from given channel config application. Specifying acls that do not exist in the application ConfigGroup of the channel config will not return a error. Removal will panic if application group does not exist.
func (*ApplicationGroup) RemoveCapability ¶
func (a *ApplicationGroup) RemoveCapability(capability string) error
RemoveCapability removes capability to the provided channel config.
func (*ApplicationGroup) RemoveOrganization ¶
func (a *ApplicationGroup) RemoveOrganization(orgName string)
RemoveOrganization removes an org from the Application group. Removal will panic if the application group does not exist.
func (*ApplicationGroup) RemovePolicy ¶
func (a *ApplicationGroup) RemovePolicy(policyName string) error
RemovePolicy removes an existing policy from an application's configuration. Removal will panic if the application group does not exist.
func (*ApplicationGroup) SetACLs ¶
func (a *ApplicationGroup) SetACLs(acls map[string]string) error
SetACLs sets ACLS to an existing channel config application. If an ACL already exist in current configuration, it will be replaced with new ACL.
func (*ApplicationGroup) SetOrganization ¶
func (a *ApplicationGroup) SetOrganization(org Organization) error
SetOrganization sets the organization config group for the given application org key in an existing Application configuration's Groups map. If the application org already exists in the current configuration, its value will be overwritten.
type ApplicationOrg ¶
type ApplicationOrg struct {
// contains filtered or unexported fields
}
ApplicationOrg encapsulates the parts of the config that control an application organization's configuration.
func (*ApplicationOrg) AddAnchorPeer ¶
func (a *ApplicationOrg) AddAnchorPeer(newAnchorPeer Address) error
AddAnchorPeer adds an anchor peer to an application org's configuration in the updated config.
func (*ApplicationOrg) AnchorPeers ¶
func (a *ApplicationOrg) AnchorPeers() ([]Address, error)
AnchorPeers returns the list of anchor peers for an application org in the updated config.
func (*ApplicationOrg) Configuration ¶
func (a *ApplicationOrg) Configuration() (Organization, error)
Configuration returns the existing application org configuration values from the updated config.
func (*ApplicationOrg) CreateMSPCRL ¶
func (a *ApplicationOrg) CreateMSPCRL(signingIdentity *SigningIdentity, certs ...*x509.Certificate) (*pkix.CertificateList, error)
CreateMSPCRL creates a CRL that revokes the provided certificates for the specified application org signed by the provided SigningIdentity.
func (*ApplicationOrg) MSP ¶
func (a *ApplicationOrg) MSP() (MSP, error)
MSP returns the MSP configuration for an existing application org in the updated config of a config transaction.
func (*ApplicationOrg) Policies ¶
func (a *ApplicationOrg) Policies() (map[string]Policy, error)
Policies returns the map of policies for a specific application org in the updated config..
func (*ApplicationOrg) RemoveAnchorPeer ¶
func (a *ApplicationOrg) RemoveAnchorPeer(anchorPeerToRemove Address) error
RemoveAnchorPeer removes an anchor peer from an application org's configuration in the updated config.
func (*ApplicationOrg) RemovePolicy ¶
func (a *ApplicationOrg) RemovePolicy(policyName string) error
RemovePolicy removes an existing policy from an application organization.
func (*ApplicationOrg) SetMSP ¶
func (a *ApplicationOrg) SetMSP(updatedMSP MSP) error
SetMSP updates the MSP config for the specified application org group.
func (*ApplicationOrg) SetPolicy ¶
func (a *ApplicationOrg) SetPolicy(modPolicy, policyName string, policy Policy) error
SetPolicy sets the specified policy in the application org group's config policy map. If an Organization policy already exist in current configuration, its value will be overwritten.
type Channel ¶
type Channel struct { Consortium string Application Application Orderer Orderer Consortiums []Consortium Capabilities []string Policies map[string]Policy }
Channel is a channel configuration.
type ChannelGroup ¶
type ChannelGroup struct {
// contains filtered or unexported fields
}
ChannelGroup encapsulates the parts of the config that control channels. This type implements retrieval of the various channel config values.
func (*ChannelGroup) AddCapability ¶
func (c *ChannelGroup) AddCapability(capability string) error
AddCapability adds capability to the provided channel config. If the provided capability already exist in current configuration, this action will be a no-op.
func (*ChannelGroup) Capabilities ¶
func (c *ChannelGroup) Capabilities() ([]string, error)
Capabilities returns a map of enabled channel capabilities from a config transaction's updated config.
func (*ChannelGroup) Configuration ¶
func (c *ChannelGroup) Configuration() (Channel, error)
Configuration returns a channel configuration value from a config transaction.
func (*ChannelGroup) Policies ¶
func (c *ChannelGroup) Policies() (map[string]Policy, error)
Policies returns a map of policies for channel configuration.
func (*ChannelGroup) RemoveCapability ¶
func (c *ChannelGroup) RemoveCapability(capability string) error
RemoveCapability removes capability to the provided channel config.
func (*ChannelGroup) RemovePolicy ¶
func (c *ChannelGroup) RemovePolicy(policyName string) error
RemovePolicy removes an existing channel level policy.
type ConfigTx ¶
type ConfigTx struct {
// contains filtered or unexported fields
}
ConfigTx wraps a config transaction.
func New ¶
New creates a new ConfigTx from a Config protobuf. New will panic if given an empty config.
func (*ConfigTx) Application ¶
func (c *ConfigTx) Application() *ApplicationGroup
Application returns the application group the updated config.
func (*ConfigTx) Channel ¶
func (c *ConfigTx) Channel() *ChannelGroup
Channel returns the channel group from the updated config.
func (*ConfigTx) ComputeMarshaledUpdate ¶
ComputeMarshaledUpdate computes the ConfigUpdate from a base and modified config transaction and returns the marshaled bytes.
func (*ConfigTx) ComputeUpdate ¶
func (c *ConfigTx) ComputeUpdate(channelID string) (*cb.ConfigUpdate, error)
ComputeUpdate computes the ConfigUpdate from a base and modified config transaction.
func (*ConfigTx) Consortium ¶
func (c *ConfigTx) Consortium(name string) *ConsortiumGroup
Consortium returns a consortium group from the updated config.
func (*ConfigTx) Consortiums ¶
func (c *ConfigTx) Consortiums() *ConsortiumsGroup
Consortiums returns the consortiums group from the updated config.
func (*ConfigTx) Orderer ¶
func (c *ConfigTx) Orderer() *OrdererGroup
Orderer returns the orderer group from the updated config.
func (*ConfigTx) OriginalConfig ¶
OriginalConfig returns the original unedited config.
func (*ConfigTx) UpdatedConfig ¶
UpdatedConfig returns the modified config.
type Consortium ¶
type Consortium struct { Name string Organizations []Organization }
Consortium is a group of non-orderer organizations used in channel transactions.
type ConsortiumGroup ¶
type ConsortiumGroup struct {
// contains filtered or unexported fields
}
ConsortiumGroup encapsulates the parts of the config that control a specific consortium. This type implements retrieval of the various consortium config values.
func (*ConsortiumGroup) Configuration ¶
func (c *ConsortiumGroup) Configuration() (Consortium, error)
Configuration returns the configuration for a consortium group.
func (*ConsortiumGroup) Organization ¶
func (c *ConsortiumGroup) Organization(name string) *ConsortiumOrg
Organization returns the consortium org from the original config.
func (*ConsortiumGroup) RemoveOrganization ¶
func (c *ConsortiumGroup) RemoveOrganization(name string)
RemoveOrganization removes an org from a consortium group. Removal will panic if either the consortiums group or consortium group does not exist.
func (*ConsortiumGroup) SetChannelCreationPolicy ¶
func (c *ConsortiumGroup) SetChannelCreationPolicy(policy Policy) error
SetChannelCreationPolicy sets the ConsortiumChannelCreationPolicy for the given configuration Group. If the policy already exist in current configuration, its value will be overwritten.
func (*ConsortiumGroup) SetOrganization ¶
func (c *ConsortiumGroup) SetOrganization(org Organization) error
SetOrganization sets the organization config group for the given org key in an existing Consortium configuration's Groups map. If the consortium org already exists in the current configuration, its value will be overwritten.
type ConsortiumOrg ¶
type ConsortiumOrg struct {
// contains filtered or unexported fields
}
ConsortiumOrg encapsulates the parts of the config that control a consortium organization's configuration.
func (*ConsortiumOrg) Configuration ¶
func (c *ConsortiumOrg) Configuration() (Organization, error)
Configuration retrieves an existing org's configuration from a consortium organization config group in the updated config.
func (*ConsortiumOrg) CreateMSPCRL ¶
func (c *ConsortiumOrg) CreateMSPCRL(signingIdentity *SigningIdentity, certs ...*x509.Certificate) (*pkix.CertificateList, error)
CreateMSPCRL creates a CRL that revokes the provided certificates for the specified consortium org signed by the provided SigningIdentity.
func (*ConsortiumOrg) MSP ¶
func (c *ConsortiumOrg) MSP() (MSP, error)
MSP returns the MSP configuration for an existing consortium org in a config transaction.
func (*ConsortiumOrg) Policies ¶
func (c *ConsortiumOrg) Policies() (map[string]Policy, error)
Policies returns a map of policies for a specific consortium org.
func (*ConsortiumOrg) RemovePolicy ¶
func (c *ConsortiumOrg) RemovePolicy(name string)
RemovePolicy removes an existing policy from a consortium's organization. Removal will panic if either the consortiums group, consortium group, or consortium org group does not exist.
func (*ConsortiumOrg) SetMSP ¶
func (c *ConsortiumOrg) SetMSP(updatedMSP MSP) error
SetMSP updates the MSP config for the specified consortium org group.
type ConsortiumsGroup ¶
type ConsortiumsGroup struct {
// contains filtered or unexported fields
}
ConsortiumsGroup encapsulates the parts of the config that control consortiums.
func (*ConsortiumsGroup) Configuration ¶
func (c *ConsortiumsGroup) Configuration() ([]Consortium, error)
Configuration returns a list of consortium configurations from the updated config. Consortiums are only defined for the ordering system channel.
func (*ConsortiumsGroup) RemoveConsortium ¶
func (c *ConsortiumsGroup) RemoveConsortium(name string)
RemoveConsortium removes a consortium from a channel configuration. Removal will panic if the consortiums group does not exist.
func (*ConsortiumsGroup) SetConsortium ¶
func (c *ConsortiumsGroup) SetConsortium(consortium Consortium) error
SetConsortium sets the consortium in a channel configuration. If the consortium already exists in the current configuration, its value will be overwritten.
type MSP ¶
type MSP struct { // Name holds the identifier of the MSP; MSP identifier // is chosen by the application that governs this MSP. // For example, and assuming the default implementation of MSP, // that is X.509-based and considers a single Issuer, // this can refer to the Subject OU field or the Issuer OU field. Name string // List of root certificates trusted by this MSP // they are used upon certificate validation (see // comment for IntermediateCerts below). RootCerts []*x509.Certificate // List of intermediate certificates trusted by this MSP; // they are used upon certificate validation as follows: // validation attempts to build a path from the certificate // to be validated (which is at one end of the path) and // one of the certs in the RootCerts field (which is at // the other end of the path). If the path is longer than // 2, certificates in the middle are searched within the // IntermediateCerts pool. IntermediateCerts []*x509.Certificate // Identity denoting the administrator of this MSP. Admins []*x509.Certificate // Identity revocation list. RevocationList []*pkix.CertificateList // OrganizationalUnitIdentifiers holds one or more // fabric organizational unit identifiers that belong to // this MSP configuration. OrganizationalUnitIdentifiers []membership.OUIdentifier // CryptoConfig contains the configuration parameters // for the cryptographic algorithms used by this MSP. CryptoConfig membership.CryptoConfig // List of TLS root certificates trusted by this MSP. // They are returned by GetTLSRootCerts. TLSRootCerts []*x509.Certificate // List of TLS intermediate certificates trusted by this MSP; // They are returned by GetTLSIntermediateCerts. TLSIntermediateCerts []*x509.Certificate // Contains the configuration to distinguish clients // from peers from orderers based on the OUs. NodeOUs membership.NodeOUs }
MSP is the configuration information for a Fabric MSP. Here we assume a default certificate validation policy, where any certificate signed by any of the listed rootCA certs would be considered as valid under this MSP. This MSP may or may not come with a signing identity. If it does, it can also issue signing identities. If it does not, it can only be used to validate and verify certificates.
type Orderer ¶
type Orderer struct { // OrdererType is the type of orderer // Options: `Solo`, `Kafka` or `Raft` OrdererType string // Addresses is the list of orderer addresses. Addresses []Address // BatchTimeout is the wait time between transactions. BatchTimeout time.Duration BatchSize orderer.BatchSize Kafka orderer.Kafka EtcdRaft orderer.EtcdRaft Organizations []Organization // MaxChannels is the maximum count of channels an orderer supports. MaxChannels uint64 // Capabilities is a map of the capabilities the orderer supports. Capabilities []string Policies map[string]Policy // Options: `ConsensusStateNormal` and `ConsensusStateMaintenance` State orderer.ConsensusState }
Orderer configures the ordering service behavior for a channel.
type OrdererGroup ¶
type OrdererGroup struct {
// contains filtered or unexported fields
}
OrdererGroup encapsulates the parts of the config that control the orderering service behavior.
func (*OrdererGroup) AddCapability ¶
func (o *OrdererGroup) AddCapability(capability string) error
AddCapability adds capability to the provided channel config. If the provided capability already exist in current configuration, this action will be a no-op.
func (*OrdererGroup) AddConsenter ¶
func (o *OrdererGroup) AddConsenter(consenter orderer.Consenter) error
AddConsenter adds a consenter to an etcdraft configuration.
func (*OrdererGroup) Capabilities ¶
func (o *OrdererGroup) Capabilities() ([]string, error)
Capabilities returns a map of enabled orderer capabilities from the updated config.
func (*OrdererGroup) Configuration ¶
func (o *OrdererGroup) Configuration() (Orderer, error)
Configuration returns the existing orderer configuration values from the updated config in a config transaction as an Orderer type. This can be used to retrieve existing values for the orderer prior to updating the orderer configuration.
func (*OrdererGroup) Organization ¶
func (o *OrdererGroup) Organization(name string) *OrdererOrg
Organization returns the orderer org from the updated config.
func (*OrdererGroup) Policies ¶
func (o *OrdererGroup) Policies() (map[string]Policy, error)
Policies returns a map of policies for channel orderer in the updated config.
func (*OrdererGroup) RemoveCapability ¶
func (o *OrdererGroup) RemoveCapability(capability string) error
RemoveCapability removes capability to the provided channel config.
func (*OrdererGroup) RemoveConsenter ¶
func (o *OrdererGroup) RemoveConsenter(consenter orderer.Consenter) error
RemoveConsenter removes a consenter from an etcdraft configuration.
func (*OrdererGroup) RemoveOrganization ¶
func (o *OrdererGroup) RemoveOrganization(name string)
RemoveOrganization removes an org from the Orderer group. Removal will panic if the orderer group does not exist.
func (*OrdererGroup) RemovePolicy ¶
func (o *OrdererGroup) RemovePolicy(policyName string) error
RemovePolicy removes an existing orderer policy configuration.
func (*OrdererGroup) SetConfiguration ¶
func (o *OrdererGroup) SetConfiguration(ord Orderer) error
SetConfiguration modifies an updated config's Orderer configuration via the passed in Orderer values. It skips updating OrdererOrgGroups and Policies.
func (*OrdererGroup) SetOrganization ¶
func (o *OrdererGroup) SetOrganization(org Organization) error
SetOrganization sets the organization config group for the given orderer org key in an existing Orderer configuration's Groups map. If the orderer org already exists in the current configuration, its value will be overwritten.
type OrdererOrg ¶
type OrdererOrg struct {
// contains filtered or unexported fields
}
OrdererOrg encapsulates the parts of the config that control an orderer organization's configuration.
func (*OrdererOrg) Configuration ¶
func (o *OrdererOrg) Configuration() (Organization, error)
Configuration retrieves an existing org's configuration from an orderer organization config group in the updated config.
func (*OrdererOrg) CreateMSPCRL ¶
func (o *OrdererOrg) CreateMSPCRL(signingIdentity *SigningIdentity, certs ...*x509.Certificate) (*pkix.CertificateList, error)
CreateMSPCRL creates a CRL that revokes the provided certificates for the specified orderer org signed by the provided SigningIdentity.
func (*OrdererOrg) MSP ¶
func (o *OrdererOrg) MSP() (MSP, error)
MSP returns the MSP value for an orderer organization in the updated config.
func (*OrdererOrg) Policies ¶
func (o *OrdererOrg) Policies() (map[string]Policy, error)
Policies returns a map of policies for a specific orderer org in the updated config.
func (*OrdererOrg) RemoveEndpoint ¶
func (o *OrdererOrg) RemoveEndpoint(endpoint Address) error
RemoveEndpoint removes an orderer's endpoint from an existing channel config transaction. Removal will panic if either the orderer group or orderer org group does not exist.
func (*OrdererOrg) RemovePolicy ¶
func (o *OrdererOrg) RemovePolicy(policyName string) error
RemovePolicy removes an existing policy from an orderer organization.
func (*OrdererOrg) SetEndpoint ¶
func (o *OrdererOrg) SetEndpoint(endpoint Address) error
SetEndpoint adds an orderer's endpoint to an existing channel config transaction. If the same endpoint already exist in current configuration, this will be a no-op.
func (*OrdererOrg) SetMSP ¶
func (o *OrdererOrg) SetMSP(updatedMSP MSP) error
SetMSP updates the MSP config for the specified orderer org in the updated config.
type Organization ¶
type Organization struct { Name string Policies map[string]Policy MSP MSP // AnchorPeers contains the endpoints of anchor peers for each // application organization. AnchorPeers []Address OrdererEndpoints []string }
Organization is an organization in the channel configuration.
type SigningIdentity ¶
type SigningIdentity struct { Certificate *x509.Certificate PrivateKey crypto.PrivateKey MSPID string }
SigningIdentity is an MSP Identity that can be used to sign configuration updates.
func (*SigningIdentity) CreateConfigSignature ¶
func (s *SigningIdentity) CreateConfigSignature(configUpdate *cb.ConfigUpdate) (*cb.ConfigSignature, error)
CreateConfigSignature creates a config signature for the the given configuration update using the specified signing identity.
func (*SigningIdentity) CreateConfigSignature1 ¶
func (s *SigningIdentity) CreateConfigSignature1(marshaledUpdate []byte) (*cb.ConfigSignature, error)
TODO CreateConfigSignature -> CreateConfigSignature1
func (*SigningIdentity) Public ¶
func (s *SigningIdentity) Public() crypto.PublicKey
Public returns the public key associated with this signing identity's certificate.
func (*SigningIdentity) Sign ¶
func (s *SigningIdentity) Sign(reader io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)
Sign performs ECDSA sign with this signing identity's private key on the given digest. It ensures signatures are created with Low S values since Fabric normalizes all signatures to Low S. See https://github.com/bitcoin/bips/blob/master/bip-0146.mediawiki#low_s for more detail.
func (*SigningIdentity) SignEnvelope ¶
func (s *SigningIdentity) SignEnvelope(e *cb.Envelope) error
SignEnvelope signs an envelope using the SigningIdentity.