Sorcerer Duel (Arcane Circle Duels)
Continuous autonomous duels with VRF-weighted outcomes and mana attrition.
Overview
Sorcerer Duel is a persistent arcane-circle loop where duels resolve autonomously on a fixed schedule. Sorcerers lose mana every duel, creating a negative-EV game that nobody self-triggers.
| Property | Value |
|---|---|
| Base contract | AutoLoopVRFCompatible |
| VRF usage | Every tick (full VRF) |
| Gas per tick | ~73k (4 duelists) to ~93k (8 duelists) |
| Source | autoloop/src/games/SorcererDuel.sol |
| Tests | 44 passing (unit + fuzz) |
Why AutoLoop Is Structurally Required
Two independent reasons:
- Timing as attack surface: if a duelist could trigger the duel, they could pick the block in which the VRF reveal lands and only submit if their sorcerer benefits.
- Negative-EV free-rider: every duelist loses 5-20 mana per duel, only one wins the pot. Rational sorcerers reason "let someone else pay gas." Everyone reasons identically, so nobody triggers.
Game Mechanics
- Sorcerers: summoned at a fixed fee with initial mana (e.g., 500). Mana decreases with each duel via VRF-derived drain.
- Duels: require 2+ duelists. Each duelist pays an entry fee. Winner is selected proportionally to mana (weighted VRF).
- Mana drain: 5-20 mana per duel for every duelist, derived from
keccak256(randomness, sorcererId, "drain"). Sorcerers hittingminManaare banished. - Prize pool: entry fees minus protocol rake. Winner receives via pull-payment.
Revenue Model
- Sorcerer summon fees (100% to protocol)
- 5% rake on every duel prize pool
- AutoLoop gas fees on each tick
Deploy
forge create src/games/SorcererDuel.sol:SorcererDuel \
--constructor-args 10000000000000000 1000000000000000 60 500 500 50 8 \
--rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcastArgs: summonFee, entryFee, duelInterval, protocolRakeBps, initialMana, minMana, maxDuelists.
Keeper Trust Model
Participants cannot predict or influence VRF outcomes — the keeper's private key is required to generate a valid proof. The keeper knows its own output before submission but has no stake in who wins (it earns a gas fee regardless of the result).
Multiple independent controllers are registered per contract, each producing a different VRF result for the same seed. If one withholds its submission, another submits with a completely independent outcome. Manipulating the final result requires ALL registered controllers to collude simultaneously.
VRF Key Registration
After deploying, register each controller worker's ECVRF public key:
sorcererDuel.registerControllerKey(controllerAddress, pkX, pkY);Without registration, VRF proof verification reverts on every tick. Use register-vrf-keys.js in the AutoLoop worker:
NETWORK=sepolia VRF_CONTRACTS=<sorcererDuelAddress> node scripts/register-vrf-keys.jsDashboard
Play Sorcerer Duel on the AutoLoop Dashboard.