Documentation ¶
Index ¶
- Constants
- Variables
- func ApproveChaincodeForMyOrg(n *Network, channel string, orderer *Orderer, chaincode Chaincode, ...)
- func CheckCommitReadinessUntilReady(n *Network, channel string, chaincode Chaincode, checkOrgs []*Organization, ...)
- func CheckPackageID(n *Network, packageFile string, packageID string, peer *Peer)
- func CommitChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, peer *Peer, ...)
- func ComputeUpdateOrdererConfig(updateFile string, n *Network, channel string, current, updated *common.Config, ...)
- func CurrentConfigBlockNumber(n *Network, peer *Peer, orderer *Orderer, channel string) uint64
- func CurrentConfigBlockNumberFromPeer(n *Network, peer *Peer, channel, output string) uint64
- func DeployChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, ...)
- func DiscoverPeers(n *Network, p *Peer, user, channelName string) func() []DiscoveredPeer
- func EnableCapabilities(network *Network, channel, capabilitiesGroup, capabilitiesVersion string, ...)
- func EnsureChaincodeApproved(n *Network, peer *Peer, channel, name, sequence string)
- func EnsureChaincodeCommitted(n *Network, channel, name, version, sequence string, checkOrgs []*Organization, ...)
- func EnsureInstalled(n *Network, label, packageID string, peers ...*Peer)
- func FetchConfigBlock(n *Network, peer *Peer, orderer *Orderer, channel string, output string)
- func GetConfig(n *Network, peer *Peer, orderer *Orderer, channel string) *common.Config
- func GetConfigBlock(n *Network, peer *Peer, orderer *Orderer, channel string) *common.Block
- func GetLedgerHeight(n *Network, peer *Peer, channel string) int
- func GetMaxLedgerHeight(n *Network, channel string, peers ...*Peer) int
- func InitChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, ...)
- func InspectChaincodeDiscrepancies(n *Network, channel string, chaincode Chaincode, checkOrgs []*Organization, ...)
- func InstallChaincode(n *Network, chaincode Chaincode, peers ...*Peer)
- func NewCommand(path string, command Command) *exec.Cmd
- func OrdererOperationalClients(n *Network, o *Orderer) (authClient, unauthClient *http.Client)
- func PackageAndInstallChaincode(n *Network, chaincode Chaincode, peers ...*Peer)
- func PackageChaincode(n *Network, chaincode Chaincode, peer *Peer)
- func PackageChaincodeBinary(c Chaincode)
- func PeerOperationalClients(n *Network, p *Peer) (authClient, unauthClient *http.Client)
- func QueryInstalled(n *Network, peer *Peer) func() []lifecycle.QueryInstalledChaincodesResult_InstalledChaincode
- func QueryInstalledReferences(n *Network, channel, label, packageID string, checkPeer *Peer, ...)
- func RestartSingleOrdererNetwork(ordererProcess, peerProcess ifrit.Process, network *Network) (*ginkgomon.Runner, ifrit.Process, ifrit.Process)
- func UnmarshalBlockFromFile(blockFile string) *common.Block
- func UpdateConfig(n *Network, orderer *Orderer, channel string, current, updated *common.Config, ...)
- func UpdateConsensusMetadata(network *Network, peer *Peer, orderer *Orderer, channel string, ...)
- func UpdateConsenters(network *Network, peer *Peer, orderer *Orderer, channel string, ...)
- func UpdateOrdererConfig(n *Network, orderer *Orderer, channel string, current, updated *common.Config, ...)
- func UpdateOrdererConfigSession(n *Network, orderer *Orderer, channel string, current, updated *common.Config, ...) *gexec.Session
- func UpdateOrdererEndpoints(network *Network, peer *Peer, orderer *Orderer, channel string, ...)
- func UpdateOrdererMSP(network *Network, peer *Peer, orderer *Orderer, channel, orgID string, ...)
- func WaitUntilEqualLedgerHeight(n *Network, channel string, height int, peers ...*Peer)
- type Blocks
- type BuildServer
- type CA
- type Chaincode
- type Channel
- type Command
- type Components
- func (c *Components) Build(path string) string
- func (c *Components) Cleanup()
- func (c *Components) ConfigTxGen() string
- func (c *Components) Cryptogen() string
- func (c *Components) Discover() string
- func (c *Components) Idemixgen() string
- func (c *Components) Orderer() string
- func (c *Components) Osnadmin() string
- func (c *Components) Peer() string
- type Config
- func BasicConfig() *Config
- func BasicEtcdRaft() *Config
- func BasicEtcdRaftWithIdemix() *Config
- func BasicSmartBFT() *Config
- func FullEtcdRaft() *Config
- func MinimalRaft() *Config
- func MultiChannelEtcdRaft() *Config
- func MultiNodeBFT() *Config
- func MultiNodeEtcdRaft() *Config
- func MultiNodeSmartBFT() *Config
- func ThreeOrgEtcdRaft() *Config
- type Consensus
- type ConsensusMetadataMutator
- type DiscoveredPeer
- type Enver
- type MSPMutator
- type Network
- func (n *Network) AddOrg(o *Organization, peers ...*Peer)
- func (n *Network) AnchorsForChannel(chanName string) []*Peer
- func (n *Network) AnchorsInOrg(orgName string) []*Peer
- func (n *Network) Bootstrap()
- func (n *Network) CACertsBundlePath() string
- func (n *Network) Cleanup()
- func (n *Network) ConcatenateTLSCACertificates()
- func (n *Network) ConfigTxConfigPath() string
- func (n *Network) ConfigTxGen(command Command) (*gexec.Session, error)
- func (n *Network) CreateAndJoinChannel(o *Orderer, channelName string)
- func (n *Network) CreateAndJoinChannels(o *Orderer)
- func (n *Network) CreateChannel(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{})
- func (n *Network) CreateChannelExitCode(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{}) int
- func (n *Network) CreateChannelTxPath(channelName string) string
- func (n *Network) CreateDockerNetwork()
- func (n *Network) CryptoConfigPath() string
- func (n *Network) CryptoPath() string
- func (n *Network) Cryptogen(command Command) (*gexec.Session, error)
- func (n *Network) Discover(command Command) (*gexec.Session, error)
- func (n *Network) DiscoveredPeer(p *Peer, chaincodes ...string) DiscoveredPeer
- func (n *Network) GenerateConfigTree()
- func (n *Network) GenerateConfigTxConfig()
- func (n *Network) GenerateCoreConfig(p *Peer)
- func (n *Network) GenerateCryptoConfig()
- func (n *Network) GenerateOrdererConfig(o *Orderer)
- func (n *Network) IdemixOrgMSPDir(org *Organization) string
- func (n *Network) IdemixOrgs() []*Organization
- func (n *Network) IdemixUserMSPDir(o *Organization, user string) string
- func (n *Network) IdemixUserSession(p *Peer, idemixOrg *Organization, user string, command Command) (*gexec.Session, error)
- func (n *Network) Idemixgen(command Command) (*gexec.Session, error)
- func (n *Network) JoinBySnapshotStatus(p *Peer) string
- func (n *Network) JoinChannel(name string, o *Orderer, peers ...*Peer)
- func (n *Network) JoinChannelBySnapshot(snapshotDir string, peers ...*Peer)
- func (n *Network) LoadAppChannelGenesisBlock(channelID string) *common.Block
- func (n *Network) NetworkGroupRunner() ifrit.Runner
- func (n *Network) NewClientConn(address, caCertPath string, clientCertPath string, clientKeyPath string) *grpc.ClientConn
- func (n *Network) Orderer(name string) *Orderer
- func (n *Network) OrdererAddress(o *Orderer, portName PortName) string
- func (n *Network) OrdererAdminSession(o *Orderer, p *Peer, command Command) (*gexec.Session, error)
- func (n *Network) OrdererCACert(o *Orderer) string
- func (n *Network) OrdererCert(o *Orderer) string
- func (n *Network) OrdererClientConn(o *Orderer) *grpc.ClientConn
- func (n *Network) OrdererConfigPath(o *Orderer) string
- func (n *Network) OrdererDir(o *Orderer) string
- func (n *Network) OrdererGroupRunner() ifrit.Runner
- func (n *Network) OrdererLocalCryptoDir(o *Orderer, cryptoType string) string
- func (n *Network) OrdererLocalMSPDir(o *Orderer) string
- func (n *Network) OrdererLocalTLSDir(o *Orderer) string
- func (n *Network) OrdererOrgCADir(o *Organization) string
- func (n *Network) OrdererOrgMSPDir(o *Organization) string
- func (n *Network) OrdererOrgs() []*Organization
- func (n *Network) OrdererPort(o *Orderer, portName PortName) uint16
- func (n *Network) OrdererRunner(o *Orderer, env ...string) *ginkgomon.Runner
- func (n *Network) OrdererSignCert(o *Orderer) string
- func (n *Network) OrdererUserCert(o *Orderer, user string) string
- func (n *Network) OrdererUserKey(o *Orderer, user string) string
- func (n *Network) OrdererUserMSPDir(o *Orderer, user string) string
- func (n *Network) OrdererUserSigner(o *Orderer, user string) *SigningIdentity
- func (n *Network) OrderersInOrg(orgName string) []*Orderer
- func (n *Network) Organization(orgName string) *Organization
- func (n *Network) OrgsForOrderers(ordererNames []string) []*Organization
- func (n *Network) Osnadmin(command Command) (*gexec.Session, error)
- func (n *Network) OutputBlockPath(channelName string) string
- func (n *Network) Peer(orgName, peerName string) *Peer
- func (n *Network) PeerAddress(p *Peer, portName PortName) string
- func (n *Network) PeerAdminSession(p *Peer, command Command) (*gexec.Session, error)
- func (n *Network) PeerCACert(p *Peer) string
- func (n *Network) PeerCert(p *Peer) string
- func (n *Network) PeerClientConn(p *Peer) *grpc.ClientConn
- func (n *Network) PeerConfigPath(p *Peer) string
- func (n *Network) PeerDir(p *Peer) string
- func (n *Network) PeerGroupRunner() ifrit.Runner
- func (n *Network) PeerLedgerDir(p *Peer) string
- func (n *Network) PeerLocalMSPDir(p *Peer) string
- func (n *Network) PeerLocalTLSDir(p *Peer) string
- func (n *Network) PeerOrgCADir(o *Organization) string
- func (n *Network) PeerOrgMSPDir(org *Organization) string
- func (n *Network) PeerOrgs() []*Organization
- func (n *Network) PeerPort(p *Peer, portName PortName) uint16
- func (n *Network) PeerRunner(p *Peer, env ...string) *ginkgomon.Runner
- func (n *Network) PeerUserCert(p *Peer, user string) string
- func (n *Network) PeerUserKey(p *Peer, user string) string
- func (n *Network) PeerUserMSPDir(p *Peer, user string) string
- func (n *Network) PeerUserSession(p *Peer, user string, command Command) (*gexec.Session, error)
- func (n *Network) PeerUserSigner(p *Peer, user string) *SigningIdentity
- func (n *Network) PeerUserTLSDir(p *Peer, user string) string
- func (n *Network) PeersInOrg(orgName string) []*Peer
- func (n *Network) PeersWithChannel(chanName string) []*Peer
- func (n *Network) ProfileForChannel(channelName string) string
- func (n *Network) ReadConfigTxConfig() *fabricconfig.ConfigTx
- func (n *Network) ReadOrdererConfig(o *Orderer) *fabricconfig.Orderer
- func (n *Network) ReadPeerConfig(p *Peer) *fabricconfig.Core
- func (n *Network) ReservePort() uint16
- func (n *Network) StartOrderer(ordererName string) (*ginkgomon.Runner, ifrit.Process)
- func (n *Network) StartSession(cmd *exec.Cmd, name string) (*gexec.Session, error)
- func (n *Network) StartSingleOrdererNetwork(ordererName string) (*ginkgomon.Runner, ifrit.Process, ifrit.Process)
- func (n *Network) UpdateChannelAnchors(o *Orderer, channelName string)
- func (n *Network) UpdateOrgAnchorPeers(o *Orderer, channelName, orgName string, anchorPeersForOrg []*Peer)
- func (n *Network) VerifyMembership(expectedPeers []*Peer, channel string, chaincodes ...string)
- func (n *Network) WriteConfigTxConfig(config *fabricconfig.ConfigTx)
- func (n *Network) WriteOrdererConfig(o *Orderer, config *fabricconfig.Orderer)
- func (n *Network) WritePeerConfig(p *Peer, config *fabricconfig.Core)
- type Orderer
- type Organization
- type Peer
- type PeerChannel
- type PortName
- type Ports
- type Profile
- type SigningIdentity
- type SmartBFT
- type Templates
- type WorkingDirer
Constants ¶
const CCEnvDefaultImage = "hyperledger/fabric-ccenv:latest"
Variables ¶
var RequiredImages = []string{ CCEnvDefaultImage, runner.CouchDBDefaultImage, }
Functions ¶
func CheckCommitReadinessUntilReady ¶
func CheckCommitReadinessUntilReady(n *Network, channel string, chaincode Chaincode, checkOrgs []*Organization, peers ...*Peer)
func CheckPackageID ¶
func CommitChaincode ¶
func CurrentConfigBlockNumber ¶
CurrentConfigBlockNumber retrieves the block number from the header of the current config block. This can be used to detect when configuration change has completed. If an orderer is not provided, the current config block will be fetched from the peer.
func CurrentConfigBlockNumberFromPeer ¶
CurrentConfigBlockNumberFromPeer retrieves the block number from the header of the peer's current config block.
func DeployChaincode ¶
func DeployChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, peers ...*Peer)
DeployChaincode is a helper that will install chaincode to all peers that are connected to the specified channel, approve the chaincode on one of the peers of each organization in the network, commit the chaincode definition on the channel using one of the peers, and wait for the chaincode commit to complete on all of the peers. It uses the _lifecycle implementation. NOTE V2_0 capabilities must be enabled for this functionality to work.
func DiscoverPeers ¶
func DiscoverPeers(n *Network, p *Peer, user, channelName string) func() []DiscoveredPeer
running discovery service command discover peers against peer using channel name and user as specified in the function arguments. return a slice of the discovered peers
func EnableCapabilities ¶
func EnableCapabilities(network *Network, channel, capabilitiesGroup, capabilitiesVersion string, orderer *Orderer, peers ...*Peer)
EnableCapabilities enables a specific capabilities flag for a running network. It generates the config update using the first peer, signs the configuration with the subsequent peers, and then submits the config update using the first peer.
func EnsureChaincodeApproved ¶
func EnsureChaincodeCommitted ¶
func EnsureChaincodeCommitted(n *Network, channel, name, version, sequence string, checkOrgs []*Organization, peers ...*Peer)
EnsureChaincodeCommitted polls each supplied peer until the chaincode definition has been committed to the peer's ledger.
func EnsureInstalled ¶
func FetchConfigBlock ¶
FetchConfigBlock fetches latest config block.
func GetConfigBlock ¶
GetConfigBlock retrieves the current config block for a channel.
func GetLedgerHeight ¶
GetLedgerHeight returns the current ledger height for a peer on a channel
func GetMaxLedgerHeight ¶
GetMaxLedgerHeight returns the maximum ledger height for the peers on a channel
func InitChaincode ¶
func InspectChaincodeDiscrepancies ¶
func InspectChaincodeDiscrepancies(n *Network, channel string, chaincode Chaincode, checkOrgs []*Organization, peers ...*Peer)
InspectChaincodeDiscrepancies inspects the discrepancies in chaincode definitions using the checkcommitreadiness command with inspection enabled. This is to verify that the network can detect differences in chaincode definitions, particularly when comparing with mismatched parameters from the approved definitions by each organizations.
func InstallChaincode ¶
func PackageChaincode ¶
func PackageChaincodeBinary ¶
func PackageChaincodeBinary(c Chaincode)
PackageChaincodeBinary is a helper function to package an already built chaincode and write it to the location specified by Chaincode.PackageFile.
func PeerOperationalClients ¶
func QueryInstalled ¶
func QueryInstalled(n *Network, peer *Peer) func() []lifecycle.QueryInstalledChaincodesResult_InstalledChaincode
func UnmarshalBlockFromFile ¶
UnmarshalBlockFromFile unmarshals a proto encoded block from a file.
func UpdateConfig ¶
func UpdateConfig(n *Network, orderer *Orderer, channel string, current, updated *common.Config, getConfigBlockFromOrderer bool, submitter *Peer, additionalSigners ...*Peer)
UpdateConfig computes, signs, and submits a configuration update and waits for the update to complete.
func UpdateConsensusMetadata ¶
func UpdateConsensusMetadata(network *Network, peer *Peer, orderer *Orderer, channel string, mutateMetadata ConsensusMetadataMutator)
UpdateConsensusMetadata executes a config update that updates the consensus metadata according to the given ConsensusMetadataMutator.
func UpdateConsenters ¶
func UpdateOrdererConfig ¶
func UpdateOrdererConfig(n *Network, orderer *Orderer, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*Orderer)
UpdateOrdererConfig computes, signs, and submits a configuration update which requires orderers signature and waits for the update to complete.
func UpdateOrdererConfigSession ¶
func UpdateOrdererConfigSession(n *Network, orderer *Orderer, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*Orderer) *gexec.Session
UpdateOrdererConfigSession computes, signs, and submits a configuration update which requires orderer signatures. The caller should wait on the returned seession retrieve the exit code.
func UpdateOrdererEndpoints ¶
func UpdateOrdererEndpoints(network *Network, peer *Peer, orderer *Orderer, channel string, endpoints ...string)
UpdateOrdererEndpoints executes a config update that updates the orderer metadata according to the given endpoints
func UpdateOrdererMSP ¶
func UpdateOrdererMSP(network *Network, peer *Peer, orderer *Orderer, channel, orgID string, mutateMSP MSPMutator)
Types ¶
type Blocks ¶
type Blocks struct { BatchTimeout int `yaml:"batch_timeout,omitempty"` MaxMessageCount int `yaml:"max_message_count,omitempty"` AbsoluteMaxBytes int `yaml:"absolute_max_bytes,omitempty"` PreferredMaxBytes int `yaml:"preferred_max_bytes,omitempty"` }
Blocks defines block cutting config.
type BuildServer ¶
type BuildServer struct {
// contains filtered or unexported fields
}
func NewBuildServer ¶
func NewBuildServer(args ...string) *BuildServer
func (*BuildServer) Components ¶
func (s *BuildServer) Components() *Components
func (*BuildServer) Serve ¶
func (s *BuildServer) Serve()
func (*BuildServer) Shutdown ¶
func (s *BuildServer) Shutdown()
type Chaincode ¶
type Chaincode struct { Name string Version string Path string Ctor string Policy string // only used for legacy lifecycle. For new lifecycle use SignaturePolicy Lang string CollectionsConfig string // optional PackageFile string PackageID string // if unspecified, chaincode won't be executable. Can use SetPackageIDFromPackageFile() to set. CodeFiles map[string]string // map from paths on the filesystem to code.tar.gz paths Sequence string EndorsementPlugin string ValidationPlugin string InitRequired bool Label string SignaturePolicy string ChannelConfigPolicy string }
func (*Chaincode) SetPackageIDFromPackageFile ¶
func (c *Chaincode) SetPackageIDFromPackageFile()
type Channel ¶
type Channel struct { Name string `yaml:"name,omitempty"` Profile string `yaml:"profile,omitempty"` BaseProfile string `yaml:"baseprofile,omitempty"` }
Channel associates a channel name with a configtxgen profile name.
type Components ¶
type Components struct {
ServerAddress string `json:"server_address"`
}
func (*Components) Build ¶
func (c *Components) Build(path string) string
func (*Components) Cleanup ¶
func (c *Components) Cleanup()
func (*Components) ConfigTxGen ¶
func (c *Components) ConfigTxGen() string
func (*Components) Cryptogen ¶
func (c *Components) Cryptogen() string
func (*Components) Discover ¶
func (c *Components) Discover() string
func (*Components) Idemixgen ¶
func (c *Components) Idemixgen() string
func (*Components) Orderer ¶
func (c *Components) Orderer() string
func (*Components) Osnadmin ¶
func (c *Components) Osnadmin() string
func (*Components) Peer ¶
func (c *Components) Peer() string
type Config ¶
type Config struct { Organizations []*Organization `yaml:"organizations,omitempty"` Channels []*Channel `yaml:"channels,omitempty"` Consensus *Consensus `yaml:"consensus,omitempty"` Orderers []*Orderer `yaml:"orderers,omitempty"` Peers []*Peer `yaml:"peers,omitempty"` Profiles []*Profile `yaml:"profiles,omitempty"` Templates *Templates `yaml:"templates,omitempty"` }
Config holds the basic information needed to generate fabric configuration files.
func BasicConfig ¶
func BasicConfig() *Config
BasicConfig is a configuration with two organizations and one peer per org. This configuration does not specify a consensus type.
func BasicEtcdRaft ¶
func BasicEtcdRaft() *Config
func BasicEtcdRaftWithIdemix ¶
func BasicEtcdRaftWithIdemix() *Config
func BasicSmartBFT ¶
func BasicSmartBFT() *Config
func FullEtcdRaft ¶
func FullEtcdRaft() *Config
FullEtcdRaft is a configuration with two organizations and two peers per org.
func MinimalRaft ¶
func MinimalRaft() *Config
func MultiChannelEtcdRaft ¶
func MultiChannelEtcdRaft() *Config
func MultiNodeBFT ¶
func MultiNodeBFT() *Config
func MultiNodeEtcdRaft ¶
func MultiNodeEtcdRaft() *Config
func MultiNodeSmartBFT ¶
func MultiNodeSmartBFT() *Config
func ThreeOrgEtcdRaft ¶
func ThreeOrgEtcdRaft() *Config
ThreeOrgEtcdRaft returns a simple configuration with three organizations instead of two.
func (*Config) RemovePeer ¶
type Consensus ¶
type Consensus struct {
Type string `yaml:"type,omitempty"`
}
Consensus indicates the orderer types.
type ConsensusMetadataMutator ¶
ConsensusMetadataMutator receives ConsensusType.Metadata and mutates it.
type DiscoveredPeer ¶
type DiscoveredPeer struct { MSPID string `yaml:"mspid,omitempty"` Endpoint string `yaml:"endpoint,omitempty"` Identity string `yaml:"identity,omitempty"` Chaincodes []string `yaml:"chaincodes,omitempty"` }
DiscoveredPeer defines a struct for discovering peers using discovery service. each peer in the result will have these fields
type MSPMutator ¶
type MSPMutator func(config msp.FabricMSPConfig) msp.FabricMSPConfig
MSPMutator receives FabricMSPConfig and mutates it.
type Network ¶
type Network struct { RootDir string StartPort uint16 Components *Components DockerClient *docker.Client ExternalBuilders []fabricconfig.ExternalBuilder NetworkID string EventuallyTimeout time.Duration SessionCreateInterval time.Duration MetricsProvider string StatsdEndpoint string ClientAuthRequired bool TLSEnabled bool GatewayEnabled bool PortsByOrdererID map[string]Ports PortsByPeerID map[string]Ports Organizations []*Organization Channels []*Channel Consensus *Consensus Orderers []*Orderer Peers []*Peer Profiles []*Profile Templates *Templates // contains filtered or unexported fields }
Network holds information about a fabric network.
func New ¶
func New(c *Config, rootDir string, dockerClient *docker.Client, startPort int, components *Components) *Network
New creates a Network from a simple configuration. All generated or managed artifacts for the network will be located under rootDir. Ports will be allocated sequentially from the specified startPort.
func (*Network) AddOrg ¶
func (n *Network) AddOrg(o *Organization, peers ...*Peer)
AddOrg adds an organization to a network.
func (*Network) AnchorsForChannel ¶
AnchorsForChannel returns all Peer instances that are anchors for the named channel.
func (*Network) AnchorsInOrg ¶
AnchorsInOrg returns all peers that are an anchor for at least one channel in the named organization.
func (*Network) Bootstrap ¶
func (n *Network) Bootstrap()
Bootstrap generates the cryptographic material and create application channels genesis blocks needed to run a fabric network.
The cryptogen tool is used to create crypto material from the contents of ${rootDir}/crypto-config.yaml. The generated artifacts will be placed in ${rootDir}/crypto/...
The genesis block is generated from the profile referenced by the channel's Profile attribute. The block is written to ${rootDir}/${Channel.Name}_block.pb.
The create channel transactions are generated for each Channel referenced by the Network using the channel's Profile attribute. The transactions are written to ${rootDir}/${Channel.Name}_tx.pb.
func (*Network) CACertsBundlePath ¶
CACertsBundlePath returns the path to the bundle of CA certificates for the network. This bundle is used when connecting to peers.
func (*Network) Cleanup ¶
func (n *Network) Cleanup()
Cleanup attempts to cleanup docker related artifacts that may have been created by the network.
func (*Network) ConcatenateTLSCACertificates ¶
func (n *Network) ConcatenateTLSCACertificates()
ConcatenateTLSCACertificates concatenates all TLS CA certificates into a single file to be used by peer CLI.
func (*Network) ConfigTxConfigPath ¶
ConfigTxPath returns the path to the generated configtxgen configuration file.
func (*Network) ConfigTxGen ¶
ConfigTxGen starts a gexec.Session for the provided configtxgen command.
func (*Network) CreateAndJoinChannel ¶
CreateAndJoinChannel will create the specified channel. The referencing peers will then be joined to the channel.
The network must be running before this is called.
func (*Network) CreateAndJoinChannels ¶
CreateAndJoinChannels will create all channels specified in the config that are referenced by peers. The referencing peers will then be joined to the channel(s).
The network must be running before this is called.
func (*Network) CreateChannel ¶
func (n *Network) CreateChannel(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{})
CreateChannel will submit an existing create channel transaction to the specified orderer. The channel transaction must exist at the location returned by CreateChannelTxPath. Optionally, additional signers may be included in the case where the channel creation tx modifies other aspects of the channel config for the new channel.
The orderer must be running when this is called.
func (*Network) CreateChannelExitCode ¶
func (n *Network) CreateChannelExitCode(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{}) int
CreateChannelExitCode will submit an existing create channel transaction to the specified orderer, wait for the operation to complete, and return the exit status of the "peer channel create" command.
The channel transaction must exist at the location returned by CreateChannelTxPath and the orderer must be running when this is called.
func (*Network) CreateChannelTxPath ¶
CreateChannelTxPath returns the path to the create channel transaction for the named channel.
func (*Network) CreateDockerNetwork ¶
func (n *Network) CreateDockerNetwork()
func (*Network) CryptoConfigPath ¶
CryptoConfigPath returns the path to the generated cryptogen configuration file.
func (*Network) CryptoPath ¶
CryptoPath returns the path to the directory where cryptogen will place its generated artifacts.
func (*Network) DiscoveredPeer ¶
func (n *Network) DiscoveredPeer(p *Peer, chaincodes ...string) DiscoveredPeer
DiscoveredPeer creates a new DiscoveredPeer from the peer and chaincodes passed as arguments.
func (*Network) GenerateConfigTree ¶
func (n *Network) GenerateConfigTree()
GenerateConfigTree generates the configuration documents required to bootstrap a fabric network. A configuration file will be generated for cryptogen, configtxgen, and for each peer and orderer. The contents of the documents will be based on the Config used to create the Network.
When this method completes, the resulting tree will look something like this:
${rootDir}/configtx.yaml ${rootDir}/crypto-config.yaml ${rootDir}/orderers/orderer0.orderer-org/orderer.yaml ${rootDir}/peers/peer0.org1/core.yaml ${rootDir}/peers/peer0.org2/core.yaml ${rootDir}/peers/peer1.org1/core.yaml ${rootDir}/peers/peer1.org2/core.yaml
func (*Network) GenerateConfigTxConfig ¶
func (n *Network) GenerateConfigTxConfig()
GenerateConfigTxConfig creates the `configtx.yaml` configuration file provided to `configtxgen` when running Bootstrap. The path to the generated file can be obtained from ConfigTxConfigPath.
func (*Network) GenerateCoreConfig ¶
GenerateCoreConfig creates the `core.yaml` configuration file for the specified peer. The path to the generated file can be obtained from PeerConfigPath.
func (*Network) GenerateCryptoConfig ¶
func (n *Network) GenerateCryptoConfig()
GenerateCryptoConfig creates the `crypto-config.yaml` configuration file provided to `cryptogen` when running Bootstrap. The path to the generated file can be obtained from CryptoConfigPath.
func (*Network) GenerateOrdererConfig ¶
GenerateOrdererConfig creates the `orderer.yaml` configuration file for the specified orderer. The path to the generated file can be obtained from OrdererConfigPath.
func (*Network) IdemixOrgMSPDir ¶
func (n *Network) IdemixOrgMSPDir(org *Organization) string
func (*Network) IdemixOrgs ¶
func (n *Network) IdemixOrgs() []*Organization
IdemixOrgs returns all Organizations of type idemix.
func (*Network) IdemixUserMSPDir ¶
func (n *Network) IdemixUserMSPDir(o *Organization, user string) string
IdemixUserMSPDir returns the path to the MSP directory containing the idemix-related crypto material for the specified user of the organization.
func (*Network) IdemixUserSession ¶
func (n *Network) IdemixUserSession(p *Peer, idemixOrg *Organization, user string, command Command) (*gexec.Session, error)
IdemixUserSession starts a gexec.Session as a idemix user for the provided peer command. This is intended to be used by short running peer cli commands that execute in the context of a peer configuration.
func (*Network) JoinBySnapshotStatus ¶
func (*Network) JoinChannel ¶
JoinChannel will join peers to the specified channel. The orderer is used to obtain the current configuration block for the channel.
The orderer and listed peers must be running before this is called.
func (*Network) JoinChannelBySnapshot ¶
func (*Network) LoadAppChannelGenesisBlock ¶
func (*Network) NetworkGroupRunner ¶
NetworkGroupRunner returns a runner that can be used to start and stop an entire fabric network.
func (*Network) NewClientConn ¶
func (*Network) OrdererAddress ¶
OrdererAddress returns the address (host and port) exposed by the Orderer for the named port. Command line tools should use the returned address when connecting to the orderer.
This assumes that the orderer is listening on 0.0.0.0 or 127.0.0.1 and is available on the loopback address.
func (*Network) OrdererAdminSession ¶
OrdererAdminSession starts a gexec.Session as an orderer admin user. This is used primarily to generate orderer configuration updates.
func (*Network) OrdererCACert ¶
OrdererCACert returns the path to the CA certificate for the orderer organization.
func (*Network) OrdererCert ¶
OrdererCert returns the path to the orderer's certificate.
func (*Network) OrdererClientConn ¶
func (n *Network) OrdererClientConn(o *Orderer) *grpc.ClientConn
OrdererClientConn returns a grpc.ClientConn configured to connect to the provided orderer. This connection can be used to create clients for the orderer services. The client connection should be closed when the tests are done using it.
func (*Network) OrdererConfigPath ¶
OrdererConfigPath returns the path to the orderer configuration document for the specified Orderer.
func (*Network) OrdererDir ¶
OrdererDir returns the path to the configuration directory for the specified Orderer.
func (*Network) OrdererGroupRunner ¶
OrdererGroupRunner returns a runner that can be used to start and stop all orderers in a network.
func (*Network) OrdererLocalCryptoDir ¶
OrdererLocalCryptoDir returns the path to the local crypto directory for the Orderer.
func (*Network) OrdererLocalMSPDir ¶
OrdererLocalMSPDir returns the path to the local MSP directory for the Orderer.
func (*Network) OrdererLocalTLSDir ¶
OrdererLocalTLSDir returns the path to the local TLS directory for the Orderer.
func (*Network) OrdererOrgCADir ¶
func (n *Network) OrdererOrgCADir(o *Organization) string
OrdererOrgCADir returns the path to the folder containing the CA certificate(s) and/or keys for the specified orderer organization.
func (*Network) OrdererOrgMSPDir ¶
func (n *Network) OrdererOrgMSPDir(o *Organization) string
OrdererOrgMSPDir returns the path to the MSP directory of the Orderer organization.
func (*Network) OrdererOrgs ¶
func (n *Network) OrdererOrgs() []*Organization
OrdererOrgs returns all Organization instances that own at least one orderer.
func (*Network) OrdererPort ¶
OrdererPort returns the named port reserved for the Orderer instance.
func (*Network) OrdererRunner ¶
OrdererRunner returns an ifrit.Runner for the specified orderer. The runner can be used to start and manage an orderer process.
func (*Network) OrdererSignCert ¶
func (*Network) OrdererUserCert ¶
OrdererUserCert returns the path to the certificate for the specified user in the orderer organization.
func (*Network) OrdererUserKey ¶
OrdererUserKey returns the path to the private key for the specified user in the orderer organization.
func (*Network) OrdererUserMSPDir ¶
OrdererUserMSPDir returns the path to the MSP directory containing the certificates and keys for the specified user of the peer.
func (*Network) OrdererUserSigner ¶
func (n *Network) OrdererUserSigner(o *Orderer, user string) *SigningIdentity
OrdererUserSigner returns a SigningIdentity representing the specified user in the orderer organization.
func (*Network) OrderersInOrg ¶
OrderersInOrg returns all Orderer instances owned by the named organization.
func (*Network) Organization ¶
func (n *Network) Organization(orgName string) *Organization
Organization returns the information about the named Organization.
func (*Network) OrgsForOrderers ¶
func (n *Network) OrgsForOrderers(ordererNames []string) []*Organization
OrgsForOrderers returns all Organization instances that own at least one of the named orderers.
func (*Network) OutputBlockPath ¶
OutputBlockPath returns the path to the genesis block for the named system channel.
func (*Network) PeerAddress ¶
PeerAddress returns the address (host and port) exposed by the Peer for the named port. Command line tools should use the returned address when connecting to a peer.
This assumes that the peer is listening on 0.0.0.0 and is available on the loopback address.
func (*Network) PeerAdminSession ¶
PeerAdminSession starts a gexec.Session as a peer admin for the provided peer command. This is intended to be used by short running peer cli commands that execute in the context of a peer configuration.
func (*Network) PeerCACert ¶
PeerCACert returns the path to the CA certificate for the peer organization.
func (*Network) PeerClientConn ¶
func (n *Network) PeerClientConn(p *Peer) *grpc.ClientConn
PeerClientConn returns a grpc.ClientConn configured to connect to the provided peer. This connection can be used to create clients for the peer services. The client connection should be closed when the tests are done using it.
func (*Network) PeerConfigPath ¶
PeerConfigPath returns the path to the peer configuration document for the specified peer.
func (*Network) PeerDir ¶
PeerDir returns the path to the configuration directory for the specified Peer.
func (*Network) PeerGroupRunner ¶
PeerGroupRunner returns a runner that can be used to start and stop all peers in a network.
func (*Network) PeerLedgerDir ¶
PeerLedgerDir returns the ledger root directory for the specified peer.
func (*Network) PeerLocalMSPDir ¶
PeerLocalMSPDir returns the path to the local MSP directory for the peer.
func (*Network) PeerLocalTLSDir ¶
PeerLocalTLSDir returns the path to the local TLS directory for the peer.
func (*Network) PeerOrgCADir ¶
func (n *Network) PeerOrgCADir(o *Organization) string
PeerOrgCADir returns the path to the folder containing the CA certificate(s) and/or keys for the specified peer organization.
func (*Network) PeerOrgMSPDir ¶
func (n *Network) PeerOrgMSPDir(org *Organization) string
PeerOrgMSPDir returns the path to the MSP directory of the Peer organization.
func (*Network) PeerOrgs ¶
func (n *Network) PeerOrgs() []*Organization
PeerOrgs returns all Organizations associated with at least one Peer.
func (*Network) PeerRunner ¶
PeerRunner returns an ifrit.Runner for the specified peer. The runner can be used to start and manage a peer process.
func (*Network) PeerUserCert ¶
PeerUserCert returns the path to the certificate for the specified user in the peer organization.
func (*Network) PeerUserKey ¶
PeerUserKey returns the path to the private key for the specified user in the peer organization.
func (*Network) PeerUserMSPDir ¶
PeerUserMSPDir returns the path to the MSP directory containing the certificates and keys for the specified user of the peer.
func (*Network) PeerUserSession ¶
PeerUserSession starts a gexec.Session as a peer user for the provided peer command. This is intended to be used by short running peer cli commands that execute in the context of a peer configuration.
func (*Network) PeerUserSigner ¶
func (n *Network) PeerUserSigner(p *Peer, user string) *SigningIdentity
PeerUserSigner returns a SigningIdentity representing the specified user in the peer organization.
func (*Network) PeerUserTLSDir ¶
PeerUserTLSDir returns the path to the TLS directory containing the certificates and keys for the specified user of the peer.
func (*Network) PeersInOrg ¶
PeersInOrg returns all Peer instances that are owned by the named organization.
func (*Network) PeersWithChannel ¶
PeersWithChannel returns all Peer instances that have joined the named channel.
func (*Network) ProfileForChannel ¶
ProfileForChannel gets the configtxgen profile name associated with the specified channel.
func (*Network) ReadConfigTxConfig ¶
func (n *Network) ReadConfigTxConfig() *fabricconfig.ConfigTx
ReadConfigTxConfig unmarshals the configtx.yaml and returns an object approximating its contents.
func (*Network) ReadOrdererConfig ¶
func (n *Network) ReadOrdererConfig(o *Orderer) *fabricconfig.Orderer
ReadOrdererConfig unmarshals an orderer's orderer.yaml and returns an object approximating its contents.
func (*Network) ReadPeerConfig ¶
func (n *Network) ReadPeerConfig(p *Peer) *fabricconfig.Core
ReadPeerConfig unmarshals a peer's core.yaml and returns an object approximating its contents.
func (*Network) ReservePort ¶
ReservePort allocates the next available port.
func (*Network) StartOrderer ¶
func (*Network) StartSession ¶
StartSession executes a command session. This should be used to launch command line tools that are expected to run to completion.
func (*Network) StartSingleOrdererNetwork ¶
func (n *Network) StartSingleOrdererNetwork(ordererName string) (*ginkgomon.Runner, ifrit.Process, ifrit.Process)
StartSingleOrdererNetwork starts the fabric processes assuming a single orderer.
func (*Network) UpdateChannelAnchors ¶
UpdateChannelAnchors determines the anchor peers for the specified channel, creates an anchor peer update transaction for each organization, and submits the update transactions to the orderer.
TODO using configtxgen with -outputAnchorPeersUpdate to update the anchor peers is deprecated and does not work with channel participation API. We'll have to generate the channel update explicitly (see UpdateOrgAnchorPeers).
func (*Network) UpdateOrgAnchorPeers ¶
func (n *Network) UpdateOrgAnchorPeers(o *Orderer, channelName, orgName string, anchorPeersForOrg []*Peer)
UpdateOrgAnchorPeers sets the anchor peers of an organization on a channel using a config update tx, and waits for the update to be complete.
func (*Network) VerifyMembership ¶
VerifyMembership checks that each peer has discovered the expected peers in the network.
func (*Network) WriteConfigTxConfig ¶
func (n *Network) WriteConfigTxConfig(config *fabricconfig.ConfigTx)
WriteConfigTxConfig serializes the provided configuration to configtx.yaml.
func (*Network) WriteOrdererConfig ¶
func (n *Network) WriteOrdererConfig(o *Orderer, config *fabricconfig.Orderer)
WriteOrdererConfig serializes the provided configuration as the specified orderer's orderer.yaml document.
func (*Network) WritePeerConfig ¶
func (n *Network) WritePeerConfig(p *Peer, config *fabricconfig.Core)
WritePeerConfig serializes the provided configuration as the specified peer's core.yaml document.
type Orderer ¶
type Orderer struct { Name string `yaml:"name,omitempty"` Organization string `yaml:"organization,omitempty"` Id int `yaml:"id,omitempty"` }
Orderer defines an orderer instance and its owning organization.
type Organization ¶
type Organization struct { MSPID string `yaml:"msp_id,omitempty"` MSPType string `yaml:"msp_type,omitempty"` Name string `yaml:"name,omitempty"` Domain string `yaml:"domain,omitempty"` EnableNodeOUs bool `yaml:"enable_node_organizational_units"` Users int `yaml:"users,omitempty"` CA *CA `yaml:"ca,omitempty"` }
Organization models information about an Organization. It includes the information needed to populate an MSP with cryptogen.
type Peer ¶
type Peer struct { Name string `yaml:"name,omitempty"` DevMode bool `yaml:"devmode,omitempty"` Organization string `yaml:"organization,omitempty"` Channels []*PeerChannel `yaml:"channels,omitempty"` }
Peer defines a peer instance, it's owning organization, and the list of channels that the peer should be joined to.
type PeerChannel ¶
PeerChannel names of the channel a peer should be joined to and whether or not the peer should be an anchor for the channel.
type PortName ¶
type PortName string
func OrdererPortNames ¶
func OrdererPortNames() []PortName
OrdererPortNames returns the list of ports that need to be reserved for an Orderer.
func PeerPortNames ¶
func PeerPortNames() []PortName
PeerPortNames returns the list of ports that need to be reserved for a Peer.
type Profile ¶
type Profile struct { Name string `yaml:"name,omitempty"` Orderers []string `yaml:"orderers,omitempty"` Consortium string `yaml:"consortium,omitempty"` Organizations []string `yaml:"organizations,omitempty"` AppCapabilities []string `yaml:"app_capabilities,omitempty"` ChannelCapabilities []string `yaml:"channel_capabilities,omitempty"` Blocks *Blocks `yaml:"blocks,omitempty"` SmartBFT *SmartBFT `yaml:"smart_bft,omitempty"` }
A profile encapsulates basic information for a configtxgen profile.
type SigningIdentity ¶
A SigningIdentity represents an MSP signing identity.
func (*SigningIdentity) Serialize ¶
func (s *SigningIdentity) Serialize() ([]byte, error)
Serialize returns the probobuf encoding of an msp.SerializedIdenity.
type SmartBFT ¶
type SmartBFT struct { LeaderHeartbeatTimeout int `yaml:"leader_heartbeat_timeout,omitempty"` LeaderHeartbeatCount int `yaml:"leader_heartbeat_count,omitempty"` }
SmartBFT defines the configuration of smartBFT options.
type Templates ¶
type Templates struct { ConfigTx string `yaml:"configtx,omitempty"` Core string `yaml:"core,omitempty"` Crypto string `yaml:"crypto,omitempty"` Orderer string `yaml:"orderer,omitempty"` }
Templates can be used to provide custom templates to GenerateConfigTree.
func (*Templates) ConfigTxTemplate ¶
func (*Templates) CoreTemplate ¶
func (*Templates) CryptoTemplate ¶
func (*Templates) OrdererTemplate ¶
type WorkingDirer ¶
type WorkingDirer interface {
WorkingDir() string
}