mc@dev:~$
back to projects
RustStarkNetSTARKTEEZKDojo

Saya — Proving Orchestrator

End-to-end proving pipeline that settles Dojo game blocks on StarkNet L2


Overview

Saya is a proving orchestrator built for the Dojo ecosystem. It sits between the Katana L3 sequencer and StarkNet L2, responsible for taking blocks produced by the sequencer and settling them on L2 with cryptographic proof.

Without Saya, L3 blocks would need to be settled manually or via expensive direct calls. With Saya, the entire prove-and-settle pipeline runs automatically, enabling games to run on L3 with the security guarantees of L2.

What It Does

The orchestrator performs the following pipeline for every L3 block:

  1. Fetch — polls the Katana sequencer for new finalized blocks
  2. Prepare — extracts the execution trace and formats it for the prover
  3. Prove — submits the trace to a proving backend (STARK or TEE)
  4. Verify — checks the returned proof before submission
  5. Settle — submits the proof to the Piltover settlement contract on StarkNet L2

Proving Backends

A key design decision was supporting multiple proving backends:

  • STARK backend — uses Stone Prover via HTTP Prover (see separate project); produces full cryptographic proofs with no trusted setup
  • TEE backend — uses a Trusted Execution Environment; faster and cheaper than STARK, but relies on hardware trust assumptions

Both backends implement the same interface, so the orchestrator is agnostic to which is used. This lets Cartridge choose the right tradeoff per deployment.

Why L3?

The cost motivation is straightforward: on L2, every transaction pays L2 gas. On L3, transactions pay L3 gas, and the entire L3 block pays a single L2 settlement cost amortized across all transactions in that block. For high-throughput games with many micro-transactions, this is a 100x–1000x cost reduction per action.

Saya makes this economically viable by automating the settlement so it happens reliably without manual intervention.

Implementation Notes

Saya is written in Rust and structured as an async pipeline with configurable polling intervals. The prover communication uses HTTP Prover's REST API. Settlement transactions are submitted via Starknet-rs with retry logic and nonce management.