Building a Blueprint Runner
This guide shows the minimal wiring for a production-style runner: jobs + router + producer + consumer.
Prerequisites
Before you start building your Blueprint Runner, ensure you have:
- Rust installed
- Tangle CLI installed
- A basic understanding of Blueprints
- A Blueprint created with the CLI (Step 1 below)
Runner Structure
A Blueprint Runner consists of:
- Jobs: async functions that do work and return outputs
- Router: routes job calls (
jobIndex) to job handlers - Producer: turns event sources into
JobCalls (e.g., EVM logs) - Consumer: turns job results into side effects (e.g., submit results on-chain)
- Background services (optional): long-running support tasks
Step-by-Step Guide
Step 1: Setting Up the Project Structure
If you haven’t already created a Blueprint project, you can use the Tangle CLI (if you haven’t installed it yet, see here):
cargo tangle blueprint create --name <BLUEPRINT_NAME>Depending on the template, you’ll get either a single crate or a small workspace split into:
- Library Package: Contains your job definitions and core logic
- Binary Package: Contains your runner wiring (producer + consumer + router)
Step 2: Define Jobs
Jobs live in your library crate and typically use extractors like TangleEvmArg<T> to ABI-decode inputs:
Step 3: Build the Router
The router is the “job table” for your blueprint:
Step 4: Wire Producer + Consumer
In the binary crate, you load the environment, create the Tangle producer/consumer (TangleEvmProducer/TangleEvmConsumer), and start the runner:
Step 5 (Optional): Add Background Services
Background services run alongside job processing (health checks, caches, watchers, etc.):