The JSDK 1.2 has features added since the 1.2 based release to match those added to the Fabric 1.2 release.
The SDK is mostly backward compatible with the v1.x based Fabric with the following considerations
- The new Peer eventing service is the default for the SDK however, in v1.0 Fabric peer eventing service is not supported. To address in applications that are
connecting to Fabric 1.0 you must when adding or joining a peer to a channel provide a PeerRole option.
A role with
PeerRole.NO_EVENT_SOURCE
has been defined that has the equivalent functionality of a v1.0 peer. You can see an example of this in End2endIT.java#L732 and in End2endAndBackAgainIT.java#L597
Private data collection example is in src/test/java/org/hyperledger/fabric/sdkintegration/PrivateDataIT.java
From the SDK perspective there is very little change from installing, instantiating and invoking chaincode. The only notable change is in
instantiation. In instantiation there is a requirement to pass in the Instantiation proposal a chaincode collection configuration with the method setChaincodeCollectionConfiguration
as seen on
this line.
The ChaincodeCollectionConfiguration
class allows collection configuration to be loaded from YAML or a json file or object. Sample collection configuration files
exist in src/test/fixture/collectionProperties.
PrivateDataIT.yaml
has comments that help explain some of the aspects of configuring private collections.
More details on the concepts of Private Data feature can be found in the Fabric documentation Private Data
Service discovery allows through a collection of peers with a role of SERVICE_DISCOVERY
to discover :
- Other peers in the network.
- Orderers in the network.
- Discovered names of chaincode that has been discovered in the network.
- Peers needed to endorse invoking a specific chaincode.
An example of this is shown in src/test/java/org/hyperledger/fabric/sdkintegration/ServiceDiscoveryIT.java.
Here only a single peer is added to the channel that has a role of SERVICE_DISCOVERY
. The chaincode names discovered is reported by the method getDiscoveredChaincodeNames
on the channel. It's shows potentially getting to different endorsements set by setting the discoveryOptions on the method sendTransactionProposalToEndorsers
The first
set is not used and is only there for illustrate different options. The DiscoveryOptions allows some control on discovering the needed endorsements
DiscoveryOptions
ignoreEndpoints
: Specify endorser endpoints that should not be used.inspectResults
: If service discovery does not find the the needed endorsers for a specific chaincode it will by default throw a ServiceDiscoveryException. Setting this to true will have the method return the all the endorsements it did obtained.forceDiscovery
: By default endorsers are found by already cached results. Setting this to true will force ignoring this cache and doing a full discovery before finding the endorsements needed.endorsementSelector
The Fabric provided discovery does not find just one possible set of endorsers needed for a specific chaincode, but potentially multiple. TheendorsementSelector
is code that determines which endorser should be selected. There are two implemented with the SDKENDORSEMENT_SELECTION_RANDOM
and the defaultENDORSEMENT_SELECTION_LEAST_REQUIRED_BLOCKHEIGHT
. Applications can use their own by implementing the interfaceEndorsementSelector
and using the two SDK provided as a reference.
The endorsements are then sent to orderer that was also discovered.
Discovered endpoints for Peers and Orderers does not have all the information to construct the Peer or Orderers. Applications can take control of specifically what
properties and roles by setting on the channel setSDPeerAddition
for Peers and setSDOrdererAddition
for orderers. The SDOPeerrDefaultAddition
that implements SDPeerAddition
is an example of code that creates a Peer from the discovery information. Similarly for
the orderer there is SDOrdererDefaultAddition
that implements SDOrdererAddition
More details on service discovery can be found in the Hyperledger Fabric documentation: Service Discovery
Configuration timeout properties for HTTP requests to the Fabric CA have been added. The properties
org.hyperledger.fabric_ca.sdk.connection.connection_request_timeout
, org.hyperledger.fabric_ca.sdk.connection.connect_timeout
and org.hyperledger.fabric_ca.sdk.connection.socket_timeout
can be set and correspond to the HTTP client's equivalent values.
For more information see Apache's HTTP RequestConfig.Builder
Adds support for managing certificates including deletions. Provides an API to also query for expired certificates and those that are about to expire. Examples of this API can be seen HFCAClientIT testGetCerticates