arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.11522cs.DC
收藏

状态双生:一种链下子层,用于在去中心化金融协议上进行代理推理

State Twins: An Off-Chain Substrate for Agentic Reasoning over Decentralized Finance Protocols

DeFiMind

Ian C. Moore

AI总结:

本文提出State Twin,一种链下子层,用于在去中心化金融协议上进行代理推理。通过将AMM池建模为离散时间受控动态系统,提供精确数学模型和操作扩展能力,实现快速回放和反事实模拟。

摘要:

我们介绍了State Twin:一种类型化、内存中、可回放的链上自动市场机制(AMM)池的副本,用作去中心化金融(DeFi)协议上代理推理的子层。当前代理DeFi堆栈将推理与链时间耦合,因为每个“如果...”查询都会产生新的RPC读取或真实交易,因此代理的有效动作空间受限于区块确认延迟和气体。我们主张这种耦合是结构问题而非性能问题,缺失的层是一个链下子层,该子层保留协议的精确数学,同时允许链上状态操作无法实现的操作:分支、回放、反事实滚动。我们正式将每个AMM家族(Uniswap V2、V3、Balancer、Stableswap)建模为离散时间受控动态系统,证明了双生与链之间差异的定量保真度界限,并给出了DeFiPy v2中使用的开放架构,这是一个开源的Python工具包,提供了State Twin子层和参考Model Context Protocol服务器,该服务器暴露了类型化分析原语作为LLM工具。相同的原始(即一个Python类,一个调用模式)服务于笔记本量化、回测和LLM代理而无需修改。最后,我们以fork-and-evaluate工作示例结束:一个活的RPC读取种子N个独立的内存双生体,以不同的价格冲击场景进行模拟,在亚秒内完成。贡献是子层,而非特定代理,即该规范定义了代理DeFi子层必须看起来什么样的。

英文摘要:

We introduce the State Twin: a typed, in-memory, replayable replica of an on-chain automated market maker (AMM) pool that serves as a substrate for agentic reasoning over decentralized finance (DeFi) protocols. Agentic DeFi stacks today couple reasoning to chain time, since every "what if?" query incurs a new RPC read or a real transaction, so the agent's effective action space is bounded by block confirmation latency and gas. We argue this coupling is a structural problem rather than a performance one, and that the missing layer is an off-chain substrate that preserves the protocol's exact mathematics while admitting the operations on-chain state cannot: forking, replay, branching, counterfactual rollout. We formalize each AMM family (Uniswap V2, V3, Balancer, Stableswap) as a discrete-time controlled dynamical system, prove a quantitative fidelity bound on the divergence between twin and chain, and give the open architecture used in DeFiPy v2, an open-source Python toolkit that ships the State Twin substrate and a reference Model Context Protocol server exposing typed analytical primitives as LLM tools. The same primitive (i.e., one Python class, one calling pattern) serves a notebook quant, a backtest, and an LLM agent without modification. We close with a fork-and-evaluate worked example: a single live RPC read seeds N independent in-memory twins under distinct price-shock scenarios, in sub-second wall-clock time. The contribution is the substrate, not a particular agent, which is what the specification of what an agentic DeFi substrate must look like

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑