Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Putting All Together

This chapter is a capstone. We build one small node framework once, then apply it to two very different domains.

The contrast is the point:

  • Blockchain: decentralized, gossip-driven, eventually consistent, heavy validation.
  • Order book: deterministic, totally ordered, strict concurrency boundaries, strict price-time priority.

What “together” means

We are reusing the exact building blocks from earlier chapters:

  • Structured task lifecycle with JoinSet: spawn long-running tasks, await them, and shut down cleanly.
  • Framed networking with LengthDelimitedCodec: no partial-read protocol bugs.
  • Resilience as middleware with tower::ServiceBuilder: timeout, retry, rate_limit, load_shed.
  • Observability with tracing: spans and structured events.
  • Client-facing RPC with tonic: typed gRPC APIs.

Shared repository layout

crates/
  nodekit/
  blockchain_node/
  orderbook_node/
  • nodekit/: runtime bootstrap, config, shutdown, tracing setup, transport helpers, and common metrics labels.
  • blockchain_node/: gossip, sync, mempool, validation, block production.
  • orderbook_node/: sequencing, matching, event log replication, market data streaming.

From here on, we will keep one rule: reuse the same skeleton, swap domain logic.