Skip to main content

Examples

Use the Coins chain to explore runtime composition, the Bridge chain to follow a certificate flow, or the custom module skeleton to build your own module.

Coins chain

The Coins chain is a proof-of-authority example and a starting point for tracing coin operations and runtime composition. Its package is nunchi-coins-chain; its local node binary is coins-chain-node.

Start it with the local network instructions. Then follow the application type:

TypePurpose
CoinsRuntimeThe example's application runtime
ClobExtensionThe CLOB consensus extension connected to that runtime
nunchi_chain::Application<CoinsRuntime, ClobExtension>The application type combining runtime and extension
BasicApplicationThe alias without a consensus extension, used for focused tests

Follow the runtime construction, transaction dispatch, and finalization handling to see how each module participates. The CLOB reference explains where matching ends and application settlement begins.

Coins indexer

The Coins indexer is a separate service that receives and verifies consensus artifacts. Its /consensus/summary/ws stream emits JSON summaries. The kind field distinguishes seed, notarization, and finalization events; use it to identify the stage of consensus represented by each update.

Bridge chain

The Bridge chain example runs two independent chain instances and a relayer. Each chain has its own validator set, DKG threshold output, networking namespace, storage directory, and ports.

Build the example binaries:

cargo build -p nunchi-bridge-chain --bins

Follow the Bridge README to generate two four-validator configurations and start each validator in its own process. Start bridge-relayer after both chains produce finalizations. The binaries bridge-chain-a-node and bridge-chain-b-node each require their own chain's configuration.

RPC methodInput shown in the example
bridge.statusStatus query
bridge.latestFinalizationLatest-finalization query
bridge.finalization{ "height": 1 }
bridge.submitFinalization{ "finalization": "<hex>" }
bridge.latestAcceptedLatest-accepted query

Custom module

The nunchi-custom-module skeleton is a Cargo workspace member. Its module root exposes the following pieces:

Source areaWhat to inspect
transactionOperations, transaction payloads, and authorization inputs
ledgerApplication of operations and module errors
dbTyped state access
genesisInitial accounts and module state
eventsOutput records for value changes
rpcThe optional RPC surface
testsExpected behavior of the skeleton

Start with the skeleton's operations and tests, then connect its ledger and RPC surface to your application runtime.