This is the project to support the writing of Contracts with the JVM runtime - enabling development of using Java language or other JVM based languages
The Fabric programming model is described in the Developing Applications chapter of the Hyperledger Fabric documentation.
All Contracts should implement ContractInterface
interface, in addition to the Contract
annotation.
Configuration
Some Java chaincode settings are configurable on a per chaincode basis, including the maximum gRPC inbound message size, thread pool settings, and whether to enable chaincode metrics. The default settings are as follows:
MAX_INBOUND_MESSAGE_SIZE=104857600 CHAINCODE_METRICS_ENABLED=false TP_CORE_POOL_SIZE=5 TP_MAX_POOL_SIZE=5 TP_QUEUE_SIZE=5000
To override the defaults, a config.props
Java properties file must be included in the default, unnamed, package on your contract code's classpath, which will then be loaded when the chaincode starts.
Setting the metrics enabled flag to true
will turn on default metrics logging. The TP_
values establish the core thread pool size, max thread poolsize, and the number of of tasks that will wait.
Open Telemetry
To use Open Telemetry, set the following properties:
CHAINCODE_METRICS_ENABLED=true CHAINCODE_METRICS_PROVIDER=org.hyperledger.fabric.metrics.impl.OpenTelemetryMetricsProvider
Additionally, you can set properties after the OpenTelemetry specification.
Example:
OTEL_EXPORTER_OTLP_ENDPOINT=otelcollector:4317 OTEL_EXPORTER_OTLP_INSECURE=true
If you are building your chaincode using Gradle or Maven, create a config.props
file in the src/main/resources
directory and include the settings you want to override.
Package | Description |
---|---|
org.hyperledger.fabric |
Provides logging classes.
|
org.hyperledger.fabric.contract |
Provides interfaces and classes to support the contract programming model.
|
org.hyperledger.fabric.contract.annotation |
Provides annotations required for Contract implementations.
|
org.hyperledger.fabric.metrics |
Provides interfaces and classes to support collection of metrics.
|
org.hyperledger.fabric.shim |
Provides interfaces and classes required for chaincode development and state variable access.
|
org.hyperledger.fabric.shim.ext.sbe |
Provides an interface for creating and modifying state-based endorsement policies.
|
org.hyperledger.fabric.shim.ledger |
Provides interfaces and classes for querying state variables.
|
org.hyperledger.fabric.traces |
Supports collection of traces
|