Documentation

Index

Constants

View Source
const (
	// V1_1Capability indicates that Fabric 1.1 features are supported
	V1_1Capability = "V1_1"
	// V1_2Capability indicates that Fabric 1.2 features are supported
	V1_2Capability = "V1_2"
)
View Source
const EmptyTransactionID = TransactionID("")

    EmptyTransactionID represents a non-existing transaction (usually due to error).

    View Source
    const SystemChannel = ""

      SystemChannel is the Fabric channel for managaing resources.

      Variables

      This section is empty.

      Functions

      This section is empty.

      Types

      type BalancerType

      type BalancerType string

        BalancerType is the load-balancer type

        const (
        	// RoundRobin (default) chooses endorsers in a round-robin fashion
        	RoundRobin BalancerType = "RoundRobin"
        
        	// Random chooses endorsers randomly
        	Random BalancerType = "Random"
        )

        type BlockEvent

        type BlockEvent struct {
        	// Block is the block that was committed
        	Block *cb.Block
        	// SourceURL specifies the URL of the peer that produced the event
        	SourceURL string
        }

          BlockEvent contains the data for the block event

          type BlockFilter

          type BlockFilter func(block *cb.Block) bool

            BlockFilter is a function that determines whether a Block event should be ignored

            type BlockchainInfoResponse

            type BlockchainInfoResponse struct {
            	BCI      *common.BlockchainInfo
            	Endorser string
            	Status   int32
            }

              BlockchainInfoResponse wraps blockchain info with endorser info

              type CCEvent

              type CCEvent struct {
              	// TxID is the ID of the transaction in which the event was set
              	TxID string
              	// ChaincodeID is the ID of the chaincode that set the event
              	ChaincodeID string
              	// EventName is the name of the chaincode event
              	EventName string
              	// Payload contains the payload of the chaincode event
              	// NOTE: Payload will be nil for filtered events
              	Payload []byte
              	// BlockNumber contains the block number in which the
              	// chaincode event was committed
              	BlockNumber uint64
              	// SourceURL specifies the URL of the peer that produced the event
              	SourceURL string
              }

                CCEvent contains the data for a chaincode event

                type CertKeyPair

                type CertKeyPair struct {
                	Cert []byte
                	Key  []byte
                }

                  CertKeyPair contains the private key and certificate

                  type ChaincodeCall

                  type ChaincodeCall struct {
                  	ID          string
                  	Collections []string
                  }

                    ChaincodeCall contains the ID of the chaincode as well as an optional set of private data collections that may be accessed by the chaincode.

                    type ChaincodeInvokeRequest

                    type ChaincodeInvokeRequest struct {
                    	ChaincodeID  string
                    	Lang         pb.ChaincodeSpec_Type
                    	TransientMap map[string][]byte
                    	Fcn          string
                    	Args         [][]byte
                    	IsInit       bool
                    }

                      ChaincodeInvokeRequest contains the parameters for sending a transaction proposal. nolint: maligned

                      type ChannelCfg

                      type ChannelCfg interface {
                      	ID() string
                      	BlockNumber() uint64
                      	MSPs() []*mspCfg.MSPConfig
                      	AnchorPeers() []*OrgAnchorPeer
                      	Orderers() []string
                      	Versions() *Versions
                      	HasCapability(group ConfigGroupKey, capability string) bool
                      }

                        ChannelCfg contains channel configuration

                        type ChannelConfig

                        type ChannelConfig interface {
                        
                        	// Query channel configuration
                        	Query(reqCtx reqContext.Context) (ChannelCfg, error)
                        
                        	// QueryBlock queries channel configuration block
                        	QueryBlock(reqCtx reqContext.Context) (*common.Block, error)
                        }

                          ChannelConfig allows for interaction with peer regarding channel configuration

                          type ChannelEndpointConfig

                          type ChannelEndpointConfig struct {
                          	// Orderers list of ordering service nodes
                          	Orderers []string
                          	// Peers a list of peer-channels that are part of this organization
                          	// to get the real Peer config object, use the Name field and fetch NetworkConfig.Peers[Name]
                          	Peers map[string]PeerChannelConfig
                          	//Policies list of policies for channel
                          	Policies ChannelPolicies
                          }

                            ChannelEndpointConfig provides the definition of channels for the network

                            type ChannelMembership

                            type ChannelMembership interface {
                            	// Validate if the given ID was issued by the channel's members
                            	Validate(serializedID []byte) error
                            	// Verify the given signature
                            	Verify(serializedID []byte, msg []byte, sig []byte) error
                            	//Check is given MSP is available
                            	ContainsMSP(msp string) bool
                            }

                              ChannelMembership helps identify a channel's members

                              type ChannelPeer

                              type ChannelPeer struct {
                              	PeerChannelConfig
                              	NetworkPeer
                              }

                                ChannelPeer combines channel peer info with raw peerConfig info

                                type ChannelPolicies

                                type ChannelPolicies struct {
                                	//Policy for querying channel block
                                	QueryChannelConfig QueryChannelConfigPolicy
                                	Discovery          DiscoveryPolicy
                                	Selection          SelectionPolicy
                                	EventService       EventServicePolicy
                                }

                                  ChannelPolicies defines list of policies defined for a channel

                                  type ChannelProvider

                                  type ChannelProvider interface {
                                  	ChannelService(ctx ClientContext, channelID string) (ChannelService, error)
                                  }

                                    ChannelProvider supplies Channel related-objects for the named channel.

                                    type ChannelService

                                    type ChannelService interface {
                                    	Config() (ChannelConfig, error)
                                    	EventService(opts ...options.Opt) (EventService, error)
                                    	Membership() (ChannelMembership, error)
                                    	ChannelConfig() (ChannelCfg, error)
                                    	Transactor(reqCtx reqContext.Context) (Transactor, error)
                                    	Discovery() (DiscoveryService, error)
                                    	Selection() (SelectionService, error)
                                    }

                                      ChannelService supplies services related to a channel.

                                      type ClientContext

                                      type ClientContext interface {
                                      	core.Providers
                                      	msp.Providers
                                      	Providers
                                      	msp.SigningIdentity
                                      }

                                        ClientContext contains the client context

                                        type CommManager

                                        type CommManager interface {
                                        	DialContext(ctx reqContext.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
                                        	ReleaseConn(conn *grpc.ClientConn)
                                        }

                                          CommManager enables network communication.

                                          type ConfigGroupKey

                                          type ConfigGroupKey string

                                            ConfigGroupKey is the config group key

                                            const (
                                            	// ChannelGroupKey is the Channel config group key
                                            	ChannelGroupKey ConfigGroupKey = ""
                                            	// OrdererGroupKey is the Orderer config group key
                                            	OrdererGroupKey ConfigGroupKey = "Orderer"
                                            	// ApplicationGroupKey is the Application config group key
                                            	ApplicationGroupKey ConfigGroupKey = "Application"
                                            )

                                            type ConnectionEvent

                                            type ConnectionEvent struct {
                                            	Connected bool
                                            	Err       error
                                            }

                                              ConnectionEvent is sent when the client disconnects from or reconnects to the event server. Connected == true means that the client has connected, whereas Connected == false means that the client has disconnected. In the disconnected case, Err contains the disconnect error.

                                              type DiscoveryPolicy

                                              type DiscoveryPolicy struct {
                                              	MinResponses int
                                              	MaxTargets   int
                                              	RetryOpts    retry.Opts
                                              }

                                                DiscoveryPolicy defines policy for discovery

                                                type DiscoveryService

                                                type DiscoveryService interface {
                                                	GetPeers() ([]Peer, error)
                                                }

                                                  DiscoveryService is used to discover eligible peers on specific channel

                                                  type EnabledDisabled

                                                  type EnabledDisabled string

                                                    EnabledDisabled specifies whether or not a feature is enabled

                                                    const (
                                                    	// Enabled indicates that the feature is enabled.
                                                    	Enabled EnabledDisabled = "Enabled"
                                                    
                                                    	// Disabled indicates that the feature is disabled.
                                                    	Disabled EnabledDisabled = "Disabled"
                                                    )

                                                    type EndpointConfig

                                                    type EndpointConfig interface {
                                                    	Timeout(TimeoutType) time.Duration
                                                    	OrderersConfig() []OrdererConfig
                                                    	OrdererConfig(nameOrURL string) (*OrdererConfig, bool, bool)
                                                    	PeersConfig(org string) ([]PeerConfig, bool)
                                                    	PeerConfig(nameOrURL string) (*PeerConfig, bool)
                                                    	NetworkConfig() *NetworkConfig
                                                    	NetworkPeers() []NetworkPeer
                                                    	ChannelConfig(name string) *ChannelEndpointConfig
                                                    	ChannelPeers(name string) []ChannelPeer
                                                    	ChannelOrderers(name string) []OrdererConfig
                                                    	TLSCACertPool() commtls.CertPool
                                                    	TLSClientCerts() []tls.Certificate
                                                    	CryptoConfigPath() string
                                                    }

                                                      EndpointConfig contains endpoint network configurations

                                                      type ErrorHandler

                                                      type ErrorHandler func(ctxt ClientContext, channelID string, err error)

                                                        ErrorHandler is invoked when an error occurs in one of the services

                                                        type EventClient

                                                        type EventClient interface {
                                                        	EventService
                                                        
                                                        	// Connect connects to the event server.
                                                        	Connect() error
                                                        
                                                        	// Close closes the connection to the event server and releases all resources.
                                                        	// Once this function is invoked the client may no longer be used.
                                                        	Close()
                                                        
                                                        	// CloseIfIdle closes the connection to the event server only if there are no outstanding
                                                        	// registrations.
                                                        	// Returns true if the client was closed. In this case the client may no longer be used.
                                                        	// A return value of false indicates that the client could not be closed since
                                                        	// there was at least one registration.
                                                        	CloseIfIdle() bool
                                                        
                                                        	// TransferRegistrations transfers all registrations into an EventSnapshot.
                                                        	// The registrations are not closed and may be transferred to a new event client.
                                                        	// - close: If true then the client will also be closed
                                                        	TransferRegistrations(close bool) (EventSnapshot, error)
                                                        }

                                                          EventClient is a client that connects to a peer and receives channel events such as block, filtered block, chaincode, and transaction status events.

                                                          type EventService

                                                          type EventService interface {
                                                          	// RegisterBlockEvent registers for block events. If the caller does not have permission
                                                          	// to register for block events then an error is returned.
                                                          	// Note that Unregister must be called when the registration is no longer needed.
                                                          	// - filter is an optional filter that filters out unwanted events. (Note: Only one filter may be specified.)
                                                          	// - Returns the registration and a channel that is used to receive events. The channel
                                                          	//   is closed when Unregister is called.
                                                          	RegisterBlockEvent(filter ...BlockFilter) (Registration, <-chan *BlockEvent, error)
                                                          
                                                          	// RegisterFilteredBlockEvent registers for filtered block events.
                                                          	// Note that Unregister must be called when the registration is no longer needed.
                                                          	// - Returns the registration and a channel that is used to receive events. The channel
                                                          	//   is closed when Unregister is called.
                                                          	RegisterFilteredBlockEvent() (Registration, <-chan *FilteredBlockEvent, error)
                                                          
                                                          	// RegisterChaincodeEvent registers for chaincode events.
                                                          	// Note that Unregister must be called when the registration is no longer needed.
                                                          	// - ccID is the chaincode ID for which events are to be received
                                                          	// - eventFilter is the chaincode event filter (regular expression) for which events are to be received
                                                          	// - Returns the registration and a channel that is used to receive events. The channel
                                                          	//   is closed when Unregister is called.
                                                          	RegisterChaincodeEvent(ccID, eventFilter string) (Registration, <-chan *CCEvent, error)
                                                          
                                                          	// RegisterTxStatusEvent registers for transaction status events.
                                                          	// Note that Unregister must be called when the registration is no longer needed.
                                                          	// - txID is the transaction ID for which events are to be received
                                                          	// - Returns the registration and a channel that is used to receive events. The channel
                                                          	//   is closed when Unregister is called.
                                                          	RegisterTxStatusEvent(txID string) (Registration, <-chan *TxStatusEvent, error)
                                                          
                                                          	// Unregister removes the given registration and closes the event channel.
                                                          	// - reg is the registration handle that was returned from one of the Register functions
                                                          	Unregister(reg Registration)
                                                          }

                                                            EventService is a service that receives events such as block, filtered block, chaincode, and transaction status events.

                                                            type EventServicePolicy

                                                            type EventServicePolicy struct {
                                                            	// ResolverStrategy returns the peer resolver strategy to use when connecting to a peer
                                                            	// Default: MinBlockHeightPeerResolver
                                                            	ResolverStrategy ResolverStrategy
                                                            
                                                            	// Balancer is the balancer to use when choosing a peer to connect to
                                                            	Balancer BalancerType
                                                            
                                                            	// MinBlockHeightResolverMode specifies the behaviour of the MinBlockHeight resolver. Note that this
                                                            	// parameter is used when ResolverStrategy is either MinBlockHeightStrategy or PreferOrgStrategy.
                                                            	// ResolveByThreshold (default): resolves to peers based on block height lag threshold, as specified by BlockHeightLagThreshold.
                                                            	// MinBlockHeightResolverMode: then only the peers with the latest block heights are chosen.
                                                            	MinBlockHeightResolverMode MinBlockHeightResolverMode
                                                            
                                                            	// BlockHeightLagThreshold returns the block height lag threshold. This value is used for choosing a peer
                                                            	// to connect to. If a peer is lagging behind the most up-to-date peer by more than the given number of
                                                            	// blocks then it will be excluded from selection.
                                                            	BlockHeightLagThreshold int
                                                            
                                                            	// PeerMonitor indicates whether or not to enable the peer monitor.
                                                            	PeerMonitor EnabledDisabled
                                                            
                                                            	// ReconnectBlockHeightLagThreshold - if >0 then the event client will disconnect from the peer if the peer's
                                                            	// block height falls behind the specified number of blocks and will reconnect to a better performing peer.
                                                            	// If set to 0 (default) then the peer will not disconnect based on block height.
                                                            	// NOTE: Setting this value too low may cause the event client to disconnect/reconnect too frequently, thereby
                                                            	// affecting performance.
                                                            	ReconnectBlockHeightLagThreshold int
                                                            
                                                            	// PeerMonitorPeriod is the period in which the connected peer is monitored to see if
                                                            	// the event client should disconnect from it and reconnect to another peer.
                                                            	// If set to 0 then the peer will not be monitored and will not be disconnected.
                                                            	PeerMonitorPeriod time.Duration
                                                            }

                                                              EventServicePolicy specifies the policy for the event service

                                                              type EventSnapshot

                                                              type EventSnapshot interface {
                                                              	// LastBlockReceived returns the block number of the last block received at the time
                                                              	// that the snapshot was taken.
                                                              	LastBlockReceived() uint64
                                                              
                                                              	// BlockRegistrations returns the block registrations.
                                                              	BlockRegistrations() []Registration
                                                              
                                                              	// FilteredBlockRegistrations returns the filtered block registrations.
                                                              	FilteredBlockRegistrations() []Registration
                                                              
                                                              	// CCRegistrations returns the chaincode registrations.
                                                              	CCRegistrations() []Registration
                                                              
                                                              	// TxStatusRegistrations returns the transaction status registrations.
                                                              	TxStatusRegistrations() []Registration
                                                              
                                                              	// Closes all registrations
                                                              	Close()
                                                              }

                                                                EventSnapshot contains a snapshot of the event client before it was stopped. The snapshot includes all of the event registrations and the last block received.

                                                                type FilteredBlockEvent

                                                                type FilteredBlockEvent struct {
                                                                	// FilteredBlock contains a filtered version of the block that was committed
                                                                	FilteredBlock *pb.FilteredBlock
                                                                	// SourceURL specifies the URL of the peer that produced the event
                                                                	SourceURL string
                                                                }

                                                                  FilteredBlockEvent contains the data for a filtered block event

                                                                  type InfraProvider

                                                                  type InfraProvider interface {
                                                                  	CreatePeerFromConfig(peerCfg *NetworkPeer) (Peer, error)
                                                                  	CreateOrdererFromConfig(cfg *OrdererConfig) (Orderer, error)
                                                                  	CommManager() CommManager
                                                                  	Close()
                                                                  }

                                                                    InfraProvider enables access to fabric objects such as peer and user based on config or

                                                                    type LocalDiscoveryProvider

                                                                    type LocalDiscoveryProvider interface {
                                                                    	CreateLocalDiscoveryService(mspID string) (DiscoveryService, error)
                                                                    }

                                                                      LocalDiscoveryProvider is used to discover peers in the local MSP

                                                                      type MetricsProvider

                                                                      type MetricsProvider interface {
                                                                      	GetMetrics() *metrics.ClientMetrics
                                                                      }

                                                                        MetricsProvider represents a provider of metrics.

                                                                        type MinBlockHeightResolverMode

                                                                        type MinBlockHeightResolverMode string

                                                                          MinBlockHeightResolverMode specifies the behaviour of the MinBlockHeight resolver strategy.

                                                                          const (
                                                                          	// ResolveByThreshold resolves to peers based on block height lag threshold.
                                                                          	ResolveByThreshold MinBlockHeightResolverMode = "ResolveByThreshold"
                                                                          
                                                                          	// ResolveLatest resolves to peers with the most up-to-date block height
                                                                          	ResolveLatest MinBlockHeightResolverMode = "ResolveLatest"
                                                                          )

                                                                          type NetworkConfig

                                                                          type NetworkConfig struct {
                                                                          	Channels      map[string]ChannelEndpointConfig
                                                                          	Organizations map[string]OrganizationConfig
                                                                          	Orderers      map[string]OrdererConfig
                                                                          	Peers         map[string]PeerConfig
                                                                          }

                                                                            NetworkConfig provides a static definition of endpoint configuration network

                                                                            type NetworkPeer

                                                                            type NetworkPeer struct {
                                                                            	PeerConfig
                                                                            	MSPID      string
                                                                            	Properties map[Property]interface{}
                                                                            }

                                                                              NetworkPeer combines peer info with MSP info

                                                                              type Orderer

                                                                              type Orderer interface {
                                                                              	URL() string
                                                                              	SendBroadcast(ctx reqContext.Context, envelope *SignedEnvelope) (*common.Status, error)
                                                                              	SendDeliver(ctx reqContext.Context, envelope *SignedEnvelope) (chan *common.Block, chan error)
                                                                              }

                                                                                Orderer The Orderer class represents a peer in the target blockchain network to which HFC sends a block of transactions of endorsed proposals requiring ordering.

                                                                                type OrdererConfig

                                                                                type OrdererConfig struct {
                                                                                	URL         string
                                                                                	GRPCOptions map[string]interface{}
                                                                                	TLSCACert   *x509.Certificate
                                                                                }

                                                                                  OrdererConfig defines an orderer configuration

                                                                                  type OrgAnchorPeer

                                                                                  type OrgAnchorPeer struct {
                                                                                  	Org  string
                                                                                  	Host string
                                                                                  	Port int32
                                                                                  }

                                                                                    OrgAnchorPeer contains information about an anchor peer on this channel

                                                                                    type OrganizationConfig

                                                                                    type OrganizationConfig struct {
                                                                                    	MSPID                  string
                                                                                    	CryptoPath             string
                                                                                    	Users                  map[string]CertKeyPair
                                                                                    	Peers                  []string
                                                                                    	CertificateAuthorities []string
                                                                                    }

                                                                                      OrganizationConfig provides the definition of an organization in the network

                                                                                      type Peer

                                                                                      type Peer interface {
                                                                                      	ProposalProcessor
                                                                                      	// MSPID gets the Peer mspID.
                                                                                      	MSPID() string
                                                                                      
                                                                                      	//URL gets the peer address
                                                                                      	URL() string
                                                                                      
                                                                                      	// Properties returns properties of the peer.
                                                                                      	Properties() Properties
                                                                                      }

                                                                                        The Peer class represents a peer in the target blockchain network to which HFC sends endorsement proposals or query requests.

                                                                                        type PeerChannelConfig

                                                                                        type PeerChannelConfig struct {
                                                                                        	EndorsingPeer  bool
                                                                                        	ChaincodeQuery bool
                                                                                        	LedgerQuery    bool
                                                                                        	EventSource    bool
                                                                                        }

                                                                                          PeerChannelConfig defines the peer capabilities

                                                                                          type PeerConfig

                                                                                          type PeerConfig struct {
                                                                                          	URL         string
                                                                                          	GRPCOptions map[string]interface{}
                                                                                          	TLSCACert   *x509.Certificate
                                                                                          }

                                                                                            PeerConfig defines a peer configuration

                                                                                            type PeerState

                                                                                            type PeerState interface {
                                                                                            	BlockHeight() uint64
                                                                                            }

                                                                                              PeerState provides state information about the Peer

                                                                                              type PrioritySelector

                                                                                              type PrioritySelector interface {
                                                                                              	// A positive return value means peer1 is selected
                                                                                              	// A negative return value means the peer2 is selected
                                                                                              	// Zero return value means their priorities are the same
                                                                                              	Compare(peer1, peer2 Peer) int
                                                                                              }

                                                                                                PrioritySelector determines how likely a peer is to be selected over another peer

                                                                                                type ProcessProposalRequest

                                                                                                type ProcessProposalRequest struct {
                                                                                                	SignedProposal *pb.SignedProposal
                                                                                                }

                                                                                                  ProcessProposalRequest requests simulation of a proposed transaction from transaction processors.

                                                                                                  type Properties

                                                                                                  type Properties map[Property]interface{}

                                                                                                    Properties defines the properties of a peer

                                                                                                    type Property

                                                                                                    type Property = string

                                                                                                      Property is the key into the Properties map

                                                                                                      const (
                                                                                                      	// PropertyChaincodes defines the chaincodes that are deployed on the peer. Value type:[]*github.com/hyperledger/fabric-protos-go/gossip.Chaincode
                                                                                                      	PropertyChaincodes Property = "Chaincodes"
                                                                                                      	// PropertyLedgerHeight defines the ledger height property. Value type: uint64
                                                                                                      	PropertyLedgerHeight Property = "LedgerHeight"
                                                                                                      	// PropertyLeftChannel defines the "left-channel" property which indicates whether the peer left the channel. Value type: bool
                                                                                                      	PropertyLeftChannel Property = "LeftChannel"
                                                                                                      )

                                                                                                        Following is a well-known list of properties of a peer, although this list may be extended.

                                                                                                        type ProposalProcessor

                                                                                                        type ProposalProcessor interface {
                                                                                                        	ProcessTransactionProposal(reqContext.Context, ProcessProposalRequest) (*TransactionProposalResponse, error)
                                                                                                        }

                                                                                                          ProposalProcessor simulates transaction proposal, so that a client can submit the result for ordering.

                                                                                                          type ProposalSender

                                                                                                          type ProposalSender interface {
                                                                                                          	CreateTransactionHeader(opts ...TxnHeaderOpt) (TransactionHeader, error)
                                                                                                          	SendTransactionProposal(*TransactionProposal, []ProposalProcessor) ([]*TransactionProposalResponse, error)
                                                                                                          }

                                                                                                            ProposalSender provides the ability for a transaction proposal to be created and sent.

                                                                                                            type Providers

                                                                                                            type Providers interface {
                                                                                                            	LocalDiscoveryProvider() LocalDiscoveryProvider
                                                                                                            	ChannelProvider() ChannelProvider
                                                                                                            	InfraProvider() InfraProvider
                                                                                                            	EndpointConfig() EndpointConfig
                                                                                                            	MetricsProvider
                                                                                                            }

                                                                                                              Providers represents the SDK configured service providers context.

                                                                                                              type QueryChannelConfigPolicy

                                                                                                              type QueryChannelConfigPolicy struct {
                                                                                                              	MinResponses int
                                                                                                              	MaxTargets   int
                                                                                                              	RetryOpts    retry.Opts
                                                                                                              }

                                                                                                                QueryChannelConfigPolicy defines policy for channelConfigBlock

                                                                                                                type Registration

                                                                                                                type Registration interface{}

                                                                                                                  Registration is a handle that is returned from a successful RegisterXXXEvent. This handle should be used in Unregister in order to unregister the event.

                                                                                                                  type ResolverStrategy

                                                                                                                  type ResolverStrategy string

                                                                                                                    ResolverStrategy is the peer resolver type

                                                                                                                    const (
                                                                                                                    	// BalancedStrategy is a peer resolver strategy that chooses peers based on a configured load balancer
                                                                                                                    	BalancedStrategy ResolverStrategy = "Balanced"
                                                                                                                    
                                                                                                                    	// MinBlockHeightStrategy is a peer resolver strategy that chooses the best peer according to a block height lag threshold.
                                                                                                                    	// The maximum block height of all peers is determined and the peers whose block heights are under the maximum height but above
                                                                                                                    	// a provided "lag" threshold are load balanced. The other peers are not considered.
                                                                                                                    	MinBlockHeightStrategy ResolverStrategy = "MinBlockHeight"
                                                                                                                    
                                                                                                                    	// PreferOrgStrategy is a peer resolver strategy that determines which peers are suitable based on block height lag threshold,
                                                                                                                    	// although will prefer the peers in the current org (as long as their block height is above a configured threshold).
                                                                                                                    	// If none of the peers from the current org are suitable then a peer from another org is chosen.
                                                                                                                    	PreferOrgStrategy ResolverStrategy = "PreferOrg"
                                                                                                                    )

                                                                                                                    type SelectionPolicy

                                                                                                                    type SelectionPolicy struct {
                                                                                                                    	// SortingStrategy is the endorser sorting strategy to use
                                                                                                                    	SortingStrategy SelectionSortingStrategy
                                                                                                                    
                                                                                                                    	// BalancerType is the balancer to use in order to load-balance calls to endorsers
                                                                                                                    	Balancer BalancerType
                                                                                                                    
                                                                                                                    	// BlockHeightLagThreshold is the number of blocks from the highest block number of a group of peers
                                                                                                                    	// that a peer can lag behind and still be considered to be up-to-date. These peers will be sorted
                                                                                                                    	// using the given Balancer. If a peer's block height falls behind this threshold then it will be
                                                                                                                    	// demoted to a lower priority list of peers which will be sorted according to block height.
                                                                                                                    	// Note: This property only applies to BlockHeightPriority sorter
                                                                                                                    	BlockHeightLagThreshold int
                                                                                                                    }

                                                                                                                      SelectionPolicy defines policy for selection

                                                                                                                      type SelectionService

                                                                                                                      type SelectionService interface {
                                                                                                                      	// GetEndorsersForChaincode returns a set of peers that should satisfy the endorsement
                                                                                                                      	// policies of all of the given chaincodes.
                                                                                                                      	// A set of options may be provided to the selection service. Note that the type of options
                                                                                                                      	// may vary depending on the specific selection service implementation.
                                                                                                                      	GetEndorsersForChaincode(chaincodes []*ChaincodeCall, opts ...options.Opt) ([]Peer, error)
                                                                                                                      }

                                                                                                                        SelectionService selects peers for endorsement and commit events

                                                                                                                        type SelectionSortingStrategy

                                                                                                                        type SelectionSortingStrategy string

                                                                                                                          SelectionSortingStrategy is the endorser selection sorting strategy

                                                                                                                          const (
                                                                                                                          	// BlockHeightPriority (default) is a load-balancing selection sorting strategy
                                                                                                                          	// which also prioritizes peers at a block height that is above a certain "lag" threshold.
                                                                                                                          	BlockHeightPriority SelectionSortingStrategy = "BlockHeightPriority"
                                                                                                                          
                                                                                                                          	// Balanced is a load-balancing selection sorting strategy
                                                                                                                          	Balanced SelectionSortingStrategy = "Balanced"
                                                                                                                          )

                                                                                                                          type Sender

                                                                                                                          type Sender interface {
                                                                                                                          	CreateTransaction(request TransactionRequest) (*Transaction, error)
                                                                                                                          	SendTransaction(tx *Transaction) (*TransactionResponse, error)
                                                                                                                          }

                                                                                                                            Sender provides the ability for a transaction to be created and sent.

                                                                                                                            TODO: CreateTransaction should be refactored as it is actually a factory method.

                                                                                                                            type SignedEnvelope

                                                                                                                            type SignedEnvelope struct {
                                                                                                                            	Payload   []byte
                                                                                                                            	Signature []byte
                                                                                                                            }

                                                                                                                              A SignedEnvelope can can be sent to an orderer for broadcasting

                                                                                                                              type TargetFilter

                                                                                                                              type TargetFilter interface {
                                                                                                                              	// Accept returns true if peer should be included in the list of target peers
                                                                                                                              	Accept(peer Peer) bool
                                                                                                                              }

                                                                                                                                TargetFilter allows for filtering target peers

                                                                                                                                type TargetSorter

                                                                                                                                type TargetSorter interface {
                                                                                                                                	// Returns the sorted peers
                                                                                                                                	Sort(peers []Peer) []Peer
                                                                                                                                }

                                                                                                                                  TargetSorter allows for sorting target peers

                                                                                                                                  type TimeoutType

                                                                                                                                  type TimeoutType int

                                                                                                                                    TimeoutType enumerates the different types of outgoing connections

                                                                                                                                    const (
                                                                                                                                    	// PeerConnection connection timeout
                                                                                                                                    	PeerConnection TimeoutType = iota
                                                                                                                                    	// EventReg connection timeout
                                                                                                                                    	EventReg
                                                                                                                                    	// Query timeout
                                                                                                                                    	Query
                                                                                                                                    	// Execute timeout
                                                                                                                                    	Execute
                                                                                                                                    	// OrdererConnection orderer connection timeout
                                                                                                                                    	OrdererConnection
                                                                                                                                    	// OrdererResponse orderer response timeout
                                                                                                                                    	OrdererResponse
                                                                                                                                    	// DiscoveryGreylistExpiry discovery Greylist expiration period
                                                                                                                                    	DiscoveryGreylistExpiry
                                                                                                                                    	// ConnectionIdle is the timeout for closing idle connections
                                                                                                                                    	ConnectionIdle
                                                                                                                                    	// CacheSweepInterval is the duration between cache sweeps
                                                                                                                                    	CacheSweepInterval
                                                                                                                                    	// EventServiceIdle is the timeout for closing the event service connection
                                                                                                                                    	EventServiceIdle
                                                                                                                                    	// PeerResponse peer response timeout
                                                                                                                                    	PeerResponse
                                                                                                                                    	// ResMgmt timeout is default overall timeout for all resource management operations
                                                                                                                                    	ResMgmt
                                                                                                                                    	// ChannelConfigRefresh channel configuration refresh interval
                                                                                                                                    	ChannelConfigRefresh
                                                                                                                                    	// ChannelMembershipRefresh channel membership refresh interval
                                                                                                                                    	ChannelMembershipRefresh
                                                                                                                                    	// DiscoveryConnection discovery connection timeout
                                                                                                                                    	DiscoveryConnection
                                                                                                                                    	// DiscoveryResponse discovery response timeout
                                                                                                                                    	DiscoveryResponse
                                                                                                                                    	// DiscoveryServiceRefresh discovery service refresh interval
                                                                                                                                    	DiscoveryServiceRefresh
                                                                                                                                    	// SelectionServiceRefresh selection service refresh interval
                                                                                                                                    	SelectionServiceRefresh
                                                                                                                                    )

                                                                                                                                    type Transaction

                                                                                                                                    type Transaction struct {
                                                                                                                                    	Proposal    *TransactionProposal
                                                                                                                                    	Transaction *pb.Transaction
                                                                                                                                    }

                                                                                                                                      The Transaction object created from an endorsed proposal.

                                                                                                                                      type TransactionHeader

                                                                                                                                      type TransactionHeader interface {
                                                                                                                                      	TransactionID() TransactionID
                                                                                                                                      	Creator() []byte
                                                                                                                                      	Nonce() []byte
                                                                                                                                      	ChannelID() string
                                                                                                                                      }

                                                                                                                                        TransactionHeader provides a handle to transaction metadata.

                                                                                                                                        type TransactionID

                                                                                                                                        type TransactionID string

                                                                                                                                          TransactionID provides the identifier of a Fabric transaction proposal.

                                                                                                                                          type TransactionProposal

                                                                                                                                          type TransactionProposal struct {
                                                                                                                                          	TxnID TransactionID
                                                                                                                                          	*pb.Proposal
                                                                                                                                          }

                                                                                                                                            TransactionProposal contains a marashalled transaction proposal.

                                                                                                                                            type TransactionProposalResponse

                                                                                                                                            type TransactionProposalResponse struct {
                                                                                                                                            	Endorser string
                                                                                                                                            	// Status is the EndorserStatus
                                                                                                                                            	Status int32
                                                                                                                                            	// ChaincodeStatus is the status returned by Chaincode
                                                                                                                                            	ChaincodeStatus int32
                                                                                                                                            	*pb.ProposalResponse
                                                                                                                                            }

                                                                                                                                              TransactionProposalResponse respresents the result of transaction proposal processing.

                                                                                                                                              type TransactionRequest

                                                                                                                                              type TransactionRequest struct {
                                                                                                                                              	Proposal          *TransactionProposal
                                                                                                                                              	ProposalResponses []*TransactionProposalResponse
                                                                                                                                              }

                                                                                                                                                TransactionRequest holds endorsed Transaction Proposals.

                                                                                                                                                type TransactionResponse

                                                                                                                                                type TransactionResponse struct {
                                                                                                                                                	Orderer string
                                                                                                                                                }

                                                                                                                                                  TransactionResponse contains information returned by the orderer.

                                                                                                                                                  type Transactor

                                                                                                                                                  type Transactor interface {
                                                                                                                                                  	Sender
                                                                                                                                                  	ProposalSender
                                                                                                                                                  }

                                                                                                                                                    Transactor supplies methods for sending transaction proposals and transactions.

                                                                                                                                                    type TxStatusEvent

                                                                                                                                                    type TxStatusEvent struct {
                                                                                                                                                    	// TxID is the ID of the transaction in which the event was set
                                                                                                                                                    	TxID string
                                                                                                                                                    	// TxValidationCode is the status code of the commit
                                                                                                                                                    	TxValidationCode pb.TxValidationCode
                                                                                                                                                    	// BlockNumber contains the block number in which the
                                                                                                                                                    	// transaction was committed
                                                                                                                                                    	BlockNumber uint64
                                                                                                                                                    	// SourceURL specifies the URL of the peer that produced the event
                                                                                                                                                    	SourceURL string
                                                                                                                                                    }

                                                                                                                                                      TxStatusEvent contains the data for a transaction status event

                                                                                                                                                      type TxnHeaderOpt

                                                                                                                                                      type TxnHeaderOpt func(*TxnHeaderOptions)

                                                                                                                                                        TxnHeaderOpt is a Transaction Header option

                                                                                                                                                        func WithCreator

                                                                                                                                                        func WithCreator(creator []byte) TxnHeaderOpt

                                                                                                                                                          WithCreator specifies the creator to use when creating the Transaction Header

                                                                                                                                                          func WithNonce

                                                                                                                                                          func WithNonce(nonce []byte) TxnHeaderOpt

                                                                                                                                                            WithNonce specifies the nonce to use when creating the Transaction Header

                                                                                                                                                            type TxnHeaderOptions

                                                                                                                                                            type TxnHeaderOptions struct {
                                                                                                                                                            	Nonce   []byte
                                                                                                                                                            	Creator []byte
                                                                                                                                                            }

                                                                                                                                                              TxnHeaderOptions contains options for creating a Transaction Header

                                                                                                                                                              type Versions

                                                                                                                                                              type Versions struct {
                                                                                                                                                              	ReadSet  *common.ConfigGroup
                                                                                                                                                              	WriteSet *common.ConfigGroup
                                                                                                                                                              	Channel  *common.ConfigGroup
                                                                                                                                                              }

                                                                                                                                                                Versions ...