...

Package nwo

import "github.com/hyperledger/fabric/integration/nwo"
Overview
Index
Subdirectories

Overview ▾

Index ▾

Constants
Variables
func AddConsenter(n *Network, peer *Peer, orderer *Orderer, channel string, consenter ectdraft_protos.Consenter)
func ComputeUpdateOrdererConfig(updateFile string, n *Network, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*Orderer)
func ConnectsToOrderer(c Command) bool
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, peers ...*Peer)
func DiscoverPeers(n *Network, p *Peer, user, channelName string) func() []DiscoveredPeer
func EnableCapabilities(network *Network, channel, capabilitiesGroup, capabilitiesVersion string, orderer *Orderer, peers ...*Peer)
func EnableCapabilitiesOrdererAdmin(network *Network, channel, capabilitiesGroup, capabilitiesVersion string, orderer *Orderer, peer *Peer, additionalSigners ...*Orderer)
func EnsureInstantiated(n *Network, channel, name, version 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 InstallChaincode(n *Network, chaincode Chaincode, peers ...*Peer)
func InstantiateChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, peer *Peer, checkPeers ...*Peer)
func NewCommand(path string, command Command) *exec.Cmd
func PackageChaincode(n *Network, chaincode Chaincode, peer *Peer)
func RemoveConsenter(n *Network, peer *Peer, orderer *Orderer, channel string, certificate []byte)
func UnmarshalBlockFromFile(blockFile string) *common.Block
func UpdateConfig(n *Network, orderer *Orderer, channel string, current, updated *common.Config, getConfigBlockFromOrderer bool, submitter *Peer, additionalSigners ...*Peer)
func UpdateConsensusMetadata(network *Network, peer *Peer, orderer *Orderer, channel string, mutateMetadata ConsensusMetadataMutator)
func UpdateEtcdRaftMetadata(network *Network, peer *Peer, orderer *Orderer, channel string, f func(md *ectdraft_protos.ConfigMetadata))
func UpdateOrdererConfig(n *Network, orderer *Orderer, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*Orderer)
func UpdateOrdererConfigFail(n *Network, orderer *Orderer, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*Orderer)
func UpdateSmartBFTMetadata(network *Network, peer *Peer, orderer *Orderer, channel string, f func(md *smartbft.ConfigMetadata))
func UpgradeChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, peers ...*Peer)
type CA
type Chaincode
type Channel
type Command
type Components
    func (c *Components) Build(args ...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) Peer() string
type Config
    func BasicEtcdRaft() *Config
    func BasicKafka() *Config
    func BasicSmartBFT() *Config
    func BasicSolo() *Config
    func MultiChannelEtcdRaft() *Config
    func MultiNodeEtcdRaft() *Config
    func MultiNodeSmartBFT() *Config
    func (c *Config) RemovePeer(orgName, peerName string)
type Consensus
type ConsensusMetadataMutator
type Consortium
type DiscoveredPeer
type Enver
type Network
    func New(c *Config, rootDir string, client *docker.Client, startPort int, components *Components) *Network
    func (n *Network) AnchorsForChannel(chanName string) []*Peer
    func (n *Network) AnchorsInOrg(orgName string) []*Peer
    func (n *Network) Bootstrap()
    func (n *Network) BrokerAddresses(portName PortName) []string
    func (n *Network) BrokerGroupRunner() ifrit.Runner
    func (n *Network) BrokerRunner(id int, zookeepers []string) *runner.Kafka
    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) Consortium(name string) *Consortium
    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) CreateChannelFail(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{})
    func (n *Network) CreateChannelTxPath(channelName string) string
    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) JoinChannel(name string, o *Orderer, peers ...*Peer)
    func (n *Network) NetworkGroupRunner() ifrit.Runner
    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) OrdererCert(o *Orderer) string
    func (n *Network) OrdererConfigPath(o *Orderer) string
    func (n *Network) OrdererDir(o *Orderer) string
    func (n *Network) OrdererGroupRunner() ifrit.Runner
    func (n *Network) OrdererIndex(orderer *Orderer) int
    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) OrdererMSPID(o *Orderer) 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) *ginkgomon.Runner
    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) OrderersInOrg(orgName string) []*Orderer
    func (n *Network) Organization(orgName string) *Organization
    func (n *Network) OrgsForOrderers(ordererNames []string) []*Organization
    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) PeerCert(p *Peer) string
    func (n *Network) PeerConfigPath(p *Peer) string
    func (n *Network) PeerDir(p *Peer) string
    func (n *Network) PeerGroupRunner() ifrit.Runner
    func (n *Network) PeerLocalMSPDir(p *Peer) string
    func (n *Network) PeerLocalTLSDir(p *Peer) 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) *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) 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) StartSession(cmd *exec.Cmd, name string) (*gexec.Session, error)
    func (n *Network) UpdateChannelAnchors(o *Orderer, channelName 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)
    func (n *Network) ZooKeeperRunner(idx int) *runner.ZooKeeper
type Orderer
    func (o Orderer) ID() string
type OrdererCapabilities
type Organization
type Peer
    func (p *Peer) Anchor() bool
    func (p *Peer) ID() string
type PeerChannel
type PortName
    func BrokerPortNames() []PortName
    func OrdererPortNames() []PortName
    func PeerPortNames() []PortName
type Ports
type Profile
type SystemChannel
type Templates
    func (t *Templates) ConfigTxTemplate() string
    func (t *Templates) CoreTemplate() string
    func (t *Templates) CryptoTemplate() string
    func (t *Templates) OrdererTemplate() string
type WorkingDirer

Package files

command.go components.go config.go configblock.go configtx_template.go core_template.go crypto_template.go deploy.go discover.go network.go orderer_template.go standard_networks.go templates.go

Constants

const DefaultConfigTxTemplate = `---
{{ with $w := . -}}
Organizations:{{ range .PeerOrgs }}
- &{{ .MSPID }}
  Name: {{ .Name }}
  ID: {{ .MSPID }}
  MSPDir: {{ $w.PeerOrgMSPDir . }}
  Policies:
    Readers:
      Type: Signature
      Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.peer', '{{.MSPID}}.client')
    Writers:
      Type: Signature
      Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.client')
    Admins:
      Type: Signature
      Rule: OR('{{.MSPID}}.admin')
  AnchorPeers:{{ range $w.AnchorsInOrg .Name }}
  - Host: 127.0.0.1
    Port: {{ $w.PeerPort . "Listen" }}
  {{- end }}
{{- end }}
{{- range .OrdererOrgs }}
- &{{ .MSPID }}
  Name: {{ .Name }}
  ID: {{ .MSPID }}
  MSPDir: {{ $w.OrdererOrgMSPDir . }}
  Policies:
    Readers:
      Type: Signature
      Rule: OR('{{.MSPID}}.member')
    Writers:
      Type: Signature
      Rule: OR('{{.MSPID}}.member')
    Admins:
      Type: Signature
      Rule: OR('{{.MSPID}}.admin')
  OrdererEndpoints:{{ range $w.OrderersInOrg .Name }}
  - 127.0.0.1:{{ $w.OrdererPort . "Listen" }}
  {{- end }}
{{ end }}

Channel: &ChannelDefaults
  Capabilities:
    V1_4_3: true
  Policies:
    Readers:
      Type: ImplicitMeta
      Rule: ANY Readers
    Writers:
      Type: ImplicitMeta
      Rule: ANY Writers
    Admins:
      Type: ImplicitMeta
      Rule: MAJORITY Admins

Profiles:{{ range .Profiles }}
  {{ .Name }}:
    <<: *ChannelDefaults
    {{- if .Orderers }}
    Orderer:
      OrdererType: {{ $w.Consensus.Type }}
      Addresses:{{ range .Orderers }}{{ with $w.Orderer . }}
      - 127.0.0.1:{{ $w.OrdererPort . "Listen" }}
      {{- end }}{{ end }}
      BatchTimeout: 1s
      BatchSize:
        MaxMessageCount: 1
        AbsoluteMaxBytes: 98 MB
        PreferredMaxBytes: 512 KB
      Capabilities:
        V1_4_2: true
      {{- if eq $w.Consensus.Type "kafka" }}
      Kafka:
        Brokers:{{ range $w.BrokerAddresses "HostPort" }}
        - {{ . }}
        {{- end }}
      {{- end }}
      {{- if eq $w.Consensus.Type "etcdraft" }}
      EtcdRaft:
        Options:
          TickInterval: 500ms
          SnapshotIntervalSize: 1 KB
        Consenters:{{ range .Orderers }}{{ with $w.Orderer . }}
        - Host: 127.0.0.1
          Port: {{ $w.OrdererPort . "Listen" }}
          ClientTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt
          ServerTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt
        {{- end }}{{- end }}
      {{- end }}
      {{- if eq $w.Consensus.Type "smartbft" }}
      SmartBFT:
        Consenters:{{ range .Orderers }}{{ with $w.Orderer . }}
        - Host: 127.0.0.1
          Port: {{ $w.OrdererPort . "Cluster" }}
          ClientTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt
          ServerTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt
          MSPID: {{ $w.OrdererMSPID . }}
          Identity: {{ $w.OrdererCert . }}
          ConsenterId: {{ $w.OrdererIndex . }}
        {{- end }}{{- end }}
      {{- end }}
      Organizations:{{ range $w.OrgsForOrderers .Orderers }}
      - *{{ .MSPID }}
      {{- end }}
      Policies:
        Readers:
          Type: ImplicitMeta
          Rule: ANY Readers
        Writers:
          Type: ImplicitMeta
          Rule: ANY Writers
        Admins:
          Type: ImplicitMeta
          Rule: MAJORITY Admins
      {{- if eq $w.Consensus.Type "smartbft" }}
        BlockValidation:
          Type: ImplicitOrderer
          Rule: SMARTBFT
      {{- else }}
        BlockValidation:
          Type: ImplicitMeta
          Rule: ANY Writers
      {{- end }}
    {{- end }}
    {{- if .Consortium }}
    Consortium: {{ .Consortium }}
    Application:
      Capabilities:
        V1_3: true
        CAPABILITY_PLACEHOLDER: false
      Organizations:{{ range .Organizations }}
      - *{{ ($w.Organization .).MSPID }}
      {{- end}}
      Policies:
        Readers:
          Type: ImplicitMeta
          Rule: ANY Readers
        Writers:
          Type: ImplicitMeta
          Rule: ANY Writers
        Admins:
          Type: ImplicitMeta
          Rule: MAJORITY Admins
        LifecycleEndorsement:
          Type: ImplicitMeta
          Rule: "MAJORITY Endorsement"
        Endorsement:
          Type: ImplicitMeta
          Rule: "MAJORITY Endorsement"
    {{- else }}
    Consortiums:{{ range $w.Consortiums }}
      {{ .Name }}:
        Organizations:{{ range .Organizations }}
        - *{{ ($w.Organization .).MSPID }}
        {{- end }}
    {{- end }}
    {{- end }}
{{- end }}
{{ end }}
`
const DefaultCoreTemplate = `---
logging:
  format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'

peer:
  id: {{ Peer.ID }}
  networkId: {{ .NetworkID }}
  address: 127.0.0.1:{{ .PeerPort Peer "Listen" }}
  addressAutoDetect: true
  listenAddress: 127.0.0.1:{{ .PeerPort Peer "Listen" }}
  chaincodeListenAddress: 0.0.0.0:{{ .PeerPort Peer "Chaincode" }}
  gomaxprocs: -1
  keepalive:
    minInterval: 60s
    client:
      interval: 60s
      timeout: 20s
    deliveryClient:
      interval: 60s
      timeout: 20s
  gossip:
    bootstrap: 127.0.0.1:{{ .PeerPort Peer "Listen" }}
    useLeaderElection: true
    orgLeader: false
    endpoint:
    maxBlockCountToStore: 100
    maxPropagationBurstLatency: 10ms
    maxPropagationBurstSize: 10
    propagateIterations: 1
    propagatePeerNum: 3
    pullInterval: 4s
    pullPeerNum: 3
    requestStateInfoInterval: 4s
    publishStateInfoInterval: 4s
    stateInfoRetentionInterval:
    publishCertPeriod: 10s
    dialTimeout: 3s
    connTimeout: 2s
    recvBuffSize: 20
    sendBuffSize: 200
    digestWaitTime: 1s
    requestWaitTime: 1500ms
    responseWaitTime: 2s
    aliveTimeInterval: 5s
    aliveExpirationTimeout: 25s
    reconnectInterval: 25s
    externalEndpoint: 127.0.0.1:{{ .PeerPort Peer "Listen" }}
    election:
      startupGracePeriod: 15s
      membershipSampleInterval: 1s
      leaderAliveThreshold: 10s
      leaderElectionDuration: 5s
    pvtData:
      pullRetryThreshold: 15s
      transientstoreMaxBlockRetention: 1000
      pushAckTimeout: 3s
      reconcileBatchSize: 10
      reconcileSleepInterval: 10s
      reconciliationEnabled: true
  events:
    address: 127.0.0.1:{{ .PeerPort Peer "Events" }}
    buffersize: 100
    timeout: 10ms
    timewindow: 15m
    keepalive:
      minInterval: 60s
  tls:
    enabled:  true
    clientAuthRequired: false
    cert:
      file: {{ .PeerLocalTLSDir Peer }}/server.crt
    key:
      file: {{ .PeerLocalTLSDir Peer }}/server.key
    rootcert:
      file: {{ .PeerLocalTLSDir Peer }}/ca.crt
    clientRootCAs:
      files:
      - {{ .PeerLocalTLSDir Peer }}/ca.crt
  authentication:
    timewindow: 15m
  fileSystemPath: filesystem
  BCCSP:
    Default: SW
    SW:
      Hash: SHA2
      Security: 256
      FileKeyStore:
        KeyStore:
  mspConfigPath: {{ .PeerLocalMSPDir Peer }}
  localMspId: {{ (.Organization Peer.Organization).MSPID }}
  deliveryclient:
    reconnectTotalTimeThreshold: 3600s
    bft:
  {{- if Peer.BFTDeliveryClient }}
      enabled: true
  {{- else }}
      enabled: false
  {{- end }}
  localMspType: bccsp
  profile:
    enabled:     false
    listenAddress: 127.0.0.1:{{ .PeerPort Peer "ProfilePort" }}
  adminService:
    listenAddress: 127.0.0.1:{{ .PeerPort Peer "AdminServicePort" }}
  handlers:
    authFilters:
    - name: DefaultAuth
    - name: ExpirationCheck
    decorators:
    - name: DefaultDecorator
    endorsers:
      escc:
        name: DefaultEndorsement
    validators:
      vscc:
        name: DefaultValidation
  validatorPoolSize:
  discovery:
    enabled: true
    authCacheEnabled: true
    authCacheMaxSize: 1000
    authCachePurgeRetentionRatio: 0.75
    orgMembersAllowedAccess: false

vm:
  endpoint: unix:///var/run/docker.sock
  docker:
    tls:
      enabled: false
      ca:
        file: docker/ca.crt
      cert:
        file: docker/tls.crt
      key:
        file: docker/tls.key
    attachStdout: true
    hostConfig:
      NetworkMode: host
      LogConfig:
        Type: json-file
        Config:
          max-size: "50m"
          max-file: "5"
      Memory: 2147483648

chaincode:
  builder: $(DOCKER_NS)/fabric-ccenv:$(ARCH)-$(PROJECT_VERSION)
  pull: false
  golang:
    runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
    dynamicLink: false
  car:
    runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)
  java:
    runtime: $(DOCKER_NS)/fabric-javaenv:$(ARCH)-$(PROJECT_VERSION)
  node:
      runtime: $(BASE_DOCKER_NS)/fabric-baseimage:$(ARCH)-$(BASE_VERSION)
  startuptimeout: 300s
  executetimeout: 30s
  mode: net
  keepalive: 0
  system:
    cscc: enable
    lscc: enable
    qscc: enable
  systemPlugins:
  logging:
    level:  info
    shim:   warning
    format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'

ledger:
  blockchain:
  state:
    stateDatabase: goleveldb
    couchDBConfig:
      couchDBAddress: 127.0.0.1:5984
      username:
      password:
      maxRetries: 3
      maxRetriesOnStartup: 10
      requestTimeout: 35s
      queryLimit: 10000
      maxBatchUpdateSize: 1000
      warmIndexesAfterNBlocks: 1
  history:
    enableHistoryDatabase: true

operations:
  listenAddress: 127.0.0.1:{{ .PeerPort Peer "Operations" }}
  tls:
    enabled: true
    cert:
      file: {{ .PeerLocalTLSDir Peer }}/server.crt
    key:
      file: {{ .PeerLocalTLSDir Peer }}/server.key
    clientAuthRequired: false
    clientRootCAs:
      files:
      - {{ .PeerLocalTLSDir Peer }}/ca.crt
metrics:
  provider: {{ .MetricsProvider }}
  statsd:
    network: udp
    address: {{ if .StatsdEndpoint }}{{ .StatsdEndpoint }}{{ else }}127.0.0.1:8125{{ end }}
    writeInterval: 5s
    prefix: {{ ReplaceAll (ToLower Peer.ID) "." "_" }}
`
const DefaultCryptoTemplate = `---
{{ with $w := . -}}
OrdererOrgs:{{ range .OrdererOrgs }}
- Name: {{ .Name }}
  Domain: {{ .Domain }}
  EnableNodeOUs: {{ .EnableNodeOUs }}
  {{- if .CA }}
  CA:{{ if .CA.Hostname }}
    Hostname: {{ .CA.Hostname }}
  {{- end -}}
  {{- end }}
  Specs:{{ range $w.OrderersInOrg .Name }}
  - Hostname: {{ .Name }}
    SANS:
    - localhost
    - 127.0.0.1
    - ::1
  {{- end }}
{{- end }}

PeerOrgs:{{ range .PeerOrgs }}
- Name: {{ .Name }}
  Domain: {{ .Domain }}
  EnableNodeOUs: {{ .EnableNodeOUs }}
  {{- if .CA }}
  CA:{{ if .CA.Hostname }}
    hostname: {{ .CA.Hostname }}
    SANS:
    - localhost
    - 127.0.0.1
    - ::1
  {{- end }}
  {{- end }}
  Users:
    Count: {{ .Users }}
  Specs:{{ range $w.PeersInOrg .Name }}
  - Hostname: {{ .Name }}
    SANS:
    - localhost
    - 127.0.0.1
    - ::1
  {{- end }}
{{- end }}
{{- end }}
`
const DefaultOrdererTemplate = `---
{{ with $w := . -}}
General:
  LedgerType: file
  ListenAddress: 127.0.0.1
  ListenPort: {{ .OrdererPort Orderer "Listen" }}
  TLS:
    Enabled: true
    PrivateKey: {{ $w.OrdererLocalTLSDir Orderer }}/server.key
    Certificate: {{ $w.OrdererLocalTLSDir Orderer }}/server.crt
    RootCAs:
    -  {{ $w.OrdererLocalTLSDir Orderer }}/ca.crt
    ClientAuthRequired: false
    ClientRootCAs:
  Cluster:
    ClientCertificate: {{ $w.OrdererLocalTLSDir Orderer }}/server.crt
    ClientPrivateKey: {{ $w.OrdererLocalTLSDir Orderer }}/server.key
    ServerCertificate: {{ $w.OrdererLocalTLSDir Orderer }}/server.crt
    ServerPrivateKey: {{ $w.OrdererLocalTLSDir Orderer }}/server.key
    DialTimeout: 5s
    RPCTimeout: 7s
    ReplicationBufferSize: 20971520
    ReplicationPullTimeout: 5s
    ReplicationRetryTimeout: 5s
    ListenAddress: 127.0.0.1
    ListenPort: {{ .OrdererPort Orderer "Cluster" }}
  Keepalive:
    ServerMinInterval: 60s
    ServerInterval: 7200s
    ServerTimeout: 20s
  GenesisMethod: file
  GenesisProfile: {{ .SystemChannel.Profile }}
  GenesisFile: {{ .RootDir }}/{{ .SystemChannel.Name }}_block.pb
  SystemChannel: {{ .SystemChannel.Name }}
  LocalMSPDir: {{ $w.OrdererLocalMSPDir Orderer }}
  LocalMSPID: {{ ($w.Organization Orderer.Organization).MSPID }}
  Profile:
    Enabled: false
    Address: 127.0.0.1:{{ .OrdererPort Orderer "Profile" }}
  BCCSP:
    Default: SW
    SW:
      Hash: SHA2
      Security: 256
      FileKeyStore:
        KeyStore:
  Authentication:
    TimeWindow: 15m
FileLedger:
  Location: {{ .OrdererDir Orderer }}/system
  Prefix: hyperledger-fabric-ordererledger
RAMLedger:
  HistorySize: 1000
{{ if eq .Consensus.Type "kafka" -}}
Kafka:
  Retry:
    ShortInterval: 5s
    ShortTotal: 10m
    LongInterval: 5m
    LongTotal: 12h
    NetworkTimeouts:
      DialTimeout: 10s
      ReadTimeout: 10s
      WriteTimeout: 10s
    Metadata:
      RetryBackoff: 250ms
      RetryMax: 3
    Producer:
      RetryBackoff: 100ms
      RetryMax: 3
    Consumer:
      RetryBackoff: 2s
  Topic:
    ReplicationFactor: 1
  Verbose: false
  TLS:
    Enabled: false
    PrivateKey:
    Certificate:
    RootCAs:
  SASLPlain:
    Enabled: false
    User:
    Password:
  Version:{{ end }}
Debug:
  BroadcastTraceDir:
  DeliverTraceDir:
Consensus:
  WALDir: {{ .OrdererDir Orderer }}/etcdraft/wal
  SnapDir: {{ .OrdererDir Orderer }}/etcdraft/snapshot
  EvictionSuspicion: 10s
Operations:
  ListenAddress: 127.0.0.1:{{ .OrdererPort Orderer "Operations" }}
  TLS:
    Enabled: true
    PrivateKey: {{ $w.OrdererLocalTLSDir Orderer }}/server.key
    Certificate: {{ $w.OrdererLocalTLSDir Orderer }}/server.crt
    RootCAs:
    -  {{ $w.OrdererLocalTLSDir Orderer }}/ca.crt
    ClientAuthRequired: false
    ClientRootCAs:
    -  {{ $w.OrdererLocalTLSDir Orderer }}/ca.crt
Metrics:
  Provider: {{ .MetricsProvider }}
  Statsd:
    Network: udp
    Address: {{ if .StatsdEndpoint }}{{ .StatsdEndpoint }}{{ else }}127.0.0.1:8125{{ end }}
    WriteInterval: 5s
    Prefix: {{ ReplaceAll (ToLower Orderer.ID) "." "_" }}
{{- end }}
`

Variables

var RequiredImages = []string{
    fmt.Sprintf("hyperledger/fabric-ccenv:%s-latest", runtime.GOARCH),
}

func AddConsenter

func AddConsenter(n *Network, peer *Peer, orderer *Orderer, channel string, consenter ectdraft_protos.Consenter)

AddConsenter adds a new consenter to the given channel

func ComputeUpdateOrdererConfig

func ComputeUpdateOrdererConfig(updateFile string, n *Network, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*Orderer)

func ConnectsToOrderer

func ConnectsToOrderer(c Command) bool

func CurrentConfigBlockNumber

func CurrentConfigBlockNumber(n *Network, peer *Peer, orderer *Orderer, channel string) uint64

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

func CurrentConfigBlockNumberFromPeer(n *Network, peer *Peer, channel, output string) uint64

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, instantiate the chaincode on one of the peers, and wait for the instantiation to complete on all of the peers.

NOTE: This helper should not be used to deploy the same chaincode on multiple channels as the install will fail on subsequent calls. Instead, simply use InstantiateChaincode().

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 EnableCapabilitiesOrdererAdmin

func EnableCapabilitiesOrdererAdmin(network *Network, channel, capabilitiesGroup, capabilitiesVersion string, orderer *Orderer, peer *Peer, additionalSigners ...*Orderer)

EnableCapabilitiesOrdererAdmin enables a specific capabilities flag for a running network, using an Orderer Admin Session. This is required to make changes on the system channel, for example.

func EnsureInstantiated

func EnsureInstantiated(n *Network, channel, name, version string, peers ...*Peer)

func FetchConfigBlock

func FetchConfigBlock(n *Network, peer *Peer, orderer *Orderer, channel string, output string)

FetchConfigBlock fetches latest config block.

func GetConfig

func GetConfig(n *Network, peer *Peer, orderer *Orderer, channel string) *common.Config

GetConfig retrieves the last config of the given channel

func GetConfigBlock

func GetConfigBlock(n *Network, peer *Peer, orderer *Orderer, channel string) *common.Block

GetConfigBlock retrieves the current config block for a channel

func InstallChaincode

func InstallChaincode(n *Network, chaincode Chaincode, peers ...*Peer)

func InstantiateChaincode

func InstantiateChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, peer *Peer, checkPeers ...*Peer)

func NewCommand

func NewCommand(path string, command Command) *exec.Cmd

func PackageChaincode

func PackageChaincode(n *Network, chaincode Chaincode, peer *Peer)

func RemoveConsenter

func RemoveConsenter(n *Network, peer *Peer, orderer *Orderer, channel string, certificate []byte)

RemoveConsenter removes a consenter with the given certificate in PEM format from the given channel

func UnmarshalBlockFromFile

func UnmarshalBlockFromFile(blockFile string) *common.Block

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 UpdateEtcdRaftMetadata

func UpdateEtcdRaftMetadata(network *Network, peer *Peer, orderer *Orderer, channel string, f func(md *ectdraft_protos.ConfigMetadata))

UpdateEtcdRaftMetadata executes a config update that updates the etcdraft metadata according to the given function f

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 UpdateOrdererConfigFail

func UpdateOrdererConfigFail(n *Network, orderer *Orderer, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*Orderer)

UpdateOrdererConfigFail computes, signs, and submits a configuration update which requires orderers signature and waits for the update to FAIL.

func UpdateSmartBFTMetadata

func UpdateSmartBFTMetadata(network *Network, peer *Peer, orderer *Orderer, channel string, f func(md *smartbft.ConfigMetadata))

UpdateSmartBFTMetadata executes a config update that updates the snartBFT metadata according to the given function f

func UpgradeChaincode

func UpgradeChaincode(n *Network, channel string, orderer *Orderer, chaincode Chaincode, peers ...*Peer)

type CA

type CA struct {
    Hostname string `yaml:"hostname,omitempty"`
}

type Chaincode

type Chaincode struct {
    Name              string
    Version           string
    Path              string
    Ctor              string
    Policy            string
    Lang              string
    CollectionsConfig string // optional
    PackageFile       string
}

type Channel

Channel associates a channel name with a configtxgen profile name.

type Channel struct {
    Name        string `yaml:"name,omitempty"`
    Profile     string `yaml:"profile,omitempty"`
    BaseProfile string `yaml:"baseprofile,omitempty"`
}

type Command

type Command interface {
    Args() []string
    SessionName() string
}

type Components

type Components struct {
    Paths map[string]string
}

func (*Components) Build

func (c *Components) Build(args ...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) Peer

func (c *Components) Peer() string

type Config

Config holds the basic information needed to generate fabric configuration files.

type Config struct {
    Organizations []*Organization `yaml:"organizations,omitempty"`
    Consortiums   []*Consortium   `yaml:"consortiums,omitempty"`
    SystemChannel *SystemChannel  `yaml:"system_channel,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"`
}

func BasicEtcdRaft

func BasicEtcdRaft() *Config

func BasicKafka

func BasicKafka() *Config

func BasicSmartBFT

func BasicSmartBFT() *Config

func BasicSolo

func BasicSolo() *Config

func MultiChannelEtcdRaft

func MultiChannelEtcdRaft() *Config

func MultiNodeEtcdRaft

func MultiNodeEtcdRaft() *Config

func MultiNodeSmartBFT

func MultiNodeSmartBFT() *Config

func (*Config) RemovePeer

func (c *Config) RemovePeer(orgName, peerName string)

type Consensus

Consensus indicates the orderer types and how many broker and zookeeper instances.

type Consensus struct {
    Type       string `yaml:"type,omitempty"`
    Brokers    int    `yaml:"brokers,omitempty"`
    ZooKeepers int    `yaml:"zookeepers,omitempty"`
}

type ConsensusMetadataMutator

ConsensusMetadataMutator receives ConsensusType.Metadata and mutates it

type ConsensusMetadataMutator func([]byte) []byte

type Consortium

A Consortium is a named collection of Organizations. It is used to populate the Orderer geneesis block profile.

type Consortium struct {
    Name          string   `yaml:"name,omitempty"`
    Organizations []string `yaml:"organizations,omitempty"`
}

type DiscoveredPeer

DiscoveredPeer defines a struct for discovering peers using discovery service. each peer in the result will have these fields

type DiscoveredPeer struct {
    MSPID      string   `yaml:"mspid,omitempty"`
    Endpoint   string   `yaml:"endpoint,omitempty"`
    Identity   string   `yaml:"identity,omitempty"`
    Chaincodes []string `yaml:"chaincodes,omitempty"`
}

type Enver

type Enver interface {
    Env() []string
}

type Network

Network holds information about a fabric network.

type Network struct {
    RootDir           string
    StartPort         uint16
    Components        *Components
    DockerClient      *docker.Client
    NetworkID         string
    EventuallyTimeout time.Duration
    MetricsProvider   string
    StatsdEndpoint    string

    PortsByBrokerID  map[string]Ports
    PortsByOrdererID map[string]Ports
    PortsByPeerID    map[string]Ports
    Organizations    []*Organization
    SystemChannel    *SystemChannel
    Channels         []*Channel
    Consensus        *Consensus
    OrdererCap       *OrdererCapabilities
    Orderers         []*Orderer
    Peers            []*Peer
    Profiles         []*Profile
    Consortiums      []*Consortium
    Templates        *Templates
    // contains filtered or unexported fields
}

func New

func New(c *Config, rootDir string, client *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) AnchorsForChannel

func (n *Network) AnchorsForChannel(chanName string) []*Peer

AnchorsForChannel returns all Peer instances that are anchors for the named channel.

func (*Network) AnchorsInOrg

func (n *Network) AnchorsInOrg(orgName string) []*Peer

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, orderer system channel genesis block, and create channel transactions 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 gensis block is generated from the profile referenced by the SystemChannel.Profile attribute. The block is written to ${rootDir}/${SystemChannel.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) BrokerAddresses

func (n *Network) BrokerAddresses(portName PortName) []string

BrokerAddresses returns the list of broker addresses for the network.

func (*Network) BrokerGroupRunner

func (n *Network) BrokerGroupRunner() ifrit.Runner

BrokerGroupRunner returns a runner that manages the processes that make up the kafka broker network for fabric.

func (*Network) BrokerRunner

func (n *Network) BrokerRunner(id int, zookeepers []string) *runner.Kafka

BrokerRunner returns a runner for an kafka broker instance.

func (*Network) CACertsBundlePath

func (n *Network) CACertsBundlePath() string

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

func (n *Network) ConfigTxConfigPath() string

ConfigTxPath returns the path to the generated configtxgen configuration file.

func (*Network) ConfigTxGen

func (n *Network) ConfigTxGen(command Command) (*gexec.Session, error)

ConfigTxGen starts a gexec.Session for the provided configtxgen command.

func (*Network) Consortium

func (n *Network) Consortium(name string) *Consortium

Consortium returns information about the named Consortium.

func (*Network) CreateAndJoinChannel

func (n *Network) CreateAndJoinChannel(o *Orderer, channelName string)

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

func (n *Network) CreateAndJoinChannels(o *Orderer)

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) CreateChannelFail

func (n *Network) CreateChannelFail(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{})

CreateChannelFail will submit an existing create channel transaction to the specified orderer, but expect to FAIL. The channel transaction must exist at the location returned by CreateChannelTxPath.

The orderer must be running when this is called.

func (*Network) CreateChannelTxPath

func (n *Network) CreateChannelTxPath(channelName string) string

CreateChannelTxPath returns the path to the create channel transaction for the named channel.

func (*Network) CryptoConfigPath

func (n *Network) CryptoConfigPath() string

CryptoConfigPath returns the path to the generated cryptogen configuration file.

func (*Network) CryptoPath

func (n *Network) CryptoPath() string

CryptoPath returns the path to the directory where cryptogen will place its generated artifacts.

func (*Network) Cryptogen

func (n *Network) Cryptogen(command Command) (*gexec.Session, error)

Cryptogen starts a gexec.Session for the provided cryptogen command.

func (*Network) Discover

func (n *Network) Discover(command Command) (*gexec.Session, error)

Discover starts a gexec.Session for the provided discover command.

func (*Network) DiscoveredPeer

func (n *Network) DiscoveredPeer(p *Peer, chaincodes ...string) DiscoveredPeer

the function 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()

func (*Network) GenerateCoreConfig

func (n *Network) GenerateCoreConfig(p *Peer)

func (*Network) GenerateCryptoConfig

func (n *Network) GenerateCryptoConfig()

func (*Network) GenerateOrdererConfig

func (n *Network) GenerateOrdererConfig(o *Orderer)

func (*Network) JoinChannel

func (n *Network) JoinChannel(name string, o *Orderer, peers ...*Peer)

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) NetworkGroupRunner

func (n *Network) NetworkGroupRunner() ifrit.Runner

NetworkGroupRunner returns a runner that can be used to start and stop an entire fabric network.

func (*Network) Orderer

func (n *Network) Orderer(name string) *Orderer

Orderer returns the information about the named Orderer.

func (*Network) OrdererAddress

func (n *Network) OrdererAddress(o *Orderer, portName PortName) string

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

func (n *Network) OrdererAdminSession(o *Orderer, p *Peer, command Command) (*gexec.Session, error)

OrdererAdminSession execute a gexec.Session as an orderer node admin user. This is used primarily to generate orderer configuration updates

func (*Network) OrdererCert

func (n *Network) OrdererCert(o *Orderer) string

OrdererCert returns the path to the orderer's certificate.

func (*Network) OrdererConfigPath

func (n *Network) OrdererConfigPath(o *Orderer) string

OrdererConfigPath returns the path to the orderer configuration document for the specified Orderer.

func (*Network) OrdererDir

func (n *Network) OrdererDir(o *Orderer) string

OrdererDir returns the path to the configuration directory for the specified Orderer.

func (*Network) OrdererGroupRunner

func (n *Network) OrdererGroupRunner() ifrit.Runner

OrdererGroupRunner returns a runner that can be used to start and stop all orderers in a network.

func (*Network) OrdererIndex

func (n *Network) OrdererIndex(orderer *Orderer) int

OrdererIndex returns next int value

func (*Network) OrdererLocalCryptoDir

func (n *Network) OrdererLocalCryptoDir(o *Orderer, cryptoType string) string

OrdererLocalCryptoDir returns the path to the local crypto directory for the Orderer.

func (*Network) OrdererLocalMSPDir

func (n *Network) OrdererLocalMSPDir(o *Orderer) string

OrdererLocalMSPDir returns the path to the local MSP directory for the Orderer.

func (*Network) OrdererLocalTLSDir

func (n *Network) OrdererLocalTLSDir(o *Orderer) string

OrdererLocalTLSDir returns the path to the local TLS directory for the Orderer.

func (*Network) OrdererMSPID

func (n *Network) OrdererMSPID(o *Orderer) string

OrdererMSPID returns orderer's MSPID

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

func (n *Network) OrdererPort(o *Orderer, portName PortName) uint16

OrdererPort returns the named port reserved for the Orderer instance.

func (*Network) OrdererRunner

func (n *Network) OrdererRunner(o *Orderer) *ginkgomon.Runner

OrdererRunner returns an ifrit.Runner for the specified orderer. The runner can be used to start and manage an orderer process.

func (*Network) OrdererUserCert

func (n *Network) OrdererUserCert(o *Orderer, user string) string

OrdererUserCert returns the path to the certificate for the specified user in the orderer organization.

func (*Network) OrdererUserKey

func (n *Network) OrdererUserKey(o *Orderer, user string) string

OrdererUserKey returns the path to the private key for the specified user in the orderer organization.

func (*Network) OrdererUserMSPDir

func (n *Network) OrdererUserMSPDir(o *Orderer, user string) string

OrdererUserMSPDir returns the path to the MSP directory containing the certificates and keys for the specified user of the peer.

func (*Network) OrderersInOrg

func (n *Network) OrderersInOrg(orgName string) []*Orderer

OrderersInOrg returns all Orderer instances owned by the named organaiztion.

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

func (n *Network) OutputBlockPath(channelName string) string

OutputBlockPath returns the path to the genesis block for the named system channel.

func (*Network) Peer

func (n *Network) Peer(orgName, peerName string) *Peer

Peer returns the information about the named Peer in the named organization.

func (*Network) PeerAddress

func (n *Network) PeerAddress(p *Peer, portName PortName) string

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

func (n *Network) PeerAdminSession(p *Peer, command Command) (*gexec.Session, error)

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) PeerCert

func (n *Network) PeerCert(p *Peer) string

PeerCert returns the path to the peer's certificate.

func (*Network) PeerConfigPath

func (n *Network) PeerConfigPath(p *Peer) string

PeerConfigPath returns the path to the peer configuration document for the specified peer.

func (*Network) PeerDir

func (n *Network) PeerDir(p *Peer) string

PeerDir returns the path to the configuration directory for the specified Peer.

func (*Network) PeerGroupRunner

func (n *Network) PeerGroupRunner() ifrit.Runner

PeerGroupRunner returns a runner that can be used to start and stop all peers in a network.

func (*Network) PeerLocalMSPDir

func (n *Network) PeerLocalMSPDir(p *Peer) string

PeerLocalMSPDir returns the path to the local MSP directory for the peer.

func (*Network) PeerLocalTLSDir

func (n *Network) PeerLocalTLSDir(p *Peer) string

PeerLocalTLSDir returns the path to the local TLS directory for the peer.

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) PeerPort

func (n *Network) PeerPort(p *Peer, portName PortName) uint16

PeerPort returns the named port reserved for the Peer instance.

func (*Network) PeerRunner

func (n *Network) PeerRunner(p *Peer) *ginkgomon.Runner

PeerRunner returns an ifrit.Runner for the specified peer. The runner can be used to start and manage a peer process.

func (*Network) PeerUserCert

func (n *Network) PeerUserCert(p *Peer, user string) string

PeerUserCert returns the path to the certificate for the specified user in the peer organization.

func (*Network) PeerUserKey

func (n *Network) PeerUserKey(p *Peer, user string) string

PeerUserKey returns the path to the private key for the specified user in the peer organization.

func (*Network) PeerUserMSPDir

func (n *Network) PeerUserMSPDir(p *Peer, user string) string

PeerUserMSPDir returns the path to the MSP directory containing the certificates and keys for the specified user of the peer.

func (*Network) PeerUserSession

func (n *Network) PeerUserSession(p *Peer, user string, command Command) (*gexec.Session, error)

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) PeerUserTLSDir

func (n *Network) PeerUserTLSDir(p *Peer, user string) string

PeerUserTLSDir returns the path to the TLS directory containing the certificates and keys for the specified user of the peer.

func (*Network) PeersInOrg

func (n *Network) PeersInOrg(orgName string) []*Peer

PeersInOrg returns all Peer instances that are owned by the named organization.

func (*Network) PeersWithChannel

func (n *Network) PeersWithChannel(chanName string) []*Peer

PeersWithChannel returns all Peer instances that have joined the named channel.

func (*Network) ProfileForChannel

func (n *Network) ProfileForChannel(channelName string) string

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

func (n *Network) ReservePort() uint16

ReservePort allocates the next available port.

func (*Network) StartSession

func (n *Network) StartSession(cmd *exec.Cmd, name string) (*gexec.Session, error)

StartSession executes a command session. This should be used to launch command line tools that are expected to run to completion.

func (*Network) UpdateChannelAnchors

func (n *Network) UpdateChannelAnchors(o *Orderer, channelName string)

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.

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.

func (*Network) ZooKeeperRunner

func (n *Network) ZooKeeperRunner(idx int) *runner.ZooKeeper

ZooKeeperRunner returns a runner for a ZooKeeper instance.

type Orderer

Orderer defines an orderer instance and its owning organization.

type Orderer struct {
    Name         string `yaml:"name,omitempty"`
    Organization string `yaml:"organization,omitempty"`
}

func (Orderer) ID

func (o Orderer) ID() string

ID provides a unique identifier for an orderer instance.

type OrdererCapabilities

type OrdererCapabilities struct {
    V2_0 bool `yaml:"v20,omitempty"`
}

type Organization

Organization models information about an Organization. It includes the information needed to populate an MSP with cryptogen.

type Organization struct {
    MSPID         string `yaml:"msp_id,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"`
}

type Peer

Peer defines a peer instance, it's owning organization, the list of channels that the peer should be joined to, and whether it uses a BFT delivery client.

type Peer struct {
    Name              string         `yaml:"name,omitempty"`
    Organization      string         `yaml:"organization,omitempty"`
    Channels          []*PeerChannel `yaml:"channels,omitempty"`
    BFTDeliveryClient bool           `yaml:"bftdeliveryclient,omitempty"`
}

func (*Peer) Anchor

func (p *Peer) Anchor() bool

Anchor returns true if this peer is an anchor for any channel it has joined.

func (*Peer) ID

func (p *Peer) ID() string

ID provides a unique identifier for a peer instance.

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 PeerChannel struct {
    Name   string `yaml:"name,omitempty"`
    Anchor bool   `yaml:"anchor"`
}

type PortName

type PortName string
const (
    ChaincodePort    PortName = "Chaincode"
    EventsPort       PortName = "Events"
    HostPort         PortName = "HostPort"
    ListenPort       PortName = "Listen"
    ProfilePort      PortName = "Profile"
    OperationsPort   PortName = "Operations"
    AdminServicePort PortName = "AdminService"
    ClusterPort      PortName = "Cluster"
)

func BrokerPortNames

func BrokerPortNames() []PortName

BrokerPortNames returns the list of ports that need to be reserved for a Kafka broker.

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 Ports

type Ports map[PortName]uint16

type Profile

A profile encapsulates basic information for a configtxgen profile.

type Profile struct {
    Name          string   `yaml:"name,omitempty"`
    Orderers      []string `yaml:"orderers,omitempty"`
    Consortium    string   `yaml:"consortium,omitempty"`
    Organizations []string `yaml:"organizations,omitempty"`
}

type SystemChannel

The SystemChannel declares the name of the network system channel and its associated configtxgen profile name.

type SystemChannel struct {
    Name    string `yaml:"name,omitempty"`
    Profile string `yaml:"profile,omitempty"`
}

type Templates

Templates can be used to provide custom templates to GenerateConfigTree.

type Templates struct {
    ConfigTx string `yaml:"configtx,omitempty"`
    Core     string `yaml:"core,omitempty"`
    Crypto   string `yaml:"crypto,omitempty"`
    Orderer  string `yaml:"orderer,omitempty"`
}

func (*Templates) ConfigTxTemplate

func (t *Templates) ConfigTxTemplate() string

func (*Templates) CoreTemplate

func (t *Templates) CoreTemplate() string

func (*Templates) CryptoTemplate

func (t *Templates) CryptoTemplate() string

func (*Templates) OrdererTemplate

func (t *Templates) OrdererTemplate() string

type WorkingDirer

type WorkingDirer interface {
    WorkingDir() string
}

Subdirectories

Name Synopsis
..
commands
fabricconfig