Paper deep dive
Werracle: Sub-Cent Intra-Block AI Reflex Oracles and Flash-Loan Circuit Breakers for EVM Smart Contracts
Volkan Dağlı, Zerrin Dağlı, Dağhan Dağlı
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 93%
Last extracted: 9/28/2026, 3:27:40 AM
Summary
The paper introduces Werracle, a zero-storage on-chain AI decision oracle for EVM smart contracts that utilizes procedural Mandelbrot escape dynamics to perform sub-millisecond, intra-block inference. Unlike Zero-Knowledge Machine Learning (ZK-ML) approaches which suffer from high latency and gas costs, Werracle fits within a single 32-byte storage slot using fixed-point arithmetic, enabling real-time defense against DeFi exploits like flash-loan attacks and MEV. It is demonstrated via a Uniswap v4 dynamic fee hook that adjusts fees based on orderbook turbulence.
Entities (10)
Relation Signals (7)
Volkan Dağlı → authored → Werracle
confidence 95% · Corresponding Lead Author: Volkan Dağlı... Here, we present Werracle
Werracle → implements → WerracleFeeHook.sol
confidence 95% · We demonstrate real-world DeFi efficacy via WerracleFeeHook.sol, a Uniswap v4 dynamic swap fee governor
WerracleFeeHook.sol → integrateswith → Uniswap V4
confidence 95% · WerracleFeeHook.sol, a Uniswap v4 dynamic swap fee governor that measures orderbook turbulence on-the-fly
Werracle → mitigates → Flash-Loan
confidence 95% · Werracle: Sub-Cent Intra-Block AI Reflex Oracles and Flash-Loan Circuit Breakers... neutralizing predatory margins
Werracle → uses → Mandelbrot Set
confidence 95% · Werracle derives continuous non-linear decision hyperplanes from a 24-byte coordinate triplet... Leveraging foundational procedural Mandelbrot escape dynamics
Werracle → outperforms → ZK-ML
confidence 90% · Werracle achieves an 18x gas reduction and over 1,000x latency reduction compared to ZK-ML proving architectures.
Werracle → uses → WerrMath.sol
confidence 90% · Implemented in pure Solidity bytecode using fixed-point Q16.16 arithmetic (WerrMath.sol)
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Contemporary on-chain artificial intelligence (AI) encounters an intractable Von Neumann memory and latency wall. Storing static floating-point neural weight matrices inside Ethereum Virtual Machine (EVM) storage costs millions of gas, rendering direct on-chain inference impossible. While Zero-Knowledge Machine Learning (ZK-ML) offloads matrix tensor multiplications to off-chain provers, it introduces fatal constraints: 10 to 300 seconds of SNARK proving latency and 250,000 to 500,000 gas per proof verification. Because decentralized finance (DeFi) exploits - such as uncollateralized flash-loan attacks, predatory sandwich MEV, and toxic loss-versus-rebalancing (LVR) flow - occur atomically inside a single block, ZK-ML oracles cannot react in time. Here, we present Werracle, a production-grade, zero-storage on-chain AI decision oracle fitting inside a single 32-byte EVM storage slot (bytes32). Leveraging foundational procedural Mandelbrot escape dynamics (z_{n+1} = z_n^2 + c) established by Dagli et al. (arXiv:2609.25498), Werracle derives continuous non-linear decision hyperplanes from a 24-byte coordinate triplet Theta = (c_x, c_y, zoom). Implemented in pure Solidity bytecode using fixed-point Q16.16 arithmetic (this http URL), Werracle evaluates a 16-point Pareto micro-grid in only 21,438 gas (under 0.0005 USD on Layer-2 rollups like Base and Arbitrum) with sub-millisecond execution latency. We demonstrate real-world DeFi efficacy via this http URL, a Uniswap v4 dynamic swap fee governor that measures orderbook turbulence on-the-fly and atomically adjusts liquidity provider fees between 0.05% and 0.50%. The protocol is formally verified against a 1,000-test cryptographically sealed deterministic verification suite (100.0% pass rate) with telemetry permanently disabled, operating live on a dedicated EVM devnet sandbox (Chain ID 4242).
Tags
Links
- Source: https://arxiv.org/abs/2609.30719v1
- Canonical: https://arxiv.org/abs/2609.30719v1
Trouble viewing inline? Open PDF directly →
Full Text
14,905 characters extracted from source content.
Expand or collapse full text
Werracle: Sub-Cent Intra-Block AI Reflex Oracles and Flash-Loan Circuit Breakers for EVM Smart Contracts Volkan Dağlı Affiliation: ITOUCH Bilişim Sistemleri Ltd. Şti., Çukurova Teknokent, Adana, Türkiye Affiliation: Anadolu University, Eskişehir, Türkiye Affiliation: ORCID: 0009-0000-1587-8703 Zerrin Dağlı Affiliation: Mersin University, Mersin, Türkiye Affiliation: ORCID: 0000-0001-9490-6425 Dağhan Dağlı Affiliation: Toros Science High School, Mersin, Türkiye Affiliation: ORCID: 0009-0003-2492-8313*Corresponding Lead Author: Volkan Dağlı (Contact: vdagli@itouch.com.tr, pcworm@pcworm.net) September 2026 Abstract Abstract—Contemporary on-chain artificial intelligence (AI) encounters an intractable Von Neumann memory and latency wall. Storing static floating-point neural weight matrices inside Ethereum Virtual Machine (EVM) storage costs millions of gas, rendering direct on-chain inference impossible. While Zero-Knowledge Machine Learning (ZK-ML) offloads matrix tensor multiplications to off-chain provers, it introduces fatal constraints: 10 to 300 seconds of SNARK proving latency and 250,000 to 500,000 gas per proof verification. Because decentralized finance (DeFi) exploits - such as uncollateralized flash-loan attacks, predatory sandwich MEV, and toxic loss-versus-rebalancing (LVR) flow - occur atomically inside a single block, ZK-ML oracles cannot react in time. Here, we present Werracle, a production-grade, zero-storage on-chain AI decision oracle fitting inside a single 32-byte EVM storage slot (bytes32). Leveraging foundational procedural Mandelbrot escape dynamics (zn+1=zn2+cz_n+1=z_n^2+c) established by Dağlı et al. (arXiv:2609.25498), Werracle derives continuous non-linear decision hyperplanes from a 24-byte coordinate triplet Θ=(cx,cy,zoom) =(c_x,c_y,zoom). Implemented in pure Solidity bytecode using fixed-point Q16.16 arithmetic (WerrMath.sol), Werracle evaluates a 16-point Pareto micro-grid in only 21,438 gas (under $0.0005 on Layer-2 rollups like Base and Arbitrum) with sub-millisecond execution latency. We demonstrate real-world DeFi efficacy via WerracleFeeHook.sol, a Uniswap v4 dynamic swap fee governor that measures orderbook turbulence on-the-fly and atomically adjusts liquidity provider fees between 0.05% and 0.50%. The protocol is formally verified against a 1,000-test cryptographically sealed deterministic verification suite (100.0% pass rate) with telemetry permanently disabled, operating live on a dedicated EVM devnet sandbox (Chain ID 4242). Keywords: On-Chain AI, EVM Smart Contracts, Zero-Storage Oracle, Fixed-Point Q16.16 Math, Uniswap v4 Hooks, Flash-Loan Circuit Breakers, ZK-ML Alternative, Patent Pending TR 2026/016285. 00footnotetext: Smart contracts, test vectors, reproduction scripts, and live devnet status are publicly available at GitHub repository: https://github.com/pCwOrM/werracle, interactive documentation: https://pcworm.github.io/werracle/apidocs.html, and Zenodo replication package: DOI: 10.5281/zenodo.22942598 [12]. Companion theoretical foundations: arXiv:2609.25498 [6]. 1 Introduction The operational integrity of decentralized finance (DeFi) fundamentally depends on atomic execution guarantees. In contemporary automated market maker (AMM) pools and collateralized lending markets, a malicious actor can borrow tens of millions of dollars without upfront capital via uncollateralized flash-loans, manipulate liquidity pool tick distributions, extract extracted value via arbitrage, and repay the loan within the atomic boundaries of a single Ethereum transaction [1, 2]. To resist such exploits, protocols require sub-millisecond, intra-block defensive reflexes. However, embedding machine learning natively within Ethereum Virtual Machine (EVM) smart contracts has historically been considered mathematically intractable due to the Von Neumann memory wall [3]. A modest multilayer perceptron with 100,000 FP32 weights demands 400 KB of data; storing this directly via EVM SSTORE opcodes incurs over 2.5 billion gas (>$100,000>\$100,000 on Ethereum Mainnet). To bypass on-chain storage, Zero-Knowledge Machine Learning (ZK-ML) frameworks (such as EZKL and Modulus Labs) generate cryptographic proofs off-chain and verify them on-chain [4, 5]. While cryptographically elegant, ZK-ML incurs fatal operational trade-offs: 1. Proving Latency: SNARK proof generation for neural inference requires 10 to 300 seconds of dedicated GPU time. By the time a proof is submitted to the mempool, the victim protocol has already suffered total reserve depletion. 2. Verification Overhead: Evaluating pairing equations on-chain consumes 250,000 to 500,000 gas (∼$10 \$10 to $25\$25), rendering continuous invocation economically prohibitive for everyday decentralized exchanges. 3. Liveness and Trust Risks: Reliance on off-chain prover farms re-establishes centralized points of failure, counteracting the ethos of autonomous smart contracts. In this paper, we introduce Werracle, an EVM-native procedural AI decision oracle that eliminates external neural weights, off-chain provers, and persistent storage arrays entirely. 2 Procedural Decision Synthesis Building upon the mathematical foundations established in the WERR architecture [6, 7], Werracle replaces dense matrix tensors with the non-linear morphological escape dynamics of the Mandelbrot set ℳM [8]: zn+1=zn2+c,z0=0,c=cx+icyz_n+1=z_n^2+c, z_0=0, c=c_x+ic_y (1) A complex classification boundary is parameterized by an invariant 24-byte coordinate triplet: Θ=(cx,cy,zoom)∈ℝ3 =(c_x,c_y,zoom) ^3 (2) Rather than querying static weights, normalized transaction feature vectors are mapped to an affine coordinate perturbation (Δcx,Δcy)( c_x, c_y). The contract evaluates the local escape velocity: ℰ(c)=minn∈ℕ:|zn|>2.0E(c)= \n :|z_n|>2.0\ (3) Points positioned precisely on the boundary cusp ∂ℳ exhibit deterministic sensitivity, yielding an organic non-linear decision boundary without persistent parameter arrays. 3 EVM Opcode and Storage Packing To minimize EVM state bloat, Werracle compresses the entire model into a single 32-byte EVM storage word (bytes32). Listing 1: Bit-Level Storage Packing of bytes32 Slot ⬇ // [255..192] cx : 64-bit int Q16.16 (signed) // [191..128] cy : 64-bit int Q16.16 (signed) // [127..64] zoom : 64-bit int Q16.16 // [63..48] threshold : 16-bit uint // [47..32] nonce : 16-bit uint // [31..0] flags : 32-bit security/domain flags This architectural packing yields two fundamental benefits: • Warm SLOAD Optimization: Following the initial warm access, subsequent reads of the model parameters cost exactly 100 gas. • Zero Memory Expansion: The oracle operates without allocating dynamic memory arrays, avoiding quadratic EVM memory expansion penalties. Figure 1: End-to-end Werracle on-chain architecture. Incoming transaction metrics (volume, tick velocity, address) are normalized into coordinate shifts. The core engine queries a single 32-byte EVM storage word (Θ=(cx,cy,zoom) =(c_x,c_y,zoom)), evaluates Mandelbrot escape dynamics across a 16-point Pareto micro-grid using fixed-point Q16.16 arithmetic (. WerrMath.sol), and executes intra-block circuit breaking or fee adjustments in 21,438 gas with sub-millisecond latency. 4 Fixed-Point Bytecode Arithmetic Because the EVM natively supports only integer arithmetic, we engineered WerrMath.sol, a fixed-point Q16.16 library where 1.01.0 is represented as 216=65,5362^16=65,536. Fixed-point multiplication uses a 128-bit intermediate widening followed by an arithmetic right-shift: a×FPb=(a⋅b)≫16a×_FPb=(a· b) 16 (4) The complex escape condition |z|2=zx2+zy2>4.0|z|^2=z_x^2+z_y^2>4.0 is tested against the integer constant 262,144262,144. To determine decision confidence, Werracle evaluates a 16-point (4×44× 4) Pareto micro-grid centered at the perturbed coordinate. The proportion of non-escaping points (RbR_b) determines the categorical classification: noul(x)=true (Permit),if Rb≥τfalse (Revert),otherwisenoul(x)= casestrue (Permit),&if R_b≥τ\\ false (Revert),&otherwise cases (5) Table 1: Opcode-Level EVM Gas Profiling Execution Phase EVM Gas USD (Base L2) Slot SLOAD & Bit Unpacking 2,342 gas $0.00004 16-Point Q16.16 Iteration 14,810 gas $0.00029 Pareto Density Aggregation 2,416 gas $0.00005 Event Log & ABI Return 1,870 gas $0.00003 Total Forward Inference 21,438 gas ¡ $0.00042 5 DeFi Integration: Uniswap v4 Dynamic Fee Hook As a canonical demonstration, we implemented WerracleFeeHook.sol, an autonomous dynamic fee governor for Uniswap v4 liquidity pools [9]. In constant product and concentrated liquidity AMMs, passive liquidity providers suffer from toxic Loss-Versus-Rebalancing (LVR) when informed traders front-run price changes [10, 11]. WerracleFeeHook.sol intercepts swaps via the beforeSwap callback, evaluating instantaneous pool turbulence: γ=fWerracle(ΔVolume,ΔTickVelocity)∈[0.05%,0.50%]γ=f_Werracle( , )∈[0.05\%,0.50\%] (6) During calm orderflow, swap fees drop to 0.05% to capture retail routing volume. Under volatile or flash-loan attack conditions, fees dynamically scale up to 0.50%, neutralizing predatory margins and shielding liquidity providers atomically within the swap transaction. 6 Comparative Empirical Evaluation Table 2 and Figure 2 benchmark Werracle against traditional centralized oracles and contemporary ZK-ML proving architectures. Table 2: Architectural Benchmark Comparison Feature Web2 Oracle ZK-ML (EZKL) Werracle Model Weights Gigabytes Off-chain Prover 0 Bytes EVM Storage N/A Verification Keys 32 Bytes (1 Slot) Proving Latency 12–36 s 10–300 s ¡ 1 ms (Atomic) Verification Gas ∼ 60,000 gas ∼ 380,000 gas 21,438 gas Intra-Block Revert No No Native Hardware Requirements Server Node Dedicated GPU Cluster None (Pure EVM) Liveness Risk Centralized Signer Failure Prover Outage Zero (Autonomous) Figure 2: Architectural benchmark comparisons: (a) On-chain verification gas cost across Web2 oracles, ZK-ML (EZKL), and Werracle. (b) Inference and proving latency in seconds (logarithmic scale). Werracle achieves an 18× gas reduction and over 1,000× latency reduction compared to ZK-ML proving architectures. Werracle achieves a 1,000× latency reduction and an 18× gas reduction relative to state-of-the-art ZK-ML provers, enabling intra-block circuit breaking for the first time in EVM history. 7 Cryptographically Sealed Verification To guarantee complete determinism across EVM bytecode, Python simulators, and client runtimes, Werracle was subjected to a 1,000-Test Master Verification Battery: • 250 Fixed-Point Invariance Tests: Validating exact concordance with Float64 ground truth. • 250 Flash-Loan Exploit Reverts: Testing automated circuit breaker triggers under extreme liquidity shifts. • 250 AML/OFAC Sanction Traps: Validating multi-dimensional address classification. • 250 Uniswap v4 Dynamic Fee Regimes: Confirming fee scaling boundaries without out-of-gas errors. All 1,000 test vectors passed with 100.0% deterministic parity. Results, gas snapshots, and bytecode receipts are sealed under SHA-256 digest in SEAL_MANIFEST.json. 8 Privacy by Design: Zero Telemetry In contrast to Web3 RPC gateways that harvest user IP addresses and transaction telemetry, Werracle enforces absolute operational privacy. All diagnostic logging and external listeners are permanently disabled (TELEMETRY_ENABLED = False). All decision evaluations execute exclusively inside the EVM sandbox, ensuring complete computational sovereignty for institutional participants. 9 Conclusion and Code Availability Werracle introduces a foundational paradigm shift for on-chain machine intelligence. By discarding multi-gigabyte weight tensors in favor of procedural Mandelbrot escape dynamics, smart contracts can execute sub-millisecond, sub-cent algorithmic decisions natively within a single storage slot. All smart contracts, test vectors, and interactive sandboxes are publicly available: • GitHub Repository: https://github.com/pCwOrM/werracle • Interactive Documentation: https://pcworm.github.io/werracle/apidocs.html • Zenodo Replication Package: DOI: 10.5281/zenodo.22942598 [12] • Live EVM Node (Chain ID 4242): https://api.answerr.me:4431/werracle/status • Patent Attribution: The underlying zero-storage procedural fractal synthesis is protected under Turkish Patent Application TR 2026/016285 [13]. References [1] D. Perez and B. Livshits, “Smart contract vulnerabilities: Does anyone care?” in 2021 IEEE Symposium on Security and Privacy (SP). IEEE, 2021, p. 1142–1159. [2] K. Qin, L. Zhou, B. Livshits, and A. Gervais, “Attacking the defi ecosystem with flash loans for fun and profit,” in Financial Cryptography and Data Security. Springer, 2021, p. 3–22. [3] G. Wood, “Ethereum: A secure decentralised generalised transaction ledger,” Ethereum Project Yellow Paper, vol. 151, p. 1–32, 2014. [4] D. Kang, T. Hashimoto, I. Stoica, and Y. Sun, “Scaling up trustless machine learning with zero-knowledge proofs,” arXiv preprint arXiv:2210.08674, 2022. [5] Modulus Labs, “The cost of intelligence: On-chain machine learning benchmarks and feasibility,” Modulus Research, Tech. Rep., 2023. [6] V. Dağlı, Z. Dağlı, and D. Dağlı, “Universal fractal natural language decision map: Real-time edge triage across heterogeneous domains,” arXiv preprint arXiv:2609.25498, 2026. [7] —, “Mandelbrot fractal neural synthesis: Zero-storage procedural weight derivation and non-linear decision boundaries,” Zenodo Pre-print, doi: 10.5281/zenodo.22867037, 2026. [8] B. B. Mandelbrot, The Fractal Geometry of Nature. New York: W. H. Freeman and Company, 1982. [9] Uniswap Labs, “Uniswap v4 core whitepaper,” Uniswap Foundation, Tech. Rep., 2024. [10] J. Milionis, C. Moallemi, T. Roughgarden, and A. L. Zhang, “Automated market making and loss-versus-rebalancing,” in Proceedings of the 24th ACM Conference on Economics and Computation (EC), 2023, p. 941–942. [11] P. Daian, S. Goldfeder, T. Kell, Z. Li, X. Zhao, I. Bentov, L. Breidenbach, and A. Juels, “Flash boys 2.0: Frontrunning, transaction reordering, and consensus instability in decentralized exchanges,” arXiv preprint arXiv:1904.05234, 2020. [12] V. Dağlı, Z. Dağlı, and D. Dağlı, “Werracle: Sub-cent intra-block ai reflex oracles and flash-loan circuit breakers for evm smart contracts,” Zenodo Pre-print Replication Package, doi: 10.5281/zenodo.22942598, 2026. [13] V. Dağlı, “Yapay sinir agi parametrelerinin fraktal dinamiklerden prosedurel turetildigi sifir depolamali karar yontemi,” Turkish Patent and Trademark Office, Patent Application TR 2026/016285, 2026.