自动化您的链上游戏循环
Games for Pennies
链上自动化所需的一切
一个完整的去中心化、权限控制且经济高效的智能合约自动化协议。
去中心化循环执行
链下工作节点自动检测您的合约是否就绪并执行游戏循环。无中心化服务器,无单点故障。
内置可验证随机性
原生 ECVRF 证明生成与链上验证。每次 tick 都提供可证明公平的随机性,适用于骰子投掷、战利品掉落等场景——无需外部预言机。
Hybrid VRF——按需随机性
标准成本的 tick,仅在您的合约请求时使用 VRF。您的游戏决定何时需要随机性——战利品掉落、暴击、刷怪——仅在这些 tick 上支付 VRF gas。10% VRF 混合成本约 ~$0.009/tick。
按执行收费模型
仅在循环实际运行时付费。Gas 补偿加上少量基础费用,由协议和控制器分成。透明且可预测。
开发者友好
简单函数,直接 hook。包含示例合约。
多网络支持
部署在 Ethereum 主网、Sepolia 测试网或本地 Anvil 开发环境。支持按网络配置和自动化部署工具。
权限控制与安全
基于角色的访问控制确保只有注册的控制器才能触发循环。链上 VRF 验证防止操控。
Every Loop Here Fails the Self-Trigger Test
Games, agents, DeFi, AI — each for a different structural reason. Not design choices. Proofs.
Inverted self-interest
Every VRF tick picks a random floor and damages it. No floor owner will ever trigger the loop — it might hit their own asset. A neutral keeper is the only viable operator.
Nobody should hold the trigger
A dead man's switch that transfers your vault to a beneficiary if you miss a check-in window. The whole point is that no human should control when it fires.
Front-running attack surface
VRF selects winners from a registered pool on schedule. If player-controlled, the trigger holder knows who wins before calling. AutoLoop fires first, asks questions never.
Timing as attack surface
The high bidder wants the auction closed now. Counter-bidders want an extension. No player-controlled trigger is fair — proving the problem extends far beyond randomness.
4-way coordination failure
Third hop in KaijuLeague → KaijuOracle → ForecasterLeaderboard. Adversarial timing, cross-contract dependency, free-rider gas, prize-pool timing attack — no single player resolves all four.
Neutral on-chain schedule
An LLM agent that runs off-chain and acts on-chain every N blocks. The agent itself shouldn't decide when it fires — its operator, users, and rivals all have conflicting interests.
4 步即可启动运行
从合约到自动化游戏循环,只需几分钟,而非数月。
继承
继承三个基础合约之一:
- •AutoLoopCompatible — 纯自动化
- •AutoLoopHybridVRFCompatible — 选择性随机(战利品、暴击、刷怪)
- •AutoLoopVRFCompatible — 每次 tick 的随机性
实现
添加 shouldProgressLoop() 来信号就绪状态,以及 progressLoop() 来执行您的游戏逻辑。
注册与充值
在链上注册您的合约并存入 ETH 以支付 gas 和费用。
让它运行
工作节点自动检测并执行您的循环。坐享其成,看您的游戏活起来。
几分钱玩游戏
三个层级的链上自动化——从纯执行到每次 tick 的 Full VRF。以下是当前 gas 价格下各层级的成本。
费用明细
设计至简
只需两个函数即可集成 Autoloop。以下是一个完整的可运行合约。
1// SPDX-License-Identifier: MIT2pragma solidity ^0.8.13;34// Import the base contract that makes any5// contract compatible with AutoLoop workers6import {AutoLoopCompatible} from7 "autoloop/AutoLoopCompatible.sol";89// A simple demo: number goes up every interval10contract NumberGoUp is AutoLoopCompatible {11 uint256 public number;12 uint256 public interval;13 uint256 public lastTimeStamp;14 uint256 private _loopID;1516 constructor(uint256 _interval) {17 interval = _interval;18 lastTimeStamp = block.timestamp;19 }2021 // Workers call this every block to check22 // if the contract is ready for an update23 function shouldProgressLoop()24 external view override25 returns (26 bool loopIsReady,27 bytes memory progressWithData28 )29 {30 // Ready when enough time has passed31 loopIsReady =32 (block.timestamp - lastTimeStamp) > interval;33 // Pass loop ID to prevent duplicate runs34 progressWithData = abi.encode(_loopID);35 }3637 // Called by AutoLoop when shouldProgressLoop38 // returns true — this is your update logic39 function progressLoop(40 bytes calldata progressWithData41 ) external override {42 uint256 loopID =43 abi.decode(progressWithData, (uint256));44 // Guard against stale or replayed calls45 require(loopID == _loopID, "stale loop");46 lastTimeStamp = block.timestamp;47 ++number;48 ++_loopID;49 }50}看看我们与 Chainlink 的对比
三种自动化模式——Standard、Hybrid VRF 和 Full VRF——合为一个协议。无需单独订阅。每个层级都比 Chainlink 更便宜。