Skip to content
D20DAO

Arc Studio and VRF: Design Verifiable Turn Order

Design random turn order on Arc with a coding agent and D20DAO VRF: fixed rosters, authenticated callbacks, recovery tests and public evidence.

Give the coding agent one concrete feature

Arc's November 6, 2026 Studio CLI guide describes sending focused onchain tasks from a coding agent into Studio, inspecting the work and reviewing changes before pulling them into an application.

Random turn order is a useful design exercise for that workflow. Consider a four-player game on Arc: the application needs one initiative order for each round, and players should be able to inspect how it was selected. This brief specifies the application behavior and evidence a developer should ask for before implementing it.

Define the round before the draw

Start with a room ID, a round number and an ordered roster of four distinct players. Specify who may start the draw and who pays its request fee. Decide what happens if someone disconnects while the request is pending.

The contract should close roster changes when the round requests randomness and retain the original order. A second click must find the existing request rather than open another draw. Specify one encoding for the room, round and roster, hash that context into the client seed and retain the original data so players can repeat the commitment check.

Use D20DAO's Shuffle mapping to turn the accepted random word into an initiative order. Publish the game's rules alongside the roster: a proof cannot decide who was eligible to join.

Give the agent exact protocol references

Provide the integration guide and current deployment manifests. Ask the agent to identify its selected coordinator and SDK version in the proposed change.

The consumer should use D20VRFConsumer for callback authentication and associate each request ID with its room and round. Keep the callback small: validate the outstanding request, store the accepted word and mark the order ready. Apply game actions separately.

Arc uses native USDC for payable calls. Native values have 18 decimals, while the ERC-20 view uses six. Preserve that distinction when preparing the request fee, and quote through the current protocol interface rather than copying a price into the application. The contract's payable request fee is separate from any assets held by the game.

Separate a delayed response from a new round

The interface needs to show whether the transaction was submitted, a request exists, its proof was accepted and its callback reached the game.

A browser refresh or RPC timeout should recover the same round. If proof acceptance succeeded but delivery failed, retry delivery of its stored word. If no proof was accepted before expiry, follow the request's refund terms and the game's previously announced failure policy. The service rules distinguish accepted proofs, callback delivery, same-word retries and expired requests.

A player should never improve an initiative order by refreshing the page or provoking a failed delivery. The game's state machine must enforce that rule; hiding a redraw button is insufficient.

Ask for tests with observable outcomes

Give the coding agent acceptance criteria before reviewing its implementation. Ask it to show how local tests exercise these rules:

  1. Repeated start actions create at most one request for a round.
  2. Two rooms requesting together cannot receive each other's stored order.
  3. Unknown request IDs and unauthorized callbacks cannot advance a round.
  4. Every resolved permutation contains all four roster positions exactly once.
  5. A pending round retains its roster after reconnection or a page refresh.
  6. Failed delivery and expiry follow different application paths.

Keep local checks and chain evidence distinct

A mock coordinator can test application behavior, but it does not establish genuine drand or VRF verification. Plan a separate Arc Testnet check with the actual coordinator, retaining the consumer deployment, request and fulfillment transactions. Label the records according to what was actually tested.

This article specifies a design and its acceptance criteria; it does not report a deployed game or completed integration test. Before using it in a live application, review the generated contract and run the tests against your implementation.

Make the order inspectable

Give players a round record containing the ordered roster, its commitment, chain, consumer address, request ID, mapped order and Explorer link.

For independent verification, collect the epoch packet and accepted proof, match the request context and reproduce the mapping with the SDK. Check canonical receipts and the implementation and configuration active for those records separately.

Showing a plausible four-player permutation is insufficient. The record must connect that order to this room's accepted request and frozen roster.

Review the application boundary

Review the security model, including operator availability, beacon assumptions and upgrade authority. A valid randomness proof does not establish that the game enforced registration, that every round was submitted or that the frontend displayed the committed players.

Ask the coding agent for the changed files, test results, transaction references and unresolved assumptions. Keep the first implementation focused on initiative order. A clear feature boundary and an inspectable round record make the work easier to review as the game grows.