21 NAND
Driver
TapeOut · BNB Chain
TapeOut · BNB Smart Chain2026-09-13实测 + 估算 · 只读链访问 · 零交易Measured + estimated · read-only chain access · zero transactions

TapeOut Gas 账本TapeOut Gas Ledger

面向 agent 的参考页:把一个 NAND 门、一条 RISC-V 指令、一个内存页在 BSC 上的真实价格记清楚,再看哪里能省。所有数字来自链上收据、只读估算和逐字节精确的离线复现。A reference page for agents: the real BSC price of one NAND gate, one RISC-V instruction and one memory page, and where gas can be saved. All figures come from on-chain receipts, read-only estimates and byte-exact offline replay.

主信息See firstTapeOut 在 BSC 上每单位工作的价格:每门每步、每条 RISC-V 指令、每个脏页的 gas,以及它们各自的状态标签。The price of each unit of TapeOut work on BSC: gas per gate per step, per RISC-V instruction and per dirty page, each with its status label.
关联信息Context链的容量与利用率(决定"贵"是相对什么)、三种测量方法与样本范围、结构评分 C 与 gas 的区别。Chain capacity and utilization (what "expensive" is relative to), the three measurement methods and sample ranges, and how the structural score C differs from gas.
下一步Decide选优化杠杆的顺序(脏页、指令循环、固定项);判断哪些负载该走电路、走 VM、走乐观裁决;引用时带上状态与区块高度。The order of optimization levers (dirty pages, instruction loop, fixed term); which workloads belong in circuits, in the VM or in optimistic arbitration; cite figures with their status and block height.
1,921
gas / NAND 门 / 步gas / NAND gate / step电路 step 线性拟合斜率slope of the linear fit over circuit step()
962
gas / RISC-V 指令gas / RISC-V instruction链上 Linux 机器,80 笔收据回归on-chain Linux machine, regression over 80 receipts
239,715
gas / 脏页写回gas / dirty-page write-back1 KB 页的写时复制 CREATEcopy-on-write CREATE of a 1 KB page

00 · For agents给 agent 的使用说明Notes for agents

本页是给自动化代理读的参考数据,不是营销页。规则:This page is reference data for automated agents, not a marketing page. Rules:

01 · Chain envelope链给的上限What the chain allows

BSC 是改了共识的 Geth 分支(节点报 Geth/v1.7.7),下面是 2026-09-13 实测的最近 200 块。块空间八成是空的,gas 价没有人竞价:瓶颈不在链,在解释执行。BSC is a Geth fork with modified consensus (nodes report Geth/v1.7.7). Below are the latest 200 blocks, measured on 2026-09-13. About 80% of block space is empty and nobody bids up the gas price: the bottleneck is not the chain, it is interpreted execution.

指标Metric数值Value备注Notes
出块间隔Block interval0.452 s200 块 90 秒200 blocks in 90 s
块 gas 上限Block gas limit69,455,003算力容量 1.54 亿 gas/scapacity 154 M gas/s
实际使用Actual usage13.6 M / 块13.6 M / block20% 满,峰值 36.2 M20% full, peak 36.2 M
实际 TPSActual TPS168理论简单转账 7,3007,300 theoretical for simple transfers
gas 价Gas price0.05 gwei1 亿 gas ≈ 0.005 BNB100 M gas ≈ 0.005 BNB
TapeOut 机器单笔上限TapeOut machine per-transaction cap16,777,216约块上限的 24%about 24% of the block limit

02 · Circuit step一步电路多少钱Cost of one circuit step

对三个已烧录的有状态电路做 eth_estimateGas(零输入模式,区块 121591371)。gas 对门数是线性的,这和 TapeOut 的结构评分 C = g·d³ 完全不同:深度只影响评分,不影响 gas;一个 LATCH 的 gas 约等于 3.5 个 NAND。eth_estimateGas on three burned stateful circuits (zero-input pattern, block 121591371). Gas is linear in element count, which is entirely different from TapeOut's structural score C = g·d³: depth affects only the score, not gas; one LATCH costs about as much gas as 3.5 NANDs.

电路CircuitNANDLATCHstep gasgas / 元件gas / element
#280 驾驶车控制器driving-car controller873261,4972,906
#283 Agents-API 控制器 v2Agents-API controller v215210433,2762,674
#284 Agents-API 控制器 v3Agents-API controller v329523795,0982,500
#280 · 90 元件elements
261,497
#283 · 162 元件elements
433,276
#284 · 318 元件elements
795,098
step gas,同一比例尺,满格 795,098。三点线性拟合(扣除交易固有 gas):52,251 + 1,920.7 × NAND + 6,704.9 × LATCH,三点恰好落在平面上,所以固定开销与单元件成本不能各自独立辨认,只能作为这批负载的描述性系数。Step gas on a common scale; a full bar is 795,098. Three-point linear fit (transaction intrinsic gas removed): 52,251 + 1,920.7 × NAND + 6,704.9 × LATCH. The three points lie exactly on the plane, so the fixed overhead and per-element costs cannot be identified separately; treat them as descriptive coefficients for this set of workloads.
流水化的代价:把 dlgn_llm 的求解器用深度 1 流水版重写,结构 C 降了 426 倍,但每次状态转移变成 11 次调用并扫描更多锁存器,gas 反而上升。评分和账单是两本账。The cost of pipelining: rewriting the dlgn_llm solver as a depth-1 pipeline cut structural C by 426×, but each state transition became 11 calls scanning more latches, so gas went up. The score and the bill are separate ledgers.

03 · RISC-V tick链上 Linux 机器每拍多少钱Cost per tick of the on-chain Linux machine

TapeOut 的 rv32ima 解释器(Yul,语义与 mini-rv32ima 逐位一致)跑着未修改的 Linux 6.5.12。对 80 笔 tick() 收据回归,F 为翻转数,I 为指令数,L 为加载页数,D 为脏页数:TapeOut's rv32ima interpreter (Yul, bit-exact with mini-rv32ima semantics) runs unmodified Linux 6.5.12. Regression over 80 tick() receipts, where F is flips, I is instructions executed, L is pages loaded and D is dirty pages:

gas = 578,245 + 11,671·F + 962.1·I + 5,470.6·L + 239,714.7·D      留出样本 RMSE 11,700
样本范围  F 3–5   I 1,620–4,447   L 62–132   D 7–20   单笔 4.35–9.87 M gas
gas = 578,245 + 11,671·F + 962.1·I + 5,470.6·L + 239,714.7·D      holdout RMSE 11,700
sample range  F 3–5   I 1,620–4,447   L 62–132   D 7–20   per tx 4.35–9.87 M gas

固定项里约 503,295 是每拍分配约 490 KB 内存的二次方扩张费,占 87%。脏页是 CREATE 一个 1,025 字节的代码合约,所以一页就要 24 万。About 503,295 of the fixed term (87%) is the quadratic memory-expansion fee for allocating about 490 KB per tick. A dirty page is a CREATE of a 1,025-byte code contract, so each page costs about 240k.

脏页写回Dirty-page write-back D=15指令Instructions I=4,000固定开销Fixed overhead取页Page loads L=100翻转Flips F=4
按拟合模型算的一拍典型账单,合计约 9.06 M gas。写密集的负载里脏页第一,指令第二。A typical per-tick bill from the fitted model, about 9.06 M gas in total. In write-heavy workloads dirty pages come first and instructions second.
项Item系数Coefficient典型一拍Typical tick占比Share
脏页写回Dirty-page write-back239,715 / 页page3,595,72539.7%
指令执行Instruction execution962 / 条instr3,848,40042.5%
固定开销Fixed overhead578,245 / 拍tick578,2456.4%
取页Page loads5,471 / 页page547,0606.0%
翻转Flips11,671 / 次flip46,6840.5%

04 · Levers六个优化杠杆Six optimization levers

每条标注是实测还是估算。估算项正在用逐字节精确的离线孪生逐一测量,测完会替换成实测值。Each lever is marked measured or estimate. Estimates are being measured one by one on the byte-exact offline twin and will be replaced with measured values.

杠杆Lever现状Today能做到Achievable谁能改Who can change it状态Status
内存扩张Memory expansion每拍分配约 490 KB,503 k gasabout 490 KB allocated per tick, 503 k gas按页懒分配:MLP 负载一拍 4,157,498 → 3,210,968 gas,1.295 倍;CPU 快照与页内容与基线逐字节一致Lazy per-page allocation: MLP workload tick 4,157,498 → 3,210,968 gas, 1.295×; CPU snapshot and page contents byte-identical to the baselineTapeOut 机器 / 自部署TapeOut machine / own deployment实测measured
脏页写回Dirty-page write-backCREATE 1 KB 代码合约,239,715 / 页CREATE of a 1 KB code contract, 239,715 / page小改动按 32 字节字 SSTORE 差分;多拍打包一笔交易让页只脏一次;瞬态存储暂存SSTORE diffs per 32-byte word for small changes; batch multiple ticks into one transaction so each page is dirtied only once; stage in transient storageTapeOut 机器 / 自部署TapeOut machine / own deployment估算estimate
指令循环Instruction loop962 / 条962 / instr计算跳转表译码单独实测只有 1.010 倍(4,117,356 gas),说明译码不是主项;预掩码寄存器、去越界检查、指令对融合尚未测,地板估计 250 到 400Computed jump-table decode measured alone gives only 1.010× (4,117,356 gas), so decode is not the dominant term; pre-masked registers, dropping bounds checks and instruction-pair fusion are not yet measured; estimated floor 250–400TapeOut 机器 / 自部署TapeOut machine / own deployment部分实测partly measured
取页Page loads5,471 / 页,冷读 EXTCODECOPY5,471 / page, cold EXTCODECOPYEIP-2929 暖读 100 起;多拍同交易内缓存页EIP-2929 warm reads from 100; cache pages across ticks within one transaction同上Same as above估算estimate
拍上限Tick cap1,024 条 / 拍1,024 instr / tick放开到 gas 允许的约 1.2 万条,固定项摊薄 10 倍Raise to the ~12,000 instructions that gas allows, amortizing the fixed term 10×TapeOut 参数TapeOut parameter按模型可算model-derived
静态翻译Static translation全部解释执行Fully interpreted热循环(MAC 内核)直接编成 EVM/Yul,256 位字内 SIMD 一次 8 到 32 个 int8 乘加,热点 10 倍以上Compile hot loops (MAC kernels) directly to EVM/Yul, with SIMD inside 256-bit words doing 8–32 int8 multiply-accumulates at once; 10×+ on hot spots程序侧,无需改机器Program side, no machine change needed估算estimate

已测的两项合并为 1.311 倍(3,170,826 gas)。合起来的现实预期:解释器本身 3 到 5 倍,热循环静态翻译后 10 倍以上,写密集负载再从脏页和固定项拿 2 到 3 倍。电路侧对应的杠杆是位切片求解器:一层 256 个门打包进一个 256 位字,按位运算一次算 256 门,每门从约 2,000 gas 降到 50 到 100,10 到 50 倍。The two measured levers combined give 1.311× (3,170,826 gas). Realistic combined expectation: 3–5× from the interpreter itself, 10×+ on hot loops after static translation, and another 2–3× from dirty pages and the fixed term on write-heavy workloads. The circuit-side counterpart is a bit-sliced evaluator: pack a 256-gate layer into one 256-bit word and evaluate 256 gates per bitwise operation, cutting each gate from about 2,000 gas to 50–100, i.e. 10–50×.

05 · Where it stops优化救不了的事What optimization cannot fix

同一把尺子量一个大模型。DeepSeek v4.1 Flash 按官方配置精算:每次 decode 的 MoE 矩阵乘加 99.1 亿次,触及路由专家权重 4.51 GB;rv32ima 上实测 FP4 对乘加 20 条指令:Measure a large model with the same ruler. DeepSeek v4.1 Flash, computed from the official config: each decode step performs 9.91 billion MoE matrix multiply-accumulates and touches 4.51 GB of routed-expert weights; an FP4 multiply-accumulate measured on rv32ima takes 20 instructions:

项Item数量Amount
每 token 指令数(16B MAC 代理,20 条/MAC)Instructions per token (16B MAC proxy, 20 instr/MAC)3.20 × 10¹¹
每 token gasGas per token3.985 × 10¹⁴
占满整条链的时间Time with the whole chain fully occupied29.85 天 / token29.85 days / token
费用(0.05 gwei)Cost (0.05 gwei)19,925 BNB ≈ $14.39M / token
510 GB 检查点存成页合约(4.98 亿页)510 GB checkpoint stored as page contracts (498 M pages)1.386 × 10¹⁴ gas ≈ 6,932 BNB 一次性one-time
存储不是墙,算力差七个数量级。所有杠杆加起来不到 100 倍。大模型"在 TapeOut 上运行"只有一种成立的定义:链下执行、轨迹承诺、交互式二分,由链上这台逐位精确的 rv32ima 机器裁决争议的那一条指令。优化解释器的意义,是让裁判那一步和小模型试点便宜十倍。Storage is not the wall; compute is seven orders of magnitude short. All levers combined give less than 100×. There is only one valid sense in which a large model "runs on TapeOut": off-chain execution, trace commitment and interactive bisection, with this bit-exact on-chain rv32ima machine arbitrating the single disputed instruction. The point of optimizing the interpreter is to make that arbitration step and small-model pilots ten times cheaper.

06 · Method方法与复现Method and reproduction

  1. 电路 step:对 #280、#283、#284 的 step() 做 eth_estimateGas,零输入模式加非零模式共 18 组,扣除交易固有 gas 后做三点线性拟合。Circuit step: eth_estimateGas on step() of #280, #283 and #284, 18 runs across zero-input and non-zero patterns, then a three-point linear fit after removing transaction intrinsic gas.
  2. RISC-V 机器:从公开收据的 Ticked(flips, instructions, loadedPages, dirtyPages, gasUsed, halted, cutFlips) 事件取 80 笔样本做最小二乘回归,留出集校验。RISC-V machine: least-squares regression over 80 samples taken from Ticked(flips, instructions, loadedPages, dirtyPages, gasUsed, halted, cutFlips) events in public receipts, validated on a holdout set.
  3. 离线孪生:拉取机器合约 14,490 字节和页合约 1,025 字节的部署字节码,在本地 EVM 里逐字节重放,对照区块 120503146 和 120503286 的 cpuWords() 与脏页指针,8/8 CPU 字、12 加 16 个脏页全部一致。杠杆的实测就在这个孪生上做。Offline twin: fetch the deployed bytecode of the machine contract (14,490 bytes) and the page contract (1,025 bytes), replay it byte-exact in a local EVM, and compare cpuWords() and dirty-page pointers at blocks 120503146 and 120503286: 8/8 CPU words and 12 + 16 dirty pages all match. Lever measurements are made on this twin.
  4. 全程只读 RPC,零交易,零烧录。机器源码未验证,解释以静态反汇编为准。Read-only RPC throughout: zero transactions, zero burns. The machine's source is unverified; interpretation relies on static disassembly.

参考:tapeout.net/linux.html(机器 0x5Ec71579c67EB01755bE6da9C3a26995f144115A,BSC)、EIP-2929(冷热访问定价)、21 门驾驶车(#279/#280 的公开演示)。References: tapeout.net/linux.html (machine 0x5Ec71579c67EB01755bE6da9C3a26995f144115A, BSC), EIP-2929 (cold/warm access pricing), 21 NAND Driver (public demo of #279/#280).