Documentation ¶
Index ¶
- type Client
- func (c *Client) Channel(id string) fab.Channel
- func (c *Client) Config() config.Config
- func (c *Client) CreateChannel(request fab.CreateChannelRequest) (fab.TransactionID, error)
- func (c *Client) CryptoSuite() apicryptosuite.CryptoSuite
- func (c *Client) ExtractChannelConfig(configEnvelope []byte) ([]byte, error)
- func (c *Client) IdentityContext() fab.IdentityContext
- func (c *Client) InstallChaincode(req fab.InstallChaincodeRequest) ([]*fab.TransactionProposalResponse, string, error)
- func (c *Client) LoadUserFromStateStore(name string) (fab.User, error)
- func (c *Client) NewChannel(name string) (fab.Channel, error)deprecated
- func (c *Client) QueryChannelInfo(name string, peers []fab.Peer) (fab.Channel, error)
- func (c *Client) QueryChannels(peer fab.Peer) (*pb.ChannelQueryResponse, error)
- func (c *Client) QueryInstalledChaincodes(peer fab.Peer) (*pb.ChaincodeQueryResponse, error)
- func (c *Client) SaveUserToStateStore(user fab.User) error
- func (c *Client) SetCryptoSuite(cryptoSuite apicryptosuite.CryptoSuite)deprecated
- func (c *Client) SetIdentityContext(user fab.IdentityContext)
- func (c *Client) SetSigningManager(signingMgr fab.SigningManager)deprecated
- func (c *Client) SetStateStore(stateStore kvstore.KVStore)deprecated
- func (c *Client) SignChannelConfig(config []byte, signer fab.IdentityContext) (*common.ConfigSignature, error)
- func (c *Client) SigningManager() fab.SigningManager
- func (c *Client) StateStore() kvstore.KVStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client enables access to a Fabric network.
func (*Client) CreateChannel ¶
func (c *Client) CreateChannel(request fab.CreateChannelRequest) (fab.TransactionID, error)
CreateChannel ... *
- Calls the orderer to start building the new channel.
- Only one of the application instances needs to call this method.
- Once the channel is successfully created, this and other application
- instances only need to call Channel joinChannel() to participate on the channel.
- @param {Object} request - An object containing the following fields:
- <br>`name` : required - {string} The name of the new channel
- <br>`orderer` : required - {Orderer} object instance representing the
- Orderer to send the create request
- <br>`envelope` : optional - byte[] of the envelope object containing all
- required settings and signatures to initialize this channel.
- This envelope would have been created by the command
- line tool "configtx".
- <br>`config` : optional - {byte[]} Protobuf ConfigUpdate object extracted from
- a ConfigEnvelope created by the ConfigTX tool.
- see extractChannelConfig()
- <br>`signatures` : optional - {ConfigSignature[]} the list of collected signatures
- required by the channel create policy when using the `config` parameter.
- @returns {Result} Result Object with status on the create process.
func (*Client) CryptoSuite ¶
func (c *Client) CryptoSuite() apicryptosuite.CryptoSuite
CryptoSuite is a convenience method for obtaining the CryptoSuite object in use for this client.
func (*Client) ExtractChannelConfig ¶
ExtractChannelConfig ... *
- Extracts the protobuf 'ConfigUpdate' object out of the 'ConfigEnvelope'
- that is produced by the ConfigTX tool. The returned object may then be
- signed using the signChannelConfig() method of this class. Once the all
- signatures have been collected this object and the signatures may be used
- on the updateChannel or createChannel requests.
- @param {byte[]} The bytes of the ConfigEnvelope protopuf
- @returns {byte[]} The bytes of the ConfigUpdate protobuf
func (*Client) IdentityContext ¶
func (c *Client) IdentityContext() fab.IdentityContext
IdentityContext returns the current identity for signing.
func (*Client) InstallChaincode ¶
func (c *Client) InstallChaincode(req fab.InstallChaincodeRequest) ([]*fab.TransactionProposalResponse, string, error)
InstallChaincode sends an install proposal to one or more endorsing peers.
func (*Client) LoadUserFromStateStore ¶
LoadUserFromStateStore ... *
- Restore the state of this member from the key value store (if found). If not found, do nothing.
- @returns {Promise} A Promise for a {User} object upon successful restore, or if the user by the name
- does not exist in the state store, returns null without rejecting the promise
func (*Client) QueryChannelInfo ¶
QueryChannelInfo ...
- This is a network call to the designated Peer(s) to discover the channel information.
- The target Peer(s) must be part of the channel to be able to return the requested information.
- @param {string} name The name of the channel.
- @param {[]Peer} peers Array of target Peers to query.
- @returns {Channel} The channel instance for the name or error if the target Peer(s) does not know
- anything about the channel.
func (*Client) QueryChannels ¶
QueryChannels queries the names of all the channels that a peer has joined.
func (*Client) QueryInstalledChaincodes ¶
QueryInstalledChaincodes queries the installed chaincodes on a peer. Returns the details of all chaincodes installed on a peer.
func (*Client) SaveUserToStateStore ¶
SaveUserToStateStore ...
- Sets an instance of the User class as the security context of this client instance. This user’s credentials (ECert) will be
- used to conduct transactions and queries with the blockchain network. Upon setting the user context, the SDK saves the object
- in a persistence cache if the “state store” has been set on the Client instance. If no state store has been set,
- this cache will not be established and the application is responsible for setting the user context again when the application
- crashed and is recovered.
func (*Client) SetCryptoSuite
deprecated
func (c *Client) SetCryptoSuite(cryptoSuite apicryptosuite.CryptoSuite)
SetCryptoSuite is a convenience method for obtaining the state store object in use for this client.
Deprecated: see fabsdk package.
func (*Client) SetIdentityContext ¶
func (c *Client) SetIdentityContext(user fab.IdentityContext)
SetIdentityContext sets the identity for signing
func (*Client) SetSigningManager
deprecated
func (c *Client) SetSigningManager(signingMgr fab.SigningManager)
SetSigningManager is a convenience method to set signing manager
Deprecated: see fabsdk package.
func (*Client) SetStateStore
deprecated
SetStateStore ...
Deprecated: see fabsdk package.
- The SDK should have a built-in key value store implementation (suggest a file-based implementation to allow easy setup during
- development). But production systems would want a store backed by database for more robust kvstore and clustering,
- so that multiple app instances can share app state via the database (note that this doesn’t necessarily make the app stateful).
- This API makes this pluggable so that different store implementations can be selected by the application.
func (*Client) SignChannelConfig ¶
func (c *Client) SignChannelConfig(config []byte, signer fab.IdentityContext) (*common.ConfigSignature, error)
SignChannelConfig ... *
- Sign a configuration
- @param {byte[]} config - The Configuration Update in byte form
- @return {ConfigSignature} - The signature of the current user on the config bytes
func (*Client) SigningManager ¶
func (c *Client) SigningManager() fab.SigningManager
SigningManager returns the signing manager
func (*Client) StateStore ¶
StateStore is a convenience method for obtaining the state store object in use for this client.
Directories ¶
Path | Synopsis |
---|---|
ccpackager
|
|
Package resource provides access to fabric network resource management, typically using system channel queries.
|
Package resource provides access to fabric network resource management, typically using system channel queries. |
Package txn enables creating, endorsing and sending transactions to Fabric peers and orderers.
|
Package txn enables creating, endorsing and sending transactions to Fabric peers and orderers. |