Documentation index
Docs

/ Examples

BUILD / EXAMPLES

Trace composition through working source.

Examples turn the module map into concrete application types, services, events, and operational flows. Use them to understand responsibility boundaries before designing a custom chain.

01

Why examples matter

A module name explains intent. An example shows where the module enters the application, what it depends on, and how its output becomes observable.

Read for structure

  • Application type and runtime composition
  • Extension and module boundaries
  • Transaction and state interfaces
  • Indexer and service responsibilities

Read for operations

  • How finalized activity is exposed
  • Which processes run separately
  • Where persistence and networking enter
  • Which values should be monitored
02

Coins chain

The Coins chain example is the clearest source-backed composition used across the Nunchi site. It connects a runtime and CLOB extension through the generic application type.

examples/coins/chain/src/application.rsSource
use nunchi_clob::ClobExtension;
use crate::CoinsRuntime;

pub type Application =
    nunchi_chain::Application<CoinsRuntime, ClobExtension>;
CoinsRuntime
The runtime selected by the example application.
ClobExtension
The extension that adds order-book market behavior.
nunchi_chain::Application
The application type that composes both responsibilities.
03

Coins indexer

The Coins indexer is a separate service for observing consensus summary events. It shows how finalized activity becomes an observable stream a product can build on.

01

Consensus activity

Validators produce notarization and finalization summaries.

02

Summary stream

The indexer exposes activity through /consensus/summary/ws.

03

Product surface

A UI can present height, view, digest, timestamp, and transaction count.

PRESENTATION NOTE

Simulated streams share the production event shape.

A product UI can replay this stream as a simulation before connecting a live network. The event shape stays the same, so the presentation carries over.

04

Suggested reading order

  1. 01

    Open the example directory

    Identify each process and its Cargo package.

  2. 02

    Find the application type

    Trace the runtime and extension types into their modules.

  3. 03

    Trace state transitions

    Follow one transaction from admission to finalized state.

  4. 04

    Trace observability

    Find the events and services that expose chain activity.

Browse all SDK examples
05

Move toward a build

Choose the example closest to your workflow. Write down every change required by your state model, participants, data path, and controls. That difference becomes the first architecture scope.