Skip to content

Contract Event Reactor

A contract event reactor watches on-chain events and turns matching events into follow-up service work.

Contract and service split

Contract

  • emits the original event
  • stores the durable state that describes whether follow-up work has happened
  • applies the final accepted effect when the service response comes back

Service

  • watches for relevant events
  • performs the off-chain reaction logic
  • derives one or more follow-up contract calls
  • submits those effects back through service response consensus

How it works

  1. A funded wallet submits the initial transaction that causes a contract event to be emitted.
  2. Validators observe the committed event.
  3. A service request is created to react to that event.
  4. Validators execute the reactor service and derive one or more contract calls from the event contents.
  5. Accepted responses become ordinary contract executions.

Concepts introduced

Event-driven workflows

The initial on-chain event becomes the trigger for off-chain processing.

Multi-stage execution

One transaction produces an event, then a service reacts, then another contract call lands later once validators agree on the service result.

Idempotency

Reactors need a clear notion of whether an event has already been handled, especially if validators observe the same trigger more than once or if retries happen.