public class Channel extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Channel.AnchorPeersConfigUpdateResult |
static class |
Channel.DiscoveryOptions
Options for doing service discovery.
|
static class |
Channel.NOfEvents
NofEvents may be used with @see
TransactionOptions#nOfEvents(NOfEvents) to control how reporting Peer service events and Eventhubs will
complete the future acknowledging the transaction has been seen by those Peers. |
static class |
Channel.PeerOptions
Options for the peer.
|
static class |
Channel.SDOPeerDefaultAddition |
static interface |
Channel.SDOrdererAddition |
static interface |
Channel.SDOrdererAdditionInfo |
static class |
Channel.SDOrdererDefaultAddition |
static interface |
Channel.SDPeerAddition |
static interface |
Channel.SDPeerAdditionInfo |
static class |
Channel.ServiceDiscoveryChaincodeCalls
Additional metadata used by service discovery to find the endorsements needed.
|
static class |
Channel.TransactionOptions
TransactionOptions class can be used to change how the SDK processes the Transaction.
|
Modifier and Type | Method and Description |
---|---|
Channel |
addOrderer(Orderer orderer)
Add an Orderer to this channel.
|
Channel |
addPeer(Peer peer)
Add a peer to the channel
|
Channel |
addPeer(Peer peer,
Channel.PeerOptions peerOptions)
Add a peer to the channel
|
Collection<String> |
getBlockListenerHandles() |
byte[] |
getChannelConfigurationBytes() |
byte[] |
getChannelConfigurationBytes(User userContext)
Channel Configuration bytes.
|
byte[] |
getChannelConfigurationBytes(User userContext,
Orderer orderer)
Get channel configuration from a specific Orderer
|
byte[] |
getChannelConfigurationBytes(User userContext,
Peer peer)
Get channel configuration from a specific peer
|
Channel.AnchorPeersConfigUpdateResult |
getConfigUpdateAnchorPeers(Peer peer,
User userContext,
Collection<String> peersToAdd,
Collection<String> peersToRemove)
Get a channel configuration update to add or remove peers.
|
Collection<String> |
getDiscoveredChaincodeNames()
Collection of discovered chaincode names.
|
String |
getName()
Get the channel name
|
Collection<Orderer> |
getOrderers() |
Collection<Orderer> |
getOrderersForOrganization(String mspid)
Get orderers that belong to an organization from the organization's MSPID
These values may not be available till after the channel is initialized.
|
Collection<String> |
getOrderersOrganizationMSPIDs()
Collection of strings which are the MSPIDs of all the orderer organization added.
|
Collection<Peer> |
getPeers()
Get the peers for this channel.
|
Collection<Peer> |
getPeers(EnumSet<Peer.PeerRole> roles)
Get the peers for this channel.
|
Collection<Peer> |
getPeersForOrganization(String mspid)
Get peers that belong to an organization from the organization's MSPID
These values may not be available till after the channel is initialized.
|
Channel.PeerOptions |
getPeersOptions(Peer peer) |
Collection<String> |
getPeersOrganizationMSPIDs()
Collection of strings which are the MSPIDs of all the peer organization added.
|
Channel.SDOrdererAddition |
getSDOrdererAddition()
Get current service discovery orderer addition override.
|
Channel.SDPeerAddition |
getSDPeerAddition()
Get current service discovery peer addition override.
|
Properties |
getServiceDiscoveryProperties() |
byte[] |
getUpdateChannelConfigurationSignature(UpdateChannelConfiguration updateChannelConfiguration,
User signer)
Get signed byes of the update channel.
|
Channel |
initialize()
Initialize the Channel.
|
boolean |
isInitialized()
Is channel initialized.
|
boolean |
isShutdown()
Is the channel shutdown.
|
Channel |
joinPeer(Orderer orderer,
Peer peer,
Channel.PeerOptions peerOptions)
Join peer to channel
|
Channel |
joinPeer(Peer peer)
Join the peer to the channel.
|
Channel |
joinPeer(Peer peer,
Channel.PeerOptions peerOptions) |
Collection<LifecycleQueryChaincodeDefinitionProposalResponse> |
lifecycleQueryChaincodeDefinition(QueryLifecycleQueryChaincodeDefinitionRequest queryLifecycleQueryChaincodeDefinitionRequest,
Collection<Peer> peers)
lifecycleQueryChaincodeDefinition get definition of chaincode.
|
Collection<LifecycleQueryChaincodeDefinitionsProposalResponse> |
lifecycleQueryChaincodeDefinitions(LifecycleQueryChaincodeDefinitionsRequest proposalRequest,
Collection<Peer> peers)
Query namespaces.
|
org.hyperledger.fabric.sdk.transaction.TransactionContext |
newTransactionContext()
Create a new transaction context based on the client user context.
|
BlockInfo |
queryBlockByHash(byte[] blockHash)
query this channel for a Block by the block hash.
|
BlockInfo |
queryBlockByHash(byte[] blockHash,
User userContext)
query this channel for a Block by the block hash.
|
BlockInfo |
queryBlockByHash(Collection<Peer> peers,
byte[] blockHash)
Query a peer in this channel for a Block by the block hash.
|
BlockInfo |
queryBlockByHash(Collection<Peer> peers,
byte[] blockHash,
User userContext)
Query a peer in this channel for a Block by the block hash.
|
BlockInfo |
queryBlockByHash(Peer peer,
byte[] blockHash)
Query a peer in this channel for a Block by the block hash.
|
BlockInfo |
queryBlockByNumber(Collection<Peer> peers,
long blockNumber)
query a peer in this channel for a Block by the blockNumber
This method may not be thread safe if client context is changed!
|
BlockInfo |
queryBlockByNumber(Collection<Peer> peers,
long blockNumber,
User userContext)
query a peer in this channel for a Block by the blockNumber
|
BlockInfo |
queryBlockByNumber(long blockNumber)
query this channel for a Block by the blockNumber.
|
BlockInfo |
queryBlockByNumber(long blockNumber,
User userContext)
query this channel for a Block by the blockNumber.
|
BlockInfo |
queryBlockByNumber(Peer peer,
long blockNumber)
Query a peer in this channel for a Block by the blockNumber
This method may not be thread safe if client context is changed!
|
BlockInfo |
queryBlockByNumber(Peer peer,
long blockNumber,
User userContext)
query a peer in this channel for a Block by the blockNumber
|
BlockInfo |
queryBlockByTransactionID(Collection<Peer> peers,
String txID)
query a peer in this channel for a Block by a TransactionID contained in the block
This method may not be thread safe if client context is changed!
|
BlockInfo |
queryBlockByTransactionID(Collection<Peer> peers,
String txID,
User userContext)
query a peer in this channel for a Block by a TransactionID contained in the block
|
BlockInfo |
queryBlockByTransactionID(Peer peer,
String txID)
query a peer in this channel for a Block by a TransactionID contained in the block
This method may not be thread safe if client context is changed!
|
BlockInfo |
queryBlockByTransactionID(Peer peer,
String txID,
User userContext)
query a peer in this channel for a Block by a TransactionID contained in the block
|
BlockInfo |
queryBlockByTransactionID(String txID)
query this channel for a Block by a TransactionID contained in the block
The request is tried on on each peer till successful.
|
BlockInfo |
queryBlockByTransactionID(String txID,
User userContext)
query this channel for a Block by a TransactionID contained in the block
The request is sent to a random peer in the channel
|
BlockchainInfo |
queryBlockchainInfo()
query this channel for chain information.
|
BlockchainInfo |
queryBlockchainInfo(Collection<Peer> peers,
User userContext)
query for chain information
|
BlockchainInfo |
queryBlockchainInfo(Peer peer)
query for chain information
This method may not be thread safe if client context is changed!
|
BlockchainInfo |
queryBlockchainInfo(Peer peer,
User userContext)
query for chain information
|
BlockchainInfo |
queryBlockchainInfo(User userContext)
query this channel for chain information.
|
Collection<ProposalResponse> |
queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest)
Send Query proposal
|
Collection<ProposalResponse> |
queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest,
Collection<Peer> peers)
Send Query proposal
|
CollectionConfigPackage |
queryCollectionsConfig(String chaincodeName,
Peer peer,
User userContext)
Get information on the collections used by the chaincode.
|
List<org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo> |
queryInstantiatedChaincodes(Peer peer)
Query peer for chaincode that has been instantiated
This method may not be thread safe if client context is changed!
|
List<org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo> |
queryInstantiatedChaincodes(Peer peer,
User userContext)
Query peer for chaincode that has been instantiated
|
TransactionInfo |
queryTransactionByID(Collection<Peer> peers,
String txID,
User userContext)
Query for a Fabric Transaction given its transactionID
|
TransactionInfo |
queryTransactionByID(Peer peer,
String txID)
Query for a Fabric Transaction given its transactionID
This method may not be thread safe if client context is changed!
|
TransactionInfo |
queryTransactionByID(Peer peer,
String txID,
User userContext)
Query for a Fabric Transaction given its transactionID
|
TransactionInfo |
queryTransactionByID(String txID)
Query this channel for a Fabric Transaction given its transactionID.
|
TransactionInfo |
queryTransactionByID(String txID,
User userContext)
Query this channel for a Fabric Transaction given its transactionID.
|
String |
registerBlockListener(BlockingQueue<QueuedBlockEvent> blockEventQueue)
Register a Queued block listener.
|
String |
registerBlockListener(BlockingQueue<QueuedBlockEvent> blockEventQueue,
long timeout,
TimeUnit timeUnit)
Register a Queued block listener.
|
String |
registerBlockListener(BlockListener listener)
Register a block listener.
|
String |
registerChaincodeEventListener(Pattern chaincodeId,
Pattern eventName,
ChaincodeEventListener chaincodeEventListener)
Register a chaincode event listener.
|
void |
removeOrderer(Orderer orderer) |
void |
removePeer(Peer peer)
Removes the peer connection from the channel.
|
Collection<ProposalResponse> |
sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest)
Deprecated.
See new lifecycle chaincode management.
LifecycleInstallChaincodeRequest |
Collection<ProposalResponse> |
sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest,
Collection<Peer> peers)
Deprecated.
See new lifecycle chaincode management.
LifecycleInstallChaincodeRequest |
Collection<LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse> |
sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest lifecycleApproveChaincodeDefinitionForMyOrgRequest,
Collection<Peer> peers)
Approve chaincode to be run on this peer's organization.
|
LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse |
sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest lifecycleApproveChaincodeDefinitionForMyOrgRequest,
Peer peer)
Approve chaincode to be run on this peer's organization.
|
Collection<LifecycleCheckCommitReadinessProposalResponse> |
sendLifecycleCheckCommitReadinessRequest(LifecycleCheckCommitReadinessRequest lifecycleCheckCommitReadinessRequest,
Collection<Peer> peers)
Query approval status for all organizations.
|
Collection<LifecycleCommitChaincodeDefinitionProposalResponse> |
sendLifecycleCommitChaincodeDefinitionProposal(LifecycleCommitChaincodeDefinitionRequest lifecycleCommitChaincodeDefinitionRequest,
Collection<Peer> peers)
Commit chaincode final approval to run on all organizations that have approved.
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<? extends ProposalResponse> proposalResponses)
Send transaction to one of the orderers on the channel using the usercontext set on the client.
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<? extends ProposalResponse> proposalResponses,
Channel.TransactionOptions transactionOptions)
Send transaction to one of a specified set of orderers with the specified user context.
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<? extends ProposalResponse> proposalResponses,
Collection<Orderer> orderers)
Send transaction to one of the specified orderers using the usercontext set on the client..
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<? extends ProposalResponse> proposalResponses,
Collection<Orderer> orderers,
User userContext)
Send transaction to one of a specified set of orderers with the specified user context.
|
CompletableFuture<BlockEvent.TransactionEvent> |
sendTransaction(Collection<ProposalResponse> proposalResponses,
User userContext)
Send transaction to one of the orderers on the channel using a specific user context.
|
Collection<ProposalResponse> |
sendTransactionProposal(TransactionProposalRequest transactionProposalRequest)
Send a transaction proposal.
|
Collection<ProposalResponse> |
sendTransactionProposal(TransactionProposalRequest transactionProposalRequest,
Collection<Peer> peers)
Send a transaction proposal to specific peers.
|
Collection<ProposalResponse> |
sendTransactionProposalToEndorsers(TransactionProposalRequest transactionProposalRequest,
Channel.DiscoveryOptions discoveryOptions)
Send a transaction proposal.
|
Collection<ProposalResponse> |
sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest)
Deprecated.
See new Lifecycle chaincode management.
sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer) |
Collection<ProposalResponse> |
sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest,
Collection<Peer> peers)
Deprecated.
See new Lifecycle chaincode management.
sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer) |
byte[] |
serializeChannel()
Serialize channel to a byte array using Java serialization.
|
void |
serializeChannel(File file)
Serialize channel to a file using Java serialization.
|
ServiceDiscovery.EndorsementSelector |
setSDEndorserSelector(ServiceDiscovery.EndorsementSelector endorsementSelector) |
Channel.SDOrdererAddition |
setSDOrdererAddition(Channel.SDOrdererAddition sdOrdererAddition)
Set service discovery orderer addition override.
|
Channel.SDPeerAddition |
setSDPeerAddition(Channel.SDPeerAddition sdPeerAddition)
Set service discovery peer addition override.
|
void |
setServiceDiscoveryProperties(Properties serviceDiscoveryProperties) |
void |
shutdown(boolean force)
Shutdown the channel with all resources released.
|
String |
toString() |
boolean |
unregisterBlockListener(String handle)
Unregister a block listener.
|
boolean |
unregisterChaincodeEventListener(String handle)
Unregister an existing chaincode event listener.
|
void |
updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration,
byte[]... signers)
Update channel with specified channel configuration.
|
void |
updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration,
Orderer orderer,
byte[]... signers)
Update channel with specified channel configuration
|
void |
updateChannelConfiguration(User userContext,
UpdateChannelConfiguration updateChannelConfiguration,
Orderer orderer,
byte[]... signers)
Update channel with specified channel configuration
|
public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException
updateChannelConfiguration
- Updated Channel configurationsigners
- signersTransactionException
InvalidArgumentException
public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException
updateChannelConfiguration
- Channel configurationsigners
- signersorderer
- The specific orderer to use.TransactionException
InvalidArgumentException
public void updateChannelConfiguration(User userContext, UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException
userContext
- The specific user to use.updateChannelConfiguration
- Channel configurationsigners
- signersorderer
- The specific orderer to use.TransactionException
InvalidArgumentException
public boolean isInitialized()
public String getName()
public Channel addPeer(Peer peer) throws InvalidArgumentException
peer
- The Peer to add.InvalidArgumentException
public Channel addPeer(Peer peer, Channel.PeerOptions peerOptions) throws InvalidArgumentException
peer
- The Peer to add.peerOptions
- see Peer.PeerRole
InvalidArgumentException
public Collection<Peer> getPeersForOrganization(String mspid) throws InvalidArgumentException
mspid
- The organizaiions MSPIDInvalidArgumentException
public Collection<String> getPeersOrganizationMSPIDs()
public Channel joinPeer(Peer peer) throws ProposalException
Channel.PeerOptions
peer
- the peer to join the channel.ProposalException
public Channel joinPeer(Peer peer, Channel.PeerOptions peerOptions) throws ProposalException
peer
- the peer to join the channel.peerOptions
- see Channel.PeerOptions
ProposalException
public Channel joinPeer(Orderer orderer, Peer peer, Channel.PeerOptions peerOptions) throws ProposalException
orderer
- The orderer to get the genesis block.peer
- the peer to join the channel.peerOptions
- see Channel.PeerOptions
ProposalException
public void removePeer(Peer peer) throws InvalidArgumentException
peer
- InvalidArgumentException
public Channel addOrderer(Orderer orderer) throws InvalidArgumentException
orderer
- the orderer to add.InvalidArgumentException
public void removeOrderer(Orderer orderer) throws InvalidArgumentException
InvalidArgumentException
public Collection<Orderer> getOrderersForOrganization(String mspid) throws InvalidArgumentException
mspid
- The organizaiions MSPIDInvalidArgumentException
public Collection<String> getOrderersOrganizationMSPIDs()
public Channel.PeerOptions getPeersOptions(Peer peer)
public Collection<Peer> getPeers()
public Collection<Peer> getPeers(EnumSet<Peer.PeerRole> roles)
public Channel initialize() throws InvalidArgumentException, TransactionException
InvalidArgumentException
TransactionException
public Properties getServiceDiscoveryProperties()
public void setServiceDiscoveryProperties(Properties serviceDiscoveryProperties)
public Channel.SDOrdererAddition setSDOrdererAddition(Channel.SDOrdererAddition sdOrdererAddition)
Any service discovery properties setServiceDiscoveryProperties(Properties)
should be set before calling this.
sdOrdererAddition
- public Channel.SDOrdererAddition getSDOrdererAddition()
Any service discovery properties setServiceDiscoveryProperties(Properties)
should be set before calling this.
public Channel.SDPeerAddition setSDPeerAddition(Channel.SDPeerAddition sdPeerAddition)
Any service discovery properties setServiceDiscoveryProperties(Properties)
should be set before calling this.
sdPeerAddition
- public Channel.SDPeerAddition getSDPeerAddition()
Any service discovery properties setServiceDiscoveryProperties(Properties)
should be set before calling this.
public boolean isShutdown()
public byte[] getUpdateChannelConfigurationSignature(UpdateChannelConfiguration updateChannelConfiguration, User signer) throws InvalidArgumentException
updateChannelConfiguration
- signer
- InvalidArgumentException
public Channel.AnchorPeersConfigUpdateResult getConfigUpdateAnchorPeers(Peer peer, User userContext, Collection<String> peersToAdd, Collection<String> peersToRemove) throws Exception
Channel.AnchorPeersConfigUpdateResult.getCurrentPeers()
peer
- peer to use to the channel configuration from.userContext
- The usercontext to use.peersToAdd
- Peers to add as Host:Port peer1.org2.com:7022peersToRemove
- Peers to remove as Host:Port peer1.org2.com:7022Channel.AnchorPeersConfigUpdateResult
Exception
public byte[] getChannelConfigurationBytes(User userContext, Orderer orderer) throws InvalidArgumentException, TransactionException
userContext
- The user to sign the action.orderer
- To retrieve the configuration from.InvalidArgumentException
TransactionException
public byte[] getChannelConfigurationBytes(User userContext, Peer peer) throws InvalidArgumentException, TransactionException
userContext
- The user to sign the action.peer
- To retrieve the configuration from.InvalidArgumentException
TransactionException
public byte[] getChannelConfigurationBytes() throws InvalidArgumentException, TransactionException
public byte[] getChannelConfigurationBytes(User userContext) throws InvalidArgumentException, TransactionException
<p>
curl -v POST --data-binary @fooConfig http://host/protolator/decode/common.Config
<p>
See http://hyperledger-fabric.readthedocs.io/en/latest/configtxlator.htmlTransactionException
InvalidArgumentException
public Collection<Orderer> getOrderers()
@Deprecated public Collection<ProposalResponse> sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest) throws InvalidArgumentException, ProposalException
LifecycleInstallChaincodeRequest
instantiateProposalRequest
- send instantiate chaincode proposal request.InvalidArgumentException
ProposalException
@Deprecated public Collection<ProposalResponse> sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
LifecycleInstallChaincodeRequest
instantiateProposalRequest
- peers
- InvalidArgumentException
ProposalException
public org.hyperledger.fabric.sdk.transaction.TransactionContext newTransactionContext()
TransactionRequest
prior to calling sendTransactionProposal(TransactionProposalRequest)
so that the caller can know the transaction ID in advance.@Deprecated public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest) throws ProposalException, InvalidArgumentException
sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer)
upgradeProposalRequest
- ProposalException
InvalidArgumentException
@Deprecated public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer)
upgradeProposalRequest
- peers
- the specific peers to send to.ProposalException
InvalidArgumentException
public BlockInfo queryBlockByHash(byte[] blockHash) throws InvalidArgumentException, ProposalException
blockHash
- the hash of the Block in the chainBlockInfo
with the given block HashInvalidArgumentException
ProposalException
public BlockInfo queryBlockByHash(byte[] blockHash, User userContext) throws InvalidArgumentException, ProposalException
blockHash
- the hash of the Block in the chainuserContext
- the user context.BlockInfo
with the given block HashInvalidArgumentException
ProposalException
public BlockInfo queryBlockByHash(Peer peer, byte[] blockHash) throws InvalidArgumentException, ProposalException
peer
- the Peer to query.blockHash
- the hash of the Block in the chain.BlockInfo
with the given block HashInvalidArgumentException
- if the channel is shutdown or any of the arguments are not valid.ProposalException
- if an error occurred processing the query.public BlockInfo queryBlockByHash(Collection<Peer> peers, byte[] blockHash) throws InvalidArgumentException, ProposalException
peers
- the Peers to query.blockHash
- the hash of the Block in the chain.BlockInfo
with the given block HashInvalidArgumentException
- if the channel is shutdown or any of the arguments are not valid.ProposalException
- if an error occurred processing the query.public BlockInfo queryBlockByHash(Collection<Peer> peers, byte[] blockHash, User userContext) throws InvalidArgumentException, ProposalException
peers
- the Peers to query.blockHash
- the hash of the Block in the chain.userContext
- the user contextBlockInfo
with the given block HashInvalidArgumentException
- if the channel is shutdown or any of the arguments are not valid.ProposalException
- if an error occurred processing the query.public BlockInfo queryBlockByNumber(long blockNumber) throws InvalidArgumentException, ProposalException
blockNumber
- index of the Block in the chainBlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByNumber(long blockNumber, User userContext) throws InvalidArgumentException, ProposalException
blockNumber
- index of the Block in the chainuserContext
- the user context to be used.BlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByNumber(Peer peer, long blockNumber) throws InvalidArgumentException, ProposalException
peer
- the peer to send the request toblockNumber
- index of the Block in the chainBlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByNumber(Peer peer, long blockNumber, User userContext) throws InvalidArgumentException, ProposalException
peer
- the peer to send the request toblockNumber
- index of the Block in the chainuserContext
- the user context.BlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByNumber(Collection<Peer> peers, long blockNumber) throws InvalidArgumentException, ProposalException
peers
- the peers to try and send the request toblockNumber
- index of the Block in the chainBlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByNumber(Collection<Peer> peers, long blockNumber, User userContext) throws InvalidArgumentException, ProposalException
peers
- the peers to try and send the request toblockNumber
- index of the Block in the chainuserContext
- the user context to use.BlockInfo
with the given blockNumberInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(String txID) throws InvalidArgumentException, ProposalException
txID
- the transactionID to query onBlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(String txID, User userContext) throws InvalidArgumentException, ProposalException
txID
- the transactionID to query onuserContext
- the user context.BlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(Peer peer, String txID) throws InvalidArgumentException, ProposalException
peer
- the peer to send the request totxID
- the transactionID to query onBlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(Peer peer, String txID, User userContext) throws InvalidArgumentException, ProposalException
peer
- the peer to send the request totxID
- the transactionID to query onuserContext
- the user context.BlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(Collection<Peer> peers, String txID) throws InvalidArgumentException, ProposalException
peers
- the peers to try to send the request to.txID
- the transactionID to query onBlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockInfo queryBlockByTransactionID(Collection<Peer> peers, String txID, User userContext) throws InvalidArgumentException, ProposalException
peers
- the peer to try to send the request totxID
- the transactionID to query onuserContext
- the user context.BlockInfo
for the Block containing the transactionInvalidArgumentException
ProposalException
public BlockchainInfo queryBlockchainInfo() throws ProposalException, InvalidArgumentException
BlockchainInfo
object containing the chain info requestedInvalidArgumentException
ProposalException
public BlockchainInfo queryBlockchainInfo(User userContext) throws ProposalException, InvalidArgumentException
userContext
- the user context to use.BlockchainInfo
object containing the chain info requestedInvalidArgumentException
ProposalException
public BlockchainInfo queryBlockchainInfo(Peer peer) throws ProposalException, InvalidArgumentException
peer
- The peer to send the request toBlockchainInfo
object containing the chain info requestedInvalidArgumentException
ProposalException
public BlockchainInfo queryBlockchainInfo(Peer peer, User userContext) throws ProposalException, InvalidArgumentException
peer
- The peer to send the request touserContext
- the user context to use.BlockchainInfo
object containing the chain info requestedInvalidArgumentException
ProposalException
public BlockchainInfo queryBlockchainInfo(Collection<Peer> peers, User userContext) throws ProposalException, InvalidArgumentException
peers
- The peers to try send the request.userContext
- the user context.BlockchainInfo
object containing the chain info requestedInvalidArgumentException
ProposalException
public TransactionInfo queryTransactionByID(String txID) throws ProposalException, InvalidArgumentException
txID
- the ID of the transactionTransactionInfo
ProposalException
InvalidArgumentException
public TransactionInfo queryTransactionByID(String txID, User userContext) throws ProposalException, InvalidArgumentException
txID
- the ID of the transactionuserContext
- the user context used.TransactionInfo
ProposalException
InvalidArgumentException
public TransactionInfo queryTransactionByID(Peer peer, String txID) throws ProposalException, InvalidArgumentException
txID
- the ID of the transactionpeer
- the peer to send the request toTransactionInfo
ProposalException
InvalidArgumentException
public TransactionInfo queryTransactionByID(Peer peer, String txID, User userContext) throws ProposalException, InvalidArgumentException
peer
- the peer to send the request totxID
- the ID of the transactionuserContext
- the user contextTransactionInfo
ProposalException
InvalidArgumentException
public TransactionInfo queryTransactionByID(Collection<Peer> peers, String txID, User userContext) throws ProposalException, InvalidArgumentException
txID
- the ID of the transactionpeers
- the peers to try to send the request.userContext
- the user contextTransactionInfo
ProposalException
InvalidArgumentException
public LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest lifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer peer) throws ProposalException, InvalidArgumentException
lifecycleApproveChaincodeDefinitionForMyOrgRequest
- the request see LifecycleApproveChaincodeDefinitionForMyOrgRequest
peer
- LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse
ProposalException
InvalidArgumentException
public Collection<LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse> sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest lifecycleApproveChaincodeDefinitionForMyOrgRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException
lifecycleApproveChaincodeDefinitionForMyOrgRequest
- the request see LifecycleApproveChaincodeDefinitionForMyOrgRequest
peers
- to send the request to.LifecycleApproveChaincodeDefinitionForMyOrgProposalResponse
ProposalException
InvalidArgumentException
public Collection<LifecycleCommitChaincodeDefinitionProposalResponse> sendLifecycleCommitChaincodeDefinitionProposal(LifecycleCommitChaincodeDefinitionRequest lifecycleCommitChaincodeDefinitionRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
lifecycleCommitChaincodeDefinitionRequest
- The request see LifecycleCommitChaincodeDefinitionRequest
peers
- to send the request to.LifecycleCommitChaincodeDefinitionProposalResponse
InvalidArgumentException
ProposalException
public Collection<LifecycleQueryChaincodeDefinitionsProposalResponse> lifecycleQueryChaincodeDefinitions(LifecycleQueryChaincodeDefinitionsRequest proposalRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
proposalRequest
- the request.peers
- The peers to which the request will be sent.InvalidArgumentException
- if the channel is in an invalid state.ProposalException
public Collection<LifecycleCheckCommitReadinessProposalResponse> sendLifecycleCheckCommitReadinessRequest(LifecycleCheckCommitReadinessRequest lifecycleCheckCommitReadinessRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
lifecycleCheckCommitReadinessRequest
- The request see LifecycleCheckCommitReadinessRequest
peers
- Peers to send the request. Usually only need one.LifecycleCheckCommitReadinessProposalResponse
InvalidArgumentException
ProposalException
public Collection<LifecycleQueryChaincodeDefinitionProposalResponse> lifecycleQueryChaincodeDefinition(QueryLifecycleQueryChaincodeDefinitionRequest queryLifecycleQueryChaincodeDefinitionRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
queryLifecycleQueryChaincodeDefinitionRequest
- The request see QueryLifecycleQueryChaincodeDefinitionRequest
peers
- The peers to send the request to.LifecycleQueryChaincodeDefinitionProposalResponse
InvalidArgumentException
ProposalException
public List<org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo> queryInstantiatedChaincodes(Peer peer) throws InvalidArgumentException, ProposalException
peer
- The peer to query.Query.ChaincodeInfo
InvalidArgumentException
ProposalException
public List<org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo> queryInstantiatedChaincodes(Peer peer, User userContext) throws InvalidArgumentException, ProposalException
peer
- The peer to query.userContext
- the user context.Query.ChaincodeInfo
InvalidArgumentException
ProposalException
public CollectionConfigPackage queryCollectionsConfig(String chaincodeName, Peer peer, User userContext) throws InvalidArgumentException, ProposalException
chaincodeName
- The name of the chaincode to query.peer
- Peer to query.userContext
- The context of the user to sign the request.InvalidArgumentException
ProposalException
public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest) throws ProposalException, InvalidArgumentException
transactionProposalRequest
- The transaction proposal to be sent to all the required peers needed for endorsing.InvalidArgumentException
ProposalException
public Collection<ProposalResponse> sendTransactionProposalToEndorsers(TransactionProposalRequest transactionProposalRequest, Channel.DiscoveryOptions discoveryOptions) throws ProposalException, InvalidArgumentException, ServiceDiscoveryException
transactionProposalRequest
- The transaction proposal to be sent to all the required peers needed for endorsing.discoveryOptions
- InvalidArgumentException
ProposalException
ServiceDiscoveryException
public Collection<String> getDiscoveredChaincodeNames()
public Collection<ProposalResponse> sendTransactionProposal(TransactionProposalRequest transactionProposalRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException
transactionProposalRequest
- The transaction proposal to be sent to the peers.peers
- InvalidArgumentException
ProposalException
public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest) throws InvalidArgumentException, ProposalException
queryByChaincodeRequest
- InvalidArgumentException
ProposalException
public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException
queryByChaincodeRequest
- peers
- InvalidArgumentException
ProposalException
public ServiceDiscovery.EndorsementSelector setSDEndorserSelector(ServiceDiscovery.EndorsementSelector endorsementSelector)
public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<ProposalResponse> proposalResponses, User userContext)
proposalResponses
- The proposal responses to be sent to the orderer.userContext
- The usercontext used for signing transaction.public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<? extends ProposalResponse> proposalResponses)
proposalResponses
- .public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<? extends ProposalResponse> proposalResponses, Collection<Orderer> orderers)
proposalResponses
- The proposal responses to be sent to the ordererorderers
- The orderers to send the transaction to.public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<? extends ProposalResponse> proposalResponses, Collection<Orderer> orderers, User userContext)
proposalResponses
- orderers
- public CompletableFuture<BlockEvent.TransactionEvent> sendTransaction(Collection<? extends ProposalResponse> proposalResponses, Channel.TransactionOptions transactionOptions)
proposalResponses
- transactionOptions
- public String registerBlockListener(BlockListener listener) throws InvalidArgumentException
listener
- function with single argument with type BlockEvent
InvalidArgumentException
- if the channel is shutdown.public String registerBlockListener(BlockingQueue<QueuedBlockEvent> blockEventQueue) throws InvalidArgumentException
blockEventQueue
- the queueInvalidArgumentException
public String registerBlockListener(BlockingQueue<QueuedBlockEvent> blockEventQueue, long timeout, TimeUnit timeUnit) throws InvalidArgumentException
blockEventQueue
- the queuetimeout
- The time that is waited on for event to be waited on the queuetimeUnit
- the time unit for timeout.InvalidArgumentException
public boolean unregisterBlockListener(String handle) throws InvalidArgumentException
handle
- of Block listener to remove.InvalidArgumentException
- if the channel is shutdown or invalid arguments.public Collection<String> getBlockListenerHandles() throws InvalidArgumentException
InvalidArgumentException
public String registerChaincodeEventListener(Pattern chaincodeId, Pattern eventName, ChaincodeEventListener chaincodeEventListener) throws InvalidArgumentException
chaincodeId
- Java pattern for chaincode identifier also know as chaincode name. If maeventName
- Java pattern to match the event name.chaincodeEventListener
- The listener to be invoked if both chaincodeId and eventName pattern matches.unregisterChaincodeEventListener(String)
InvalidArgumentException
public boolean unregisterChaincodeEventListener(String handle) throws InvalidArgumentException
handle
- Chaincode event listener handle to be unregistered.InvalidArgumentException
public void shutdown(boolean force)
force
- force immediate shutdown.public void serializeChannel(File file) throws IOException, InvalidArgumentException
file
- fileIOException
InvalidArgumentException
public byte[] serializeChannel() throws IOException, InvalidArgumentException
InvalidArgumentException
IOException
Copyright © 2021. All rights reserved.