面向 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 first | TapeOut 在 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. |
本页是给自动化代理读的参考数据,不是营销页。规则:This page is reference data for automated agents, not a marketing page. Rules:
gas_model.json,也内嵌在本页 <script id="gas-model" type="application/json"> 里;字段名为英文 snake_case,单位默认 gas。Machine-readable versions of all figures are in gas_model.json in the same directory, and are also embedded in this page as <script id="gas-model" type="application/json">; field names are English snake_case and units default to gas.measured 来自链上收据、eth_estimateGas 或逐字节精确的本地重放;estimate 是尚未测量的分析值;model 是按已拟合公式推算。引用时请连状态一起引用。Every figure carries a status: measured comes from on-chain receipts, eth_estimateGas or byte-exact local replay; estimate is an analytical value not yet measured; model is derived from a fitted formula. Always cite the status with the figure.gas = 52250.58 + 1920.69*NAND + 6704.92*LATCH;机器 gas = 578245 + 11671*F + 962.12*I + 5470.59*L + 239714.66*D。样本范围外的外推自负。The formulas can be used directly: circuit gas = 52250.58 + 1920.69*NAND + 6704.92*LATCH; machine gas = 578245 + 11671*F + 962.12*I + 5470.59*L + 239714.66*D. Extrapolation beyond the sample ranges is at your own risk.curl 即可读全文;updated 字段是数据日期,链上参数会漂移,用前核对区块高度。The page is static with no script-rendered content; curl returns the full text (both languages). The updated field is the data date; on-chain parameters drift, so check the block height before use.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 interval | 0.452 s | 200 块 90 秒200 blocks in 90 s |
| 块 gas 上限Block gas limit | 69,455,003 | 算力容量 1.54 亿 gas/scapacity 154 M gas/s |
| 实际使用Actual usage | 13.6 M / 块13.6 M / block | 20% 满,峰值 36.2 M20% full, peak 36.2 M |
| 实际 TPSActual TPS | 168 | 理论简单转账 7,3007,300 theoretical for simple transfers |
| gas 价Gas price | 0.05 gwei | 1 亿 gas ≈ 0.005 BNB100 M gas ≈ 0.005 BNB |
| TapeOut 机器单笔上限TapeOut machine per-transaction cap | 16,777,216 | 约块上限的 24%about 24% of the block limit |
对三个已烧录的有状态电路做 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.
| 电路Circuit | NAND | LATCH | step gas | gas / 元件gas / element |
|---|---|---|---|---|
| #280 驾驶车控制器driving-car controller | 87 | 3 | 261,497 | 2,906 |
| #283 Agents-API 控制器 v2Agents-API controller v2 | 152 | 10 | 433,276 | 2,674 |
| #284 Agents-API 控制器 v3Agents-API controller v3 | 295 | 23 | 795,098 | 2,500 |
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.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.
| 项Item | 系数Coefficient | 典型一拍Typical tick | 占比Share |
|---|---|---|---|
| 脏页写回Dirty-page write-back | 239,715 / 页page | 3,595,725 | 39.7% |
| 指令执行Instruction execution | 962 / 条instr | 3,848,400 | 42.5% |
| 固定开销Fixed overhead | 578,245 / 拍tick | 578,245 | 6.4% |
| 取页Page loads | 5,471 / 页page | 547,060 | 6.0% |
| 翻转Flips | 11,671 / 次flip | 46,684 | 0.5% |
每条标注是实测还是估算。估算项正在用逐字节精确的离线孪生逐一测量,测完会替换成实测值。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 baseline | TapeOut 机器 / 自部署TapeOut machine / own deployment | 实测measured |
| 脏页写回Dirty-page write-back | CREATE 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 storage | TapeOut 机器 / 自部署TapeOut machine / own deployment | 估算estimate |
| 指令循环Instruction loop | 962 / 条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–400 | TapeOut 机器 / 自部署TapeOut machine / own deployment | 部分实测partly measured |
| 取页Page loads | 5,471 / 页,冷读 EXTCODECOPY5,471 / page, cold EXTCODECOPY | EIP-2929 暖读 100 起;多拍同交易内缓存页EIP-2929 warm reads from 100; cache pages across ticks within one transaction | 同上Same as above | 估算estimate |
| 拍上限Tick cap | 1,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×.
同一把尺子量一个大模型。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 token | 3.985 × 10¹⁴ |
| 占满整条链的时间Time with the whole chain fully occupied | 29.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 |
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.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.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.参考: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).