01 · Foundations
Counter Basics
Alice increments, Bob decrements, and one document records both operations. This is the smallest complete path from an authenticated Timeline Entry to deterministic execution and a new immutable revision.
Why start here
One document. Two exact ways to act.
The Counter keeps business noise out of the way. Alice and Bob each have an attributed Timeline, each Timeline channel exposes only its declared operation, and every accepted request creates one new Root revision.
A Timeline Entry is evidence that an action arrived. The document’s contracts decide whether and how that action changes state.
Alice Timeline ── increment(+3) ──┐
▼
Counter Root
▲
Bob Timeline ───── decrement(1) ────┘
epoch 0: counter = 0
epoch 1: counter = 3 + event
epoch 2: counter = 2 + eventRun it
Follow the complete loop twice.
Guide pauses after every real operation so the participant, request, result, and resulting document state remain visible.
What this teaches
The vocabulary used by every later example.
Participants, actors, Timelines, channels, operations, typed requests, BEX effects, events, epochs, and BlueIds all appear here in their smallest useful form.
Continue with BEX Rules & Processing Gas to compare workflows and inspect their deterministic cost.