Node Extensions#

Extensions are optional modules a node operator can enable alongside the core REST API for consumers that need direct access to binary data instead of JSON.

gRPC Server#

The node ships a grpc-server module (built alongside the core node in node-scala) that exposes blocks and transactions directly in their protobuf-serialized binary format, rather than the JSON representation the REST API returns. This is the recommended way to consume chain data for a service that needs to process a large volume of blocks or transactions efficiently.

If you use your own node with the gRPC server enabled, you can send it a SignedTransaction object directly instead of composing a JSON transaction for the REST API’s POST /transactions/broadcast method. See @decentralchain/protobuf-serialization (published on npm today; the monorepo is renaming it to protobuf-schemas) for building and parsing these binary structures from JavaScript/TypeScript, or Node gRPC API for the typed client.

Note

Verified against node-scala v1.7.0 (grpc-server/src/main/resources/application.conf).

The module listens on two ports:

Setting

Default

Purpose

dcc.grpc.port

6870

AccountsApi, AssetsApi, BlockchainApi, BlocksApi, TransactionsApi

dcc.blockchain-updates.grpc-port

6881

BlockchainUpdates — a real-time stream of block-level events

dcc.grpc.host

localhost

Interface the main gRPC service binds to

dcc.grpc.worker-threads

4

Worker threads for the gRPC service

dcc.blockchain-updates.min-keep-alive

5m

Minimum time a BlockchainUpdates subscription is kept alive

The grpc-server module is not a separate process: it is an in-process node extension. Put its JARs on the node’s classpath (the Docker image loads extensions from lib/plugins/) and enable it in the node config with dcc.extensions = [com.decentralchain.api.grpc.GRPCServerExtension] (commented out in the node’s default application.conf). Enabling it is a deployment decision for the node operator, not a REST API toggle.