Skip to content

Developers

Private Ephemeral Rollups

Hidden state with MagicBlock: delegation, permissions, randomness.

  1. Base layer

    Match opens in tesoro_core.

  2. Assign

    An idle table takes the Match.

  3. Seats

    Only the two Players read them.

  4. Play

    Game rules run in the rollup.

  5. Commit

    The result goes back to base.

  6. Finalize

    CPI into tesoro_core.

A Match's result must reach the Solana settlement program without trusting a Studio server's signature, and some of its state must stay hidden: a Player's hole cards, a Block Burst run, a Trading Duel pick, a Vanguard army. ADR 0003 decides that each Game is a Solana program whose tables are delegated to a MagicBlock Private Ephemeral Rollup, which runs in an Intel TDX trusted execution environment (TEE).

Tables and the life of a Match

A Game does not delegate a new set of accounts for every Match. It keeps a fixed set of tables: each is a program account delegated to the TEE validator once and left there, so a Match costs a few cheap rollup transactions instead of a delegation. A table stays delegated across Matches and does not undelegate in normal running.

  1. Base layer. Players open and join the Match in tesoro_core.
  2. Assign. The Game's operator key writes one Assignment naming an idle table and its current epoch. It can name only the table: the two Players and the asset are read from the Match in tesoro_core, and the start deadline comes from the program's clock. A table takes one Match per epoch, and the epoch moves on at every reset.
  3. Seats. A Game with hidden information keeps private seat accounts on the table (rollup-only accounts behind a private permission). Between Matches a seat is wiped and then given to the next two Players, so it is never without a permission.
  4. Check in and play. begin_match reserves one of the table's result slots; the Match starts when both Players have checked in (a Player who does not loses, and if neither does, each side pays the Platform Fee). Game rules and clocks run in the rollup.
  5. Result and commit. The end of the Match writes the outcome into its slot in the table's result ring. The table is then dirty, and exactly one commit sends it back to the base layer. A Sponsor account on the rollup pays the commit, so Players never pay for it and nobody can drain it with extra commits.
  6. Finalize. On the base layer anyone calls the Game's finalize, which reads only the committed table's result ring and CPIs into tesoro_core (see How settlement works). A slot is freed once tesoro_core has written the settlement receipt, and the table is reset for the next epoch.

If a result never reaches the base layer, the Match is not lost: tesoro_core refunds it at its own deadline, and a table that moved past a Match without ever running it lets the Match refund at once. Rollup (TEE) transactions are private and have no public explorer page. The Game's evidence files in the repository (evidence.json) record their signatures.

Delegation is pinned to one validator

If anyone could delegate a Game's state to a validator they controlled, they could commit a forged result. Two checks prevent it. The delegation program keeps a ProgramConfig per Game program whose approved_validators lists only the MagicBlock TEE validator, and the Game programs also pin the validator themselves. A delegation naming any other validator fails with InvalidValidator (custom error 6020). The ProgramConfig addresses are on Programs and addresses.

What is hidden in each Game

GameHiddenHow it is hiddenWhat becomes public
Block BurstThe Seed, then each Player's Board (moves), and the opponent's score for the last 10 secondsThe Seed is written by the VRF callback into a vault seat with no members and copied into a Player's own Board by begin, in the transaction that starts that Player's clock. Each Board's only member is its Player. From 80 s into the 90 s run, moves go through play_hidden, which writes no public score and is sent on a fixed beat (one transaction every 0.6 s whether or not the Player moved), so the opponent cannot tell when a move was made.At the end of the Match: the Seed, both move logs and their timing, in the table's result ring.
Hold'emEach Player's hole cardsHole accounts are seats readable only by their Player. There is no stored deck: cards are drawn from a seed that folds the VRF output with both Players' fresh secrets, which sit in seats and are never an instruction argument.Board cards as dealt; hole cards only at a showdown. The seats are wiped before the table is committed.
Trading DuelEach Player's Book: picks for columns that have not lockedEach Book is a seat readable only by its Player. When a column locks, both picks for it are copied into the public table.As columns lock: both picks. After the Match: both full Books.
VanguardBoth armies and each Player's secretEach army is a seat readable only by its Player; the setup uses both Players' secrets and the VRF output.The board as it is played, and every piece left standing at the end.

Randomness

Randomness comes from MagicBlock's VRF, delivered by callback straight into private state inside the TEE, so a public VRF value cannot expose it. Hold'em additionally folds both Players' own per-hand secrets (contribute_entropy) into the seed: seed = H(entropy || vrf || hand_no).

Score is a replay, never reported

No Block Burst instruction takes a score. play feeds each (piece, x, y) to the deterministic engine on the Board's own state, illegal moves revert the batch, and the packed move log is stored so anyone can re-verify. A bit-exact TypeScript port of the engine (app/src/games/block-puzzle/engine.ts) lets the app preview the same result.

Trading Duel prices

The line is sampled from MagicBlock's real-time pricing oracle (Pyth Lazer pushed into rollup accounts every 50 to 200 ms). The program reads the PythPriceUpdateV2 bytes itself, refuses any price older than 2 seconds, and records each sample into the current column's low and high. Anyone may call tick to add samples, but a sample is always a real price. The bands are fixed from the start price (band 0 begins there, and any band, above or below, can be picked), and a column locks 10 seconds before its window, so a faster feed cannot help a pick. The Match ends without an end price: end_match carries the last recorded price through any column the line did not reach, so the result is the same whoever ends it and when.

Liveness

Clocks live in the programs: every Game gives a paired Player 60 s to check in or take the first step. Block Burst 60 s to check in, 60 s for the pieces, a 10 s countdown, a 90 s run and 3 s of grace; Hold'em 30 s per action and 60 s to contribute entropy, with three missed turns in a row a forfeit; Trading Duel a two-and-a-half-minute grid; Vanguard 10 s per move, three missed turns in a row a forfeit, and a 15 minute limit on the whole Battle. claim_timeout, close, finalize and settle can be sent by anyone, and the keeper sends them when no Player does.