Skip to content

Latest commit

 

History

History
1502 lines (986 loc) · 107 KB

DOCUMENTATION.md

File metadata and controls

1502 lines (986 loc) · 107 KB

Table of Contents

Main

fcw

Creates a new object for issuing chaincode transactions or listening for chaincode events

Parameters

  • userClient UserClient The UserClient representing the user performing chaincode transactions
  • channel Channel The Channel object representing the channel to transact on
  • chaincodeId string The ID of the chaincode being transacted on
  • peersOrPolicy (Array<Peer> | Policy)? An array of peers to transact with or the endorsement policy to select peers with

Properties

  • UserClient UserClient Class representing a user and also a wrapper over FabricClient
  • upgradePeerToFcwPeer upgradePeerToFcwPeer Upgrades a fabric-client Peer with additional MSP information
  • newFcwPeer newFcwPeer Creates a fabric-clietn Peer with additional MSP information
  • isFcwPeer isFcwPeer Checks whether an object is a FcwPeer
  • upgradeFcwPeerToEventHubPeer upgradeFcwPeerToEventHubPeer Upgrades a FcwPeer with an EventHubManager
  • upgradePeerToEventHubPeer upgradePeerToEventHubPeer Upgrades a fabric-client Peer with additional MSP information and an EventHubManager
  • newEventHubPeer newEventHubPeer Creates a fabric-client Peer with additional MSP information and an EventHubManager
  • isEventHubPeer isEventHubPeer Checks whether an object is an EventHubPeer
  • upgradeChannelToFcwChannel upgradeChannelToFcwChannel Upgrades a fabric-client Channel to keep track of recent transactions
  • newFcwChannel newFcwChannel Creates a fabric-client Channel that keeps track of recent transactions
  • isFcwChannel isFcwChannel Checks whether an object is a FcwChannel
  • newFileKeyValueStoreAndCryptoSuite newFileKeyValueStoreAndCryptoSuite Creates a new file based key-value store and the associated cryptoSuite
  • newCouchDBKeyValueStoreAndCryptoSuite newCouchDBKeyValueStoreAndCryptoSuite Creates a new CouchDB based key-value and the associated cryptoSuite
  • newUserClientFromKeys newUserClientFromKeys Creates a new UserClient from a public private key pair
  • newUserClientFromCAEnroll newUserClientFromCAEnroll Creates a new UserClient from enrolling in the CA
  • newUserClientFromCARegisterAndEnroll newUserClientFromCARegisterAndEnroll Creates a new UserClient from registering and enrolling in the CA
  • newUserClientFromStore newUserClientFromStore Creates a new UserClient from the key value store
  • pickPeersForPolicy pickPeersForPolicy Picks peers from a larger set that satisfy an endorsement policy
  • ADMIN_ROLE string The string 'admin'
  • CA_ADMIN_ROLE string The string 'ca_admin'
  • MEMBER_ROLE string The string 'member'

Returns Transactor The new object for interacting with the chaincode

setupChannel

creates an object for building and running channel setup requests

Parameters

  • userClient The UserClient representing the user setting up the channel
  • channelOrChannelName
  • opts Additional options
    • opts.swallowAlreadyCreatedErrors boolean? Option to swallow errors about channel being already created/joined or chaincode being installed/instantiated
    • opts.network Network options
      • opts.network.leader boolean? Whether to be the network leader (the server)
      • opts.network.mspIds Array<string>? The MSP IDs that the org represents, only required for non-leaders
      • opts.network.externalMspIds Array<string>? The MSP IDs of external organisations. Is optional and is only used by leader
      • opts.network.host string? The host of the server. Is optional and is only used by non-leaders.
      • opts.network.port string The port to communicate on. (optional, default 45207)
      • opts.network.timeout number? The maximum amount of time to wait between various stages of the network setup phase
      • opts.network.onError Function? Callback function for socket errors
  • channelOrChannelOpts Either the channel object you wish to use or the arguments to create a new channel

Returns Promise<Channel> The setup channel

ChannelSetup

Class for building and running channel setup requests

Parameters

  • userClient UserClient The UserClient representing the user setting up the channel
  • channelOrChannelOpts (Channel | ChannelOpts) Either the EventHubChannel object you wish to use or the arguments to create a new EventHubChannel
  • opts any Additional options[swallowAlreadyCreatedErrors]
    • opts.swallowAlreadyCreatedErrors boolean? Option to swallow errors about channel being already created/joined or chaincode being installed/instantiated
    • opts.network Network options
      • opts.network.leader boolean? Whether to be the network leader (the server)
      • opts.network.mspIds Array<string>? The MSP IDs that the org represents, only required for non-leaders
      • opts.network.externalMspIds Array<string>? The MSP IDs of external organisations. Is optional and is only used by leader
      • opts.network.host string? The host of the server. Is optional and is only used by non-leaders.
      • opts.network.port string The port to communicate on. (optional, default 45207)
      • opts.network.timeout number The maximum amount of time to wait between various stages of the network setup phase (optional, default 600000)
      • opts.network.onError Function? Callback function for socket errors

withCreateChannel

Adds a createChannel operation to the builder

Parameters

  • createChannelRequest CreateChannelRequest The options for creating a channel on the network
    • createChannelRequest.channelEnvelope Array<byte>? The envelope for the new channel, required if no config is specified
    • createChannelRequest.channelConfig Array<byte>? The configuration for the new channel, required if no envelope is specified
    • createChannelRequest.signatures Array<ConfigSignature>? The signatures required for the new chanel, required if no envelope is specified
    • createChannelRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
  • opts any Additional options
    • opts.waitOpts Options for waiting
      • opts.waitOpts.timeout number? Max amount of time to wait
      • opts.waitOpts.pollInterval number? Amount of time to wait between retries
    • opts.swallowAlreadyCreatedErrors boolean? Option to swallow errors about channel being already created. Overrides class level option

Returns ChannelSetup The ChannelSetup instance

withJoinChannel

Adds a joinChannel operation to the builder

Parameters

  • joinChannelRequest JoinChannelRequest The options for joining the channel on the network
    • joinChannelRequest.targets Array<(Peer | FcwPeer | EventHubPeer)>? An array of Peer objects or Peer names that will be asked to join this channel.
    • joinChannelRequest.genesisBlock Block? The genesis block for the channel
    • joinChannelRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
  • opts any Additional options
    • opts.timeout number The maximum number of ms to wait for the channel to be joined (optional, default 60000)
    • opts.waitOpts Options for waiting
      • opts.waitOpts.timeout number? Max amount of time to wait
      • opts.waitOpts.pollInterval number? Amount of time to wait between retries
    • opts.swallowAlreadyCreatedErrors boolean? Option to swallow errors about channel being already joined. Overrides class level option

Returns ChannelSetup The ChannelSetup instance

withUpdateChannel

Adds an updateChannel operation to the builder

Parameters

  • updateChannelRequest CreateChannelRequest The options for updating a channel on the network
    • updateChannelRequest.channelEnvelope Array<byte>? The envelope for the new channel, required if no config is specified
    • updateChannelRequest.channelConfig Array<byte>? The configuration for the new channel, required if no envelope is specified
    • updateChannelRequest.signatures Array<ConfigSignature>? The signatures required for the new chanel, required if no envelope is specified
    • updateChannelRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
  • opts any Additional options
    • opts.waitOpts Options for waiting
      • opts.waitOpts.timeout number? Max amount of time to wait
      • opts.waitOpts.pollInterval number? Amount of time to wait between retries

Returns ChannelSetup The ChannelSetup instance

withInstallChaincode

Adds an installChaincode operation to the builder

Parameters

  • chaincodeInstallRequest ReducedChaincodeInstallRequest The options for installing chaincode on peers.
    • chaincodeInstallRequest.targets Array<Peer>? An array of Peer objects that the chaincode will be installed on. Uses peers from channel if none are supplied
    • chaincodeInstallRequest.chaincodePath string The path to the location of the source code of the chaincode. If the chaincode type is golang, then this path is the fully qualified package name, such as 'mycompany.com/myproject/mypackage/mychaincode'
    • chaincodeInstallRequest.chaincodeId string Name of the chaincode
    • chaincodeInstallRequest.chaincodeVersion string Version string of the chaincode, such as 'v1'
    • chaincodeInstallRequest.chaincodePackage string? Byte array of the archive content for the chaincode source. The archive must have a 'src' folder containing subfolders corresponding to the 'chaincodePath' field. For instance, if the chaincodePath is 'mycompany.com/myproject/mypackage/mychaincode', then the archive must contain a folder 'src/mycompany.com/myproject/mypackage/mychaincode', where the GO source code resides.
    • chaincodeInstallRequest.chaincodeType string? Type of chaincode. One of 'golang', 'car' or 'java'. Default is 'golang'. Note that 'java' is not supported as of v1.0.
  • opts any Additional options
    • opts.timeout number? The max amount of time the chaincode installing can take
    • opts.swallowAlreadyCreatedErrors boolean? Option to swallow errors about chaincode being already installed. Overrides class level option

Returns ChannelSetup The ChannelSetup instance

withInstantiateChaincode

Adds an instantiateChaincode operation to the builder

Parameters

  • chaincodeInstantiateRequest FcwChaincodeInstantiateUpgradeRequest The chaincode instantiation request to be made
    • chaincodeInstantiateRequest.targets (Array<Peer> | Policy)? An array of Peer objects that are used to satisfy the instantiation policy or a policy used to select peers from the channel. If targets is not specified Defaults to channel peers if not specified
    • chaincodeInstantiateRequest.chaincodeId string Name of the chaincode
    • chaincodeInstantiateRequest.chaincodeVersion string Version string of the chaincode, such as 'v1'
    • chaincodeInstantiateRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • chaincodeInstantiateRequest.chaincodeType string? Type of chaincode. One of 'golang', 'car' or 'java'. Default is 'golang'. Note that 'java' is not supported as of v1.0.
    • chaincodeInstantiateRequest.transientMap Map? Map that can be used by the chaincode during intialization, but not saved in the ledger. Data such as cryptographic information for encryption can be passed to the chaincode using this technique
    • chaincodeInstantiateRequest.fcn string? The function name to be returned when calling stub.GetFunctionAndParameters() in the target chaincode. Default is 'init'
    • chaincodeInstantiateRequest.args Array<string>? Array of string arguments to pass to the function identified by the fcn value
    • chaincodeInstantiateRequest.endorsement-policy Policy? EndorsementPolicy object for this chaincode (see examples below). If not specified, a default policy of "a signature by any member from any of the organizations corresponding to the array of member service providers" is used. WARNING: The default policy is NOT recommended for production, because this allows an application to bypass the proposal endorsement and send a manually constructed transaction, with arbitrary output in the write set, to the orderer directly. An application's own signature would allow the transaction to be successfully validated and committed to the ledger.
  • opts any Additional options
    • opts.timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 600000)
    • opts.waitOpts Options for waiting
      • opts.waitOpts.timeout number? Max amount of time to wait
      • opts.waitOpts.pollInterval number? Amount of time to wait between retries
    • opts.swallowAlreadyCreatedErrors boolean? Option to swallow errors about chaincode being already instantiated. Overrides class level option

Returns ChannelSetup The ChannelSetup instance

withUpgradeChaincode

Adds an upgradeChaincode operation to the builder

Parameters

  • chaincodeUpgradeRequest FcwChaincodeInstantiateUpgradeRequest The chaincode upgrade request to be made
    • chaincodeUpgradeRequest.chaincodeId string Name of the chaincode
    • chaincodeUpgradeRequest.chaincodeVersion string Version string of the chaincode, such as 'v1'
    • chaincodeUpgradeRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • chaincodeUpgradeRequest.chaincodeType string? Type of chaincode. One of 'golang', 'car' or 'java'. Default is 'golang'. Note that 'java' is not supported as of v1.0.
    • chaincodeUpgradeRequest.transientMap Map? Map that can be used by the chaincode during intialization, but not saved in the ledger. Data such as cryptographic information for encryption can be passed to the chaincode using this technique
    • chaincodeUpgradeRequest.fcn string? The function name to be returned when calling stub.GetFunctionAndParameters() in the target chaincode. Default is 'init'
    • chaincodeUpgradeRequest.args Array<string>? Array of string arguments to pass to the function identified by the fcn value
    • chaincodeUpgradeRequest.endorsement-policy Policy? EndorsementPolicy object for this chaincode (see examples below). If not specified, a default policy of "a signature by any member from any of the organizations corresponding to the array of member service providers" is used. WARNING: The default policy is NOT recommended for production, because this allows an application to bypass the proposal endorsement and send a manually constructed transaction, with arbitrary output in the write set, to the orderer directly. An application's own signature would allow the transaction to be successfully validated and committed to the ledger.
  • opts any Additional options
    • opts.timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 600000)
    • opts.waitOpts Options for waiting
      • opts.waitOpts.timeout number? Max amount of time to wait
      • opts.waitOpts.pollInterval number? Amount of time to wait between retries

Returns ChannelSetup The ChannelSetup instance

run

Sends the request that has been built

Returns Promise<Channel> The channel instance that has been setup

Transactor

Class for issuing chaincode transactions Creates a new object for issuing chaincode transactions or listening for chaincode events

Parameters

  • userClient UserClient The UserClient representing the user performing chaincode transactions
  • channel Channel The Channel object representing the channel to transact on
  • chaincodeId string The ID of the chaincode being transacted on
  • defaultTargets (Array<Peer> | Policy) An array of peers to transact with or the endorsement policy to select peers with
  • queryPeer Peer The peer you wish to use by default for queries

setPeers

Updates the endorsing peers that are used

Parameters

  • targets (Array<Peer> | Policy) An array of peers to transact with or the endorsement policy to select peers with

Returns void

getUserClient

Gets the UserClient

Returns UserClient

getChannel

Gets the channel

Returns Channel

getChaincodeId

Gets the chaincode ID

Returns string

getEndorsingPeers

Gets the endorsingPeers

Returns Array<Peer>?

query

Performs a chaincode transaction proposal and formats the response

Parameters

  • fcn string The function name to be returned when calling stub.GetFunctionAndParameters() in the target chaincode. Default is 'invoke'
  • argsOrArgBytes (Array<string> | Buffer)
  • opts any The options for the query
    • opts.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • opts.transientMap Map? Map that can be used by the chaincode but not saved in the ledger, such as cryptographic information for encryption
    • opts.target Peer? The peer to use for the transaction proposal, falls back to the first peer in the channel if unspecified
    • opts.timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)
  • args An array of string arguments or a buffer specific to the chaincode's 'Invoke' method

Returns Promise<QueryChaincodeResponse> A promise containing formatted transactionProposal response from a single peer

invoke

Performs a chaincode invoke

Parameters

  • fcn string The function name to be returned when calling stub.GetFunctionAndParameters() in the target chaincode. Default is 'invoke'
  • argsOrArgBytes (Array<string> | Buffer)
  • opts any The options for the invoke
    • opts.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • opts.transientMap Map? Map that can be used by the chaincode but not saved in the ledger, such as cryptographic information for encryption
    • opts.targets (Array<Peer> | Policy)? The peers to use for the transaction proposal or endorsement policy for the chaincode, falls back to the peers in the channel if unspecified
    • opts.timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)
    • opts.waitOpts
  • args An array of string arguments or a buffer specific to the chaincode's 'Invoke' method

Returns Promise<InvokeChaincodeResponse> A promise containing an object that contains information about the invoke

sendTransactionProposal

Performs a chaincode transaction proposal

Parameters

  • fcn string The function name to be returned when calling stub.GetFunctionAndParameters() in the target chaincode. Default is 'invoke'
  • argsOrArgBytes (Array<string> | Buffer) An array of string arguments or a buffer specific to the chaincode's 'Invoke' method
  • opts any The options for the transaction proposal
    • opts.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • opts.transientMap Map? Map that can be used by the chaincode but not saved in the ledger, such as cryptographic information for encryption
    • opts.targets (Array<Peer> | Policy)? The peers to use for the transaction proposal or endorsement policy for the chaincode, falls back to the peers in the channel if unspecified
    • opts.timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)

Returns Promise<SendTransactionProposalResponse> A promise containing a transactionProposal response from all the peers

sendTransaction

Performs a chaincode transaction

Parameters

  • transactionId string The id of the transaction
  • transactionRequest TransactionRequest an object representing an transaction request
  • waitOpts WaitOpts

Returns Promise<SendTransactionResponse> A promise containing an object that contains information about the transaction

registerChaincodeEventListener

Registers a chaincode event listener. Note this is not channel specific!

Parameters

  • eventName string The name of the event to listen on
  • onEvent Function Callback function for matched events. It gets passed a single parameter which is a ChaincodeEvent object
  • onError Function Callback function to be notified when this event hub is shutdown. The shutdown may be caused by a network error or by a call to the "disconnect()" method or a connection error.

Returns {eventHubManager: EventHubManager, handle: Object} eventHubManager and handle

UserClient

Class representing a user and also a wrapper over FabricClient

Parameters

  • opts any The options for creating a UserClient
    • opts.client FabricClient The FabricClient object to wrap
    • opts.mspId string The MSP ID of the organisation the user is attached to
    • opts.cryptoSuite CryptoSuite The cryptoSuite for the user
    • opts.store KeyValueStore? The store which the user's credentials are stored in
    • opts.fabricCAClient FabricCAClient? The FabricCAClient to use for registering users
    • opts.enrollmentSecret string? The enrollment secret for the user
    • opts.roles Array<string>? The set of roles for the user

getClient

Gets the underlying FabricClient instance

Returns FabricClient

getMspId

Gets the mspId for the user's organisation

Returns string

getCryptoSuite

Gets the cryptoSuite for the user

Returns CryptoSuite

getStore

Gets the store for the user

Returns KeyValueStore

getUsername

Gets the username of the user

Returns string

getRoles

Gets the roles of the user

Returns Array<string>

setRoles

Sets the roles of the user, also saves user to store

Parameters

getFabricCAClient

Gets the FabricCAClient for the user

Returns FabricCAClient

setFabricCAClient

Sets the FabricCAClient for the user

Parameters

  • fabricCAClient FabricCAClient The FabricCAClient for the CA the user is associated with

getEnrollmentSecret

Gets the enrollment secret for the user

Returns string?

setEnrollmentSecret

Sets the Enrollment secret for the user

Parameters

  • enrollmentSecret string The FabricCAClient for the CA the user is associated with

newEventHubPeer

Creates an EventHubPeer object

Parameters

  • opts {requestUrl: string, eventUrl: string, peerOpts: ConnectionOpts, eventHubOpts: ConnectionOpts, role: (string | void)}
  • requestUrl the peer url to make requests to
  • eventUrl the peer url to listen to for events
  • connectionOpts ReducedConnectionOpts The options for connecting to the peers request url
    • connectionOpts.request-timeout number? An integer value in milliseconds to be used as maximum amount of time to wait on the request to respond.
    • connectionOpts.pem string The certificate file, in PEM format, to use with the gRPC protocol (that is, with TransportCredentials). Required when using the grpcs protocol.
    • connectionOpts.ssl-target-name-override string Used in test environment only, when the server certificate's hostname (in the 'CN' field) does not match the actual host endpoint that the server process runs at, the application can work around the client TLS verify failure by setting this property to the value of the server certificate's hostname
    • connectionOpts.null any - ANY OTHER PROPERTY. Any other standard grpc call options will be passed to the grpc service calls directly

Returns Peer a new EventHubPeer instance

registerUserInCA

This method registers a new user in the CA, requires an admin of the CA

Parameters

Returns Promise<string> The enrollment secret to use when this user enrolls

extractChannelConfig

Extracts the protobuf 'ConfigUpdate' object out of the 'ConfigEnvelope' object that is produced by the configtxgen tool. The returned object may then be signed using the signChannelConfig() method of this class. Once the all signatures have been collected, the 'ConfigUpdate' object and the signatures may be used on the createChannel() or updateChannel() calls.

Parameters

  • channelEnvelope Array<byte> The encoded bytes of the ConfigEnvelope protobuf

Returns Array<byte> Channel Config object

signChannelConfig

Channel configuration updates can be sent to the orderers to be processed. The orderer enforces the Channel creation or update policies such that the updates will be made only when enough signatures from participating organizations are discovered in the request. Typically channel creation or update requests must be signed by participating organizations' ADMIN principals, although this policy can be customized when the consortium is defined. This method uses the client instance's current signing identity to sign over the configuration bytes passed in, and returns the signature that is ready to be included in the configuration update protobuf message to send to the orderer.

Parameters

  • channelConfig Array<byte> The channel configuration to sign

Returns ConfigSignature The signature of the user on the config bytes

newTransactionID

Returns a new TransactionID object. Fabric transaction ids are constructed as a hash of a nonce concatenated with the signing identity's serialized bytes. The TransactionID object keeps the nonce and the resulting id string bundled together as a coherent pair.

Returns TransactionID

queryChannels

Queries the target peer for the names of all the channels that a peer has joined.

Parameters

queryInstalledChaincodes

Queries the installed chaincodes on a peer.

Parameters

queryChannelInfo

Queries for various useful information on the state of the Channel (height, known peers).

Parameters

queryInstantiatedChaincodes

Queries the ledger on the target peer for instantiated chaincodes on this channel.

Parameters

queryTransaction

Queries the ledger on the target peer for Transaction by id.

Parameters

isChaincodeInstalled

Returns whether a chaincode has been installed on all supplied peers owned by the clients organization

Parameters

isChannelCreated

Returns whether a channel has been created

Parameters

Returns Promise<boolean>

isChannelJoined

Returns whether a channel has been joined by all peers owned by the clients organization in the channel object

Parameters

Returns Promise<boolean>

isChaincodeInstantiated

Returns whether a chaincode has been instantiated on a channel

Parameters

Returns Promise<boolean>

bindChannel

Creates a channel instance bound to the user

Parameters

  • channel Channel the channel object to use

Returns Channel The new bound channel instance

getChannelGenesisBlock

Gets the genesis block for the channel

Parameters

  • channel Channel The channel object to use

initializeChannel

Initializes a channel

Parameters

  • channel Channel The channel object to use

createChannel

Calls the orderer to start building the new channel. A channel typically has more than one participating organizations. To create a new channel, one of the participating organizations should call this method to submit the creation request to the orderer service. Once the channel is successfully created by the orderer, the next step is to have each organization's peer nodes join the channel, by sending the channel configuration to each of the peer nodes. The step is accomplished by calling the joinChannel() method.

Parameters

  • channel Channel The channel object to users
  • createChannelRequest any The options for building a new channel on the network
    • createChannelRequest.envelope Array<byte>? The envelope for the new channel, required if no config is specified
    • createChannelRequest.config Array<byte>? The configuration for the new channel, required if no envelope is specified
    • createChannelRequest.signatures Array<ConfigSignature>? The signatures required for the new channel, required if no envelope is specified
    • createChannelRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied

Returns Promise<{data: Object, wait: WaitCreateChannel}> Promise containing the status of the create channel order, note that the wait function returns the genesis block

updateChannel

Calls the orderer to update an existing channel. After the channel updates are successfully processed by the orderer, the orderer cuts a new block containing the new channel configuration and delivers it to all the participating peers in the channel.

Parameters

  • channel Channel The channel object to users
  • updateChannelRequest any The options for updating a channel on the network
    • updateChannelRequest.envelope Array<byte>? The envelope for the updated channel, required if no config is specified
    • updateChannelRequest.config Array<byte>? The configuration for the updated channel, required if no envelope is specified
    • updateChannelRequest.signatures Array<ConfigSignature>? The signatures required for the updated channel, required if no envelope is specified
    • updateChannelRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
  • waitOpts any The options for the wait function
    • waitOpts.disable boolean Disables wait function. Enable if you do not want to listen to peers for confirmation (optional, default false)
    • waitOpts.timeout number Max time to wait for peers (optional, default 60000)
    • waitOpts.targets Array<Peer>? The peers to use, defaults to peers used for the function the wait is attached to

Returns Promise<{data: Object, wait: WaitSimple}> Promise containing the status of the update channel order

joinChannel

This method sends a join channel proposal to one or more endorsing peers.

Parameters

  • channel Channel The channel object to use
  • joinChannelRequest any The options for joining the channel
    • joinChannelRequest.targets Array<Peer>? An array of Peer objects or Peer names that will be asked to join this channel.
    • joinChannelRequest.genesisBlock Block? The genesis block for the channel
    • joinChannelRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
  • timeout number? A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. This overrides the default timeout of the Peer instance and the global timeout in the config settings.

Returns Promise<{data: Array<ProposalResponse>, wait: WaitTimeout}> a promise containing an array of proposal response objects

installChaincode

In fabric v1.0, a chaincode must be installed and instantiated before it can be called to process transactions. Chaincode installation is simply uploading the chaincode source and dependencies to the peers. This operation is "channel-agnostic" and is performed on a peer-by-peer basis. Only the peer organization's ADMIN identities are allowed to perform this operation.

Parameters

  • chaincodeInstallRequest ChaincodeInstallRequest The chaincode install request to be made
    • chaincodeInstallRequest.targets Array<Peer> An array of Peer objects that the chaincode will be installed on
    • chaincodeInstallRequest.chaincodePath string The path to the location of the source code of the chaincode. If the chaincode type is golang, then this path is the fully qualified package name, such as 'mycompany.com/myproject/mypackage/mychaincode'
    • chaincodeInstallRequest.chaincodeId string Name of the chaincode
    • chaincodeInstallRequest.chaincodeVersion string Version string of the chaincode, such as 'v1'
    • chaincodeInstallRequest.chaincodePackage string? Byte array of the archive content for the chaincode source. The archive must have a 'src' folder containing subfolders corresponding to the 'chaincodePath' field. For instance, if the chaincodePath is 'mycompany.com/myproject/mypackage/mychaincode', then the archive must contain a folder 'src/mycompany.com/myproject/mypackage/mychaincode', where the GO source code resides.
    • chaincodeInstallRequest.chaincodeType string? Type of chaincode. One of 'golang', 'car' or 'java'. Default is 'golang'. Note that 'java' is not supported as of v1.0.
  • timeout number? A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. This overrides the default timeout of the Peer instance and the global timeout in the config settings.

Returns Promise<{data: ProposalResponseObject}> a promise containing a proposal response object

instantiateChaincode

Sends a chaincode instantiate proposal to one or more endorsing peers. A chaincode must be instantiated on a channel-by-channel basis before it can be used. The chaincode must first be installed on the endorsing peers where this chaincode is expected to run

Parameters

  • channel Channel The channel to use
  • chaincodeInstantiateRequest FcwChaincodeInstantiateUpgradeRequest The chaincode instantiation request to be made
    • chaincodeInstantiateRequest.targets (Array<Peer> | Policy)? An array of Peer objects that are used to satisfy the instantiation policy or a policy used to select peers from the channel. If targets is not specified Defaults to channel peers if not specified
    • chaincodeInstantiateRequest.chaincodeId string Name of the chaincode
    • chaincodeInstantiateRequest.chaincodeVersion string Version string of the chaincode, such as 'v1'
    • chaincodeInstantiateRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • chaincodeInstantiateRequest.chaincodeType string? Type of chaincode. One of 'golang', 'car' or 'java'. Default is 'golang'. Note that 'java' is not supported as of v1.0.
    • chaincodeInstantiateRequest.transientMap Map? Map that can be used by the chaincode during intialization, but not saved in the ledger. Data such as cryptographic information for encryption can be passed to the chaincode using this technique
    • chaincodeInstantiateRequest.fcn string? The function name to be returned when calling stub.GetFunctionAndParameters() in the target chaincode. Default is 'init'
    • chaincodeInstantiateRequest.args Array<string>? Array of string arguments to pass to the function identified by the fcn value
    • chaincodeInstantiateRequest.endorsement-policy Policy? EndorsementPolicy object for this chaincode (see examples below). If not specified, a default policy of "a signature by any member from any of the organizations corresponding to the array of member service providers" is used. WARNING: The default policy is NOT recommended for production, because this allows an application to bypass the proposal endorsement and send a manually constructed transaction, with arbitrary output in the write set, to the orderer directly. An application's own signature would allow the transaction to be successfully validated and committed to the ledger.
  • timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)

Returns Promise<{data: ProposalResponseObject, wait: WaitSendTransaction}> a promise containing a ProposalResponseObject

upgradeChaincode

Sends a chaincode upgrade proposal to one or more endorsing peers. A chaincode must be instantiated on a channel-by-channel basis before it can be used. The chaincode must first be installed on the endorsing peers where this chaincode is expected to run

Parameters

  • channel Channel The channel to use
  • chaincodeUpgradeRequest FcwChaincodeInstantiateUpgradeRequest The chaincode upgrade request to be made
    • chaincodeUpgradeRequest.chaincodeId string Name of the chaincode
    • chaincodeUpgradeRequest.chaincodeVersion string Version string of the chaincode, such as 'v1'
    • chaincodeUpgradeRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • chaincodeUpgradeRequest.chaincodeType string? Type of chaincode. One of 'golang', 'car' or 'java'. Default is 'golang'. Note that 'java' is not supported as of v1.0.
    • chaincodeUpgradeRequest.transientMap Map? Map that can be used by the chaincode during intialization, but not saved in the ledger. Data such as cryptographic information for encryption can be passed to the chaincode using this technique
    • chaincodeUpgradeRequest.fcn string? The function name to be returned when calling stub.GetFunctionAndParameters() in the target chaincode. Default is 'init'
    • chaincodeUpgradeRequest.args Array<string>? Array of string arguments to pass to the function identified by the fcn value
    • chaincodeUpgradeRequest.endorsement-policy Policy? EndorsementPolicy object for this chaincode (see examples below). If not specified, a default policy of "a signature by any member from any of the organizations corresponding to the array of member service providers" is used. WARNING: The default policy is NOT recommended for production, because this allows an application to bypass the proposal endorsement and send a manually constructed transaction, with arbitrary output in the write set, to the orderer directly. An application's own signature would allow the transaction to be successfully validated and committed to the ledger.
  • timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)

Returns Promise<{data: ProposalResponseObject, wait: WaitSendTransaction}> a promise containing a ProposalResponseObject

sendTransactionProposal

Sends a Transaction Proposal to peers in a channel

Parameters

  • channel Channel The channel object to use
  • transactionProposalRequest FcwTransactionProposalRequest The arguments for the transaction proposal request
    • transactionProposalRequest.chaincodeId string The id of the channel
    • transactionProposalRequest.targets (Array<Peer> | Policy)? The peers to use for the transaction proposal or endorsement policy for the chaincode, falls back to the peers in the channel if unspecified
    • transactionProposalRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • transactionProposalRequest.fcn string? The function to be called on the chaincode, defaults to 'invoke'
    • transactionProposalRequest.args Array<string>? The arguments to suppied to the chaincode function
    • transactionProposalRequest.transientMap string? Map that can be used by the chaincode during intialization, but not saved in the ledger. Data such as cryptographic information for encryption can be passed to the chaincode using this technique
  • timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)

Returns Promise<SendTransactionProposalResponse> A promise containing the transaction ID and transaction request objects

sendTransaction

Sends a Transaction to peers in a channel

Parameters

  • channel Channel The channel object to use
  • transactionId string The transaction ID to wait on
  • transactionRequest TransactionRequest An object containing the proposal responses from the peers and the proposal
  • waitOpts WaitOpts

Returns Promise<SendTransactionResponse> A promise containing the response to the transaction

queryChaincode

Sends a Transaction Proposal to a peer in the channel and formats the response

Parameters

  • channel Channel The channel object to use
  • queryChaincodeRequest QueryChaincodeRequest The arguments for the transaction proposal request
    • queryChaincodeRequest.chaincodeId string The id of the channel
    • queryChaincodeRequest.target Peer? The peers to use for the transaction proposal, falls back to the peers in the channel if unspecified
    • queryChaincodeRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • queryChaincodeRequest.fcn string? The function to be called on the chaincode, defaults to 'invoke'
    • queryChaincodeRequest.args Array<string>? The arguments to suppied to the chaincode function
    • queryChaincodeRequest.transientMap string? Map that can be used by the chaincode during intialization, but not saved in the ledger. Data such as cryptographic information for encryption can be passed to the chaincode using this technique
  • timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)

Returns Promise<QueryChaincodeResponse> A formatted proposal response from a single peer

invokeChaincode

Sends a Transaction Proposal to peers in a channel and formats the response

Parameters

  • channel Channel The channel object to use
  • transactionProposalRequest TransactionProposalRequest The arguments for the transaction proposal request
    • transactionProposalRequest.chaincodeId string The id of the channel
    • transactionProposalRequest.targets (Array<Peer> | Policy)? The peers to use for the transaction proposal or endorsement policy for the chaincode, falls back to the peers in the channel if unspecified
    • transactionProposalRequest.txId TransactionID? TransactionID object with the transaction id and nonce. One will be generated automatically if not supplied
    • transactionProposalRequest.fcn string? The function to be called on the chaincode, defaults to 'invoke'
    • transactionProposalRequest.args Array<string>? The arguments to suppied to the chaincode function
    • transactionProposalRequest.transientMap string? Map that can be used by the chaincode during intialization, but not saved in the ledger. Data such as cryptographic information for encryption can be passed to the chaincode using this technique
  • timeout number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. (optional, default 60000)
  • waitOpts WaitOpts

Returns Promise<InvokeChaincodeResponse> An object holding the transaction response, transaction proposal response, and transaction ID

EventHubManager

A class that manages an EventHub and when it is connected

Parameters

  • eventHub EventHub The EventHub to manage

getEventHubManager

Gets the underlying EventHub

Returns EventHub

waitEventHubConnected

Waits until the EventHub has been connected

Parameters

  • timeout number The maximum amount of time to wait for the EventHub to connect (optional, default 60000)

Returns Promise<boolean>

registerBlockEvent

Connects Eventhub if it is not connected and registers a listener to receive all block events from all the channels that the target peer is part of. The listener's "onEvent" callback gets called on the arrival of every block. If the target peer is expected to participate in more than one channel, then care must be taken in the listener's implementation to differentiate blocks from different channels. See the example below on how to accomplish that. An error may be thrown by this call if no "onError" callback is provided and this EventHub has noticed that the connection has not been established. However since the connection establishment is running asynchronously, a register call could be made before this EventHub has been notified of the network issue. The best practice would be to provide an "onError" callback to be notified when this EventHub has an issue.

Parameters

  • onEvent Function Callback function that takes a single parameter of a Block object
  • onError Function Optional callback function to be notified when this event hub is shutdown. The shutdown may be caused by a network error or by a call to the "disconnect()" method or a connection error.
  • onConnectError Function

Returns number

registerChaincodeEvent

Connects Eventhub if it is not connected and registers a listener to receive chaincode events. An error may be thrown by this call if no "onError" callback is provided and this EventHub has noticed that the connection has not been established. However since the connection establishment is running asynchronously, a register call could be made before this EventHub has been notified of the network issue. The best practice would be to provide an "onError" callback to be notified when this EventHub has an issue.

Parameters

  • ccId string Id of the chaincode of interest
  • eventName string The exact name of the chaincode event (must match the name given to the target chaincode's call to stub.SetEvent(name, payload)), or a regex string to match more than one event by this chaincode
  • onEvent Function Callback function for matched events. It gets passed a single parameter which is a ChaincodeEvent object
  • onError Function Optional callback function to be notified when this event hub is shutdown. The shutdown may be caused by a network error or by a call to the "disconnect()" method or a connection error.
  • onConnectError Function

Returns Object

registerTxEvent

Connects Eventhub if it is not connected and register a callback function to receive a notification when the transaction by the given id has been committed into a block. An error may be thrown by this call if no "onError" callback is provided and this EventHub has noticed that the connection has not been established. However since the connection establishment is running asynchronously, a register call could be made before this EventHub has been notified of the network issue. The best practice would be to provide an "onError" callback to be notified when this EventHub has an issue.

Parameters

  • txId string Transaction id string
  • onEvent Function Callback function that takes a parameter of type Transaction, and a string parameter which indicates if the transaction is valid (code = 'VALID'), or not (code string indicating the reason for invalid transaction)
  • onError Function Optional callback function to be notified when this event hub is shutdown. The shutdown may be caused by a network error or by a call to the "disconnect()" method or a connection error.
  • onConnectError Function

Returns string

unregisterBlockEvent

Unregister the block event listener using the block registration number that is returned by the call to the registerBlockEvent() method. If there are no more listeners, it disconnects the EventHub

Parameters

  • handle number block registration number that was returned during registration.

unregisterChaincodeEvent

Unregister the chaincode event listener represented by the listener_handle object returned by the registerChaincodeEvent() method. If there are no more listeners, it disconnects the EventHub

Parameters

  • handle Object The handle object returned from the call to registerChaincodeEvent.

unregisterTxEvent

Unregister transaction event listener for the transaction id. If there are no more listeners, it disconnects the EventHub

Parameters

  • txId string The transaction ID

FcwPeer

Extends Peer

A fabric-client Peer with additional MSP information

Type: Object

getRole

Gets the role of the peer

setRole

Sets the role of the peer

Parameters

  • role string The role of the peer

getMspId

Gets the Peer's organization's MSP ID

getAdminMspIds

Gets an array of MSP ID's for organizations that have admin priviledges over the peer

EventHubPeer

Extends FcwPeer

A fabric-client Peer with additional MSP information and an EventHubManager

Type: Object

getEventHubManager

Gets the Peer's EventHubManager

Returns EventHubManager The Peer's EventHubManager

EventHubChannel

Extends FcwChannel

A fabric-client Channel with additional MSP information and an EventHubManager

Type: Object

getEventHubManager

Gets the Channel's EventHubManager

Returns EventHubManager The Channel's EventHubManager

canConnect

Checks whether the eventHubManager can currently connect

Parameters

  • timeout number (optional, default 60000)

Returns Promise<boolean> true if the channel can connect, false otherwise

upgradePeerToFcwPeer

Upgrades a fabric-client Peer with additional MSP information

Parameters

  • peer Peer
  • opts any The options for upgrading the Peer
    • opts.mspId string The MSP ID of the organization the peer belongs to
    • opts.adminMspIds Array<string>? An Array of MSP ID's for organizations that have admin priviledges over the peer. Defaults to the peer's organization's mspId.
    • opts.role string The role of the Peer. Defaults to member (optional, default 'member')

Returns FcwPeer The FcwPeer

newFcwPeer

Creates a fabric-client Peer with additional MSP information

Parameters

  • opts any The options for creating the FcwPeer
    • opts.requestUrl string The URL to issue requests to the Peer with
    • opts.peerOpts ConnectionOpts The options for connecting to the peer's request url
    • opts.mspId string The MSP ID of the organization the peer belongs to
    • opts.adminMspIds Array<string>? An Array of MSP ID's for organizations that have admin priviledges over the peer. Defaults to the peer's organization's mspId.
    • opts.role string The role of the Peer. Defaults to member (optional, default 'member')

Returns FcwPeer The FcwPeer

isFcwPeer

Checks whether an object is a FcwPeer

Parameters

  • obj any The object to check

Returns boolean true if the object is a FcwPeer, false otherwise

upgradeFcwPeerToEventHubPeer

Upgrades a FcwPeer with an EventHubManager

Parameters

  • fcwPeer Peer
  • opts Object The options for upgrading the FcwPeer or the EventHubManager to use
    • opts.client (FabricClient | UserClient)? The Client/UserClient tied to the user that creates the EventHub
    • opts.eventUrl string? The URL to listen to events from the Peer with
    • opts.eventHubOpts ConnectionOpts? The options for connecting to the peers event url
    • opts.eventHubManager EventHubManager? The eventHubManager to use, required if eventUrl and eventHubOpts aren't specified

Returns EventHubPeer The EventHubPeer

upgradePeerToEventHubPeer

Upgrades a fabric-client Peer with additional MSP information and an EventHubManager

Parameters

  • peer Peer
  • opts EventHubPeerOpts The options for upgrading the Peer
    • opts.mspId string The MSP ID of the organization the peer belongs to
    • opts.adminMspIds Array<string>? An Array of MSP ID's for organizations that have admin priviledges over the peer. Defaults to the peer's organization's mspId.
    • opts.role string The role of the Peer. Defaults to member (optional, default 'member')
    • opts.client (FabricClient | UserClient)? The Client/UserClient tied to the user that creates the EventHub
    • opts.eventUrl string? The URL to listen to events from the Peer with
    • opts.eventHubOpts ConnectionOpts? The options for connecting to the peers event url
    • opts.eventHubManager EventHubManager? The eventHubManager to use, required if eventUrl and eventHubOpts aren't specified

Returns EventHubPeer The EventHubPeer

newEventHubPeer

Creates a fabric-client Peer with additional MSP information and an EventHubManager

Parameters

  • opts NewEventHubPeerOpts The options for creating the EventhHubPeer
    • opts.requestUrl string The URL to issue requests to the Peer with
    • opts.peerOpts ConnectionOpts The options for connecting to the peer's request url
    • opts.mspId string The MSP ID of the organization the peer belongs to
    • opts.role string The role of the Peer. Defaults to member (optional, default 'member')
    • opts.adminMspIds Array<string>? An Array of MSP ID's for organizations that have admin priviledges over the peer. Defaults to the peer's organization's mspId.
    • opts.client (FabricClient | UserClient)? The Client/UserClient tied to the user that creates the EventHub
    • opts.eventUrl string? The URL to listen to events from the Peer with
    • opts.eventHubOpts ConnectionOpts? The options for connecting to the peers event url
    • opts.eventHubManager EventHubManager? The eventHubManager to use, required if eventUrl and eventHubOpts aren't specified

Returns EventHubPeer The EventHubPeer

isEventHubPeer

Checks whether an object is a EventHubPeer

Parameters

  • obj any The object to check

Returns boolean true if the object is a EventHubPeer, false otherwise

upgradeChannelToEventHubChannel

Upgrades a Channel with an EventHubManager

Parameters

Returns EventHubChannel The EventHubChannel

newEventHubChannel

Creates a fabric-client Channel and adds an EventHubManager

Parameters

  • opts any The options for creating the EventhHubChannel
    • opts.client (FabricClient | UserClient) The Client/UserClient tied to the user that creates the EventHub
    • opts.eventUrl string The URL to listen to events from the Channel with
    • opts.eventHubOpts ConnectionOpts The options for connecting to the channels event url
    • opts.requestUrl string The URL to issue requests to the Channel with
    • opts.channelOpts ConnectionOpts The options for connecting to the channel's request url
    • opts.channelName
    • opts.peers
    • opts.orderers
    • opts.eventHubManager

Returns EventHubChannel The EventHubChannel

isEventHubChannel

Checks whether an object is a EventHubChannel

Parameters

  • obj any The object to check

Returns boolean true if the object is a EventHubChannel, false otherwise

newFileKeyValueStoreAndCryptoSuite

Creates a new OrganizationConfig that's based on a file based key value store

Parameters

  • keyValueStorePath string a path that will be used for the key value store

Returns Promise<CryptoStore> an object holding information about a organization

newCouchDBKeyValueStoreAndCryptoSuite

Creates a new OrganizationConfig that's based on a CouchDB key value store

Parameters

  • url string The CouchDB instance url, in the form of http(s)://:@host:port
  • dbName string? Identifies the name of the database to use. (optional, default 'member_db')

Returns Promise<CryptoStore> an object holding information about a organization

newUserClientFromKeys

Creates a new UserClient from a public private key pair

Parameters

  • opts any The options to create the user with
    • opts.username string The username of the user
    • opts.cryptoContent IdentityPEMs The public/private key pair for the user
    • opts.mspId string The MSP ID that the user belongs to
    • opts.cryptoSuite CryptoSuite The CryptoSuite to use to create the user
    • opts.store KeyValueStore? The store to persist the user information in
    • opts.roles Array<string>? An array containing the roles that the user has

Returns Promise<UserClient> A promise containing a new UserClient instance

newUserClientFromCAEnroll

Creates a new UserClient from enrolling in the CA

Parameters

  • opts any The options to create the user with
    • opts.fabricCAClient FabricCAClient The FabricCAClient to use to interact with the CA
    • opts.enrollmentID string The username to enroll with
    • opts.enrollmentSecret string The secret to enroll with
    • opts.username string? The username to use for the user, defaults to enrollmentID
    • opts.mspId string The MSP ID that the user belongs to
    • opts.cryptoSuite CryptoSuite The CryptoSuite to use to create the user
    • opts.store KeyValueStore? The store to persist the user information in
    • opts.roles Array<string>? An array containing the roles that the user has

Returns Promise<UserClient> A promise containing a new UserClient instance

newUserClientFromCARegisterAndEnroll

Creates a new UserClient from registering and enrolling in the CA

Parameters

  • opts any The options to create the user with
    • opts.userClient UserClient The UserClient to register and enroll with
    • opts.mspId string? The MSP ID that the user belongs to. Fallsback to userClient's MSP ID
    • opts.username string? The username to use for the user, defaults to enrollmentID
    • opts.cryptoSuite CryptoSuite The CryptoSuite to use to create the user
    • opts.store KeyValueStore? The store to persist the user information in
    • opts.roles Array<string>? An array containing the roles that the user has
    • opts.registerRequest RegisterRequest The request arguments to register the user with

Returns any A promise containing a new UserClient instance

newUserClientFromStore

Creates a new UserClient from the key value store

Parameters

  • opts any The options to create the user with
    • opts.userClient UserClient? The UserClient to use to retrieve the user.
    • opts.username string The username of the user
    • opts.mspId string The MSP ID that the user belongs to
    • opts.cryptoSuite CryptoSuite? The CryptoSuite to use to create the user. Fallsback to the userClient's CryptoSuite
    • opts.store KeyValueStore? The store to persist the user information in. Fallsback to the userClient's KeyValueStore
    • opts.roles Array<string>? An array containing the roles that the user has
    • opts.cryptoContent IdentityPEMs The public/private key pair for the user

Returns Promise<UserClient> A promise containing a new UserClient instance

pickPeersForPolicy

Picks peers from a larger set that satisfy an endorsement policy

Parameters

  • peers Array<Peer> the larger set of peers to pick from
  • policy Policy the endorsment policy to satisfy

Returns Array<Peer> An array of Peers that satisfy the policy

Objects

NewEventHubChannelOpts

Options to create a EventHubChannel

Type: Object

Properties

  • channelName string The name of the channel
  • client (FabricClient | UserClient)? The client context to use for operations
  • peers Array<Peer>? An array of peers to use for channel operations
  • orderers Array<Orderer> The orderers to use for the channel
  • eventUrl string? The URL to listen to events from the Channel with
  • eventHubOpts ConnectionOpts? The options for connecting to the event url
  • eventHubManager EventHubManager? The eventHubManager to use, required if eventUrl and eventHubOpts aren't specified

CryptoStore

A set of objects and configuration used by/representing the organization

Type: Object

Properties

  • cryptoSuite CryptoSuite An abstraction over crytpographic algorithms
  • store KeyValueStore A key value store used to store user credentials

InvokeChaincodeResponse

Response to an chaincode invoke

Type: {data: {transactionResponse: {status: string}, proposalResponse: {status: number, message: string, payload: Buffer}, transactionId: string}, wait: Function?}

Properties

QueryChaincodeResponse

Response to a chaincode query

Type: {data: {status: number, message: string, payload: Buffer}}

Properties

SendTransactionProposalResponse

Response to sending a chaincode transaction proposal

Type: {data: {txId: TransactionID, transactionRequest: TransactionRequest}}

Properties

SendTransactionResponse

Response to sending a chaincode transaction

Type: {data: {status: string}, wait: Function?}

Properties

WaitSendTransaction

Type: Function

Parameters

  • opts Options for wait function
    • opts.targets Array<Peer>? The peers to use, defaults to peers used for the function the wait is attached to
    • opts.race boolean Option to only wait for a single peer (optional, default false)
    • opts.pollInterval number Time between polls (optional, default 1000)
    • opts.timeout number? Max time to wait for peers. Defaults to 10 Minutes for instantiate/upgrade chaincode operations, 1 minute for all other operations

Returns Promise<any> Resolves once peer(s) have responded

WaitPoll

Type: Function

Parameters

  • opts Options for wait function
    • opts.targets Array<Peer>? The peers to use, defaults to peers used for the function the wait is attached to
    • opts.pollInterval number Time between polls (optional, default 1000)
    • opts.timeout number Max time to wait for peers (optional, default 60000)

Returns any Resolves once peer(s) have responded

WaitEvent

Type: Function

Parameters

  • opts Options for wait function
    • opts.targets Array<Peer>? The peers to use, defaults to peers used for the function the wait is attached to
    • opts.timeout number Max time to wait for peers (optional, default 60000)

Returns any Resolves once peer(s) have responded

WaitSimple

Type: Function

Returns any Resolves once peer(s) have responded

WaitCreateChannel

Type: Function

Parameters

  • opts Options for wait function
    • opts.pollInterval number Time between polls (optional, default 1000)
    • opts.timeout number Max time to wait for peers (optional, default 60000)

Returns any The genesis block of the channel. Resolves once peer(s) have responded

fabric-client (external)

FabricClient

fabric-client FabricClient class see Client

Peer

fabric-client Peer class see Peer

Channel

fabric-client Channel class see Channel

Orderer

fabric-client Orderer class see Orderer

EventHub

fabric-client EventHub class see EventHub

FabricCAClient

fabric-ca-client FabricCAClient class see FabricCAClient

KeyValueStore

fabric-client KeyValueStore object see KeyValueStore

CryptoSuite

fabric-client CryptoSuite object see CryptoSuite

ConnectionOpts

fabric-client ConnectionOpts object see ConnectionOpts

Policy

fabric-client Policy object see the endorsement policy example listed here https://fabric-sdk-node.github.io/global.html#ChaincodeInstantiateUpgradeRequest

IdentityPEMs

fabric-client IdentityPEMs object see IdentityPEMs

ProposalResponse

fabric-client ProposalResponse object see https://fabric-sdk-node.github.io/global.html#ProposalResponse

ProposalResponseObject

fabric-client ProposalResponseObject object see https://fabric-sdk-node.github.io/global.html#ProposalResponseObject

Block

fabric-client Block object see https://fabric-sdk-node.github.io/global.html#Block

TransactionRequest

fabric-client TransactionRequest object see TransactionRequest

RegisterRequest

fabric-ca-client RegisterRequest object see RegisterRequest