TAPEAPI Rev 0.6 2026-09-27 BNB Smart Chain · 56 手册Docs 调试台Playground 我的服务Dashboard

流片一枚电路,它的容器就是你的 API

Tape out a circuit, and its container is your API

每个响应由它签名,每次调用付一张链下凭证,进一条只属于这个 API 的通道。DeWEB 是网站,TapeSend 是通信,TapeAPI 是服务。

Every response signed by it, every call paid with an off-chain voucher into a channel that belongs to that API alone. DeWEB is websites, TapeSend is communication, TapeAPI is services.

PRELIMINARY 预发布 · 规范 CC0 · 代码 MIT · 公共服务已上线 · 未经第三方审计 Pre-alpha · Spec CC0 · Code MIT · Public service live · No third-party audit 在线试用 →Try it live → 阅读手册 →Read the docs →
01

现已上线

Live Now

BNB Smart Chain 主网 · 免费 · 无需注册,无需密钥

BNB Smart Chain mainnet · free · no sign-up, no key

SVC

公共服务Public service

api.tapeapi.fun · 11.1013.tape

8 个免费的签名方法,按区块钉定读取 BNB Chain 与 TapeOut:

Eight free, signed, block-pinned reads of BNB Chain and TapeOut:

blockNumber · balance · tokenInfo · tokenBalance · nftOwner · pairPrice · bnbUsd · tapeName

Live
RLY

公共中继Public relay

relay.tapeapi.fun · 12.1013.tape

容器之间的端到端加密通道(TAP-26)。中继只存密文,看不到内容与身份。

End-to-end encrypted channels between containers (TAP-26). The relay stores ciphertext and never sees content or identities.

Live
BUS

ChannelBus

把通道帧直接写上链的合约。没有所有者,没有状态,不可升级。

Carries channel frames on chain. No owner, no state, not upgradeable.

Live
PLY

调试台Playground

输入服务名,在浏览器里调用,看到 SDK 做的每一项核对。无需安装。

Type a service name, call it from the browser and see every check the SDK makes. Nothing to install.

Live
DOC

手册Docs

调用服务、运行服务、私密通道、AI 代理、常见问题。

Calling a service, running one, private channels, AI agents, FAQ.

Live
STS

服务状态Status

公共服务与中继的健康、延迟、签名密钥与委托到期时间。

Health, latency, signer and delegation expiry of the public service and relay.

Live
DSH

我的服务Dashboard

添加你的服务名,一览是否在线、委托还剩几天,一键去调试或续期。只读:不签名、不发交易。

Add your service names and see at a glance whether each is up and how many days its delegation has left, with links to try or renew it. Read-only: it never signs or sends.

Live
CON

持有人操作台Holder console

给 TapeOut 电路持有人:在钱包浏览器里把自己的容器发布成 TapeAPI 服务。

For TapeOut circuit holders: publish your container as a TapeAPI service from a wallet browser.

Live
SRC

源代码Source

公开仓库。代码 MIT,规范 CC0。

Public repository. Code MIT, specs CC0.

Public
01.1

30 秒试用

Try It in 30 Seconds

A · curl向公共服务要 BNB 价格。curl 只显示签名信封(result、container、ts、block、sig),不做任何核对;验签请用 SDK 或调试台。Ask the public service for the BNB price. curl shows the signed envelope (result, container, ts, block, sig) but checks nothing; the SDK or the playground verifies it.

curl -s https://api.tapeapi.fun/tapeapi/v1/bnbUsd -H 'content-type: application/json' -d '{"id":"1","params":{}}'

B · SDK包还没发到 npm,先准备一次仓库(Node.js 20 或以上):The packages are not on npm yet, so set up the repository once (Node.js 20 or later):

git clone https://github.com/BruceLanLan/tapeapi.git
cd tapeapi
npm install

把下面存为 try.mjs,必须放在 tapeapi 目录里(@tapeapi/sdk 通过仓库的 workspace 解析),然后运行 node try.mjs:Save this as try.mjs inside the tapeapi directory (@tapeapi/sdk resolves through the repository's workspace), then run node try.mjs:

import { createTapeAPI } from '@tapeapi/sdk'

const api = createTapeAPI({
  rpcUrls: ['https://bsc-dataseed.bnbchain.org', 'https://bsc-dataseed1.defibit.io', 'https://bsc-dataseed1.ninicoin.io'],
  quorum: 2,
})
const svc = await api.resolve('11.1013.tape')   // 名字、容器、链上清单、持有人委托name, container, on-chain manifest, delegation
const { result, verified } = await api.call(svc, 'bnbUsd', {})
console.log(result.bnbUsd, verified)            // 验签通过才为 truetrue only after the signature checked out
02

特性与说明

Features and Description

  • 免费服务零部署不需要我们的任何合约
  • Zero deploymentA free service needs none of our contracts
  • 身份不可自述由链上推导,客户端强制重算
  • Identity cannot be self-assertedDerived on chain; clients re-derive it
  • 答案带签名摘要覆盖方法与参数,签过名的错误无法被改标成成功
  • Signed answersThe digest covers method and params, so an error cannot be relabelled
  • 一次调用零 gas累计凭证进只属于该 API 的通道,多次调用一笔结算
  • No gas per callCumulative vouchers into a channel that belongs to that API alone; many calls settle at once
  • 零协议费贡献由提供者自设,默认 0
  • Zero protocol feeContribution is provider-set, default zero
  • 多方一致任意两份已验证答案不一致即拒绝,永不多数决
  • QuorumAny disagreement rejects; never a majority vote

今天的网站要调用服务,必须连上某家公司的服务器。TapeAPI 把服务本身变成一个链上身份:一枚 TapeOut 电路、它的 ERC-6551 容器,以及存在容器站点里的一份服务清单。

A website that needs a service today must reach a company's server. TapeAPI turns the service itself into an on-chain identity: one TapeOut circuit, its ERC-6551 container, and a manifest stored in that container's site.

调用走普通 HTTPS,所以和现有 API 一样快。区别在于响应由容器绑定的密钥签名,调用方可以验签,也可以要求两家互不相干的提供者给出一致答案才采信。

Calls go over ordinary HTTPS, so they are as fast as any API. The difference is that the response is signed by a key bound to the container, and the caller can verify it, or require two unrelated providers to agree before believing it.

付费用离线签发的累计凭证,提供者攒够了再上链结算一次。调用本身不花 gas。付费所需的托管合约尚未部署,要先通过独立审计;今天所有公共方法都免费。

Payment uses off-chain cumulative vouchers; the provider settles once on chain when it is worth doing. The call itself costs no gas. The escrow that paid calls need is not deployed yet and waits for an independent audit; today every public method is free.

03

功能框图

Functional Block Diagram

DeWEB TapeSend TapeAPI PAGES MESSAGES SERVICES CIRCUIT NFT ERC-6551 CONTAINER 12 34 HOLDER SIGNER KEY MANIFEST
图 1三层共用同一个身份:一枚电路的容器。持有人签一次委托,服务此后用自己的热密钥签名答案;转让电路即转让服务。
Fig. 1Three layers share one identity: a circuit's container. The holder signs a delegation once; the service then signs answers with its own key. Transferring the circuit transfers the service.
04

极限参数

Absolute Maximum Ratings

超出这些值的行为由合约或规范直接拒绝

Beyond these values the contract or the spec refuses outright

符号Symbol 参数Parameter 值Value 依据Source
MAX_CONTRIBUTION自愿贡献比例上限Voluntary contribution cap5000 bpsTAP-22
MAX_PAYLOADTapeSend 单条消息TapeSend message16 000 BTAP-10
CHUNKDeWEB 单块写入DeWEB chunk write24 000 BSPEC B.5
FILE_MAXDeWEB 单文件DeWEB single file8.4 MBSPEC B.5
EVAL_GAS链上电路重算上限On-chain circuit re-evaluation12 M ≈ 4 800 gatesTAP-25
05

时序与运行特性

Timing and Operating Characteristics

gas 为本地实测;法币按 BNB 753 美元、BSC 0.05 gwei 换算;付费托管合约尚未部署

Gas measured locally; fiat at BNB $753 and BSC 0.05 gwei; the paid-call escrow is not deployed yet

符号Symbol 参数Parameter 典型值Typical 条件Condition
t_WD提现冷静期 / 执行窗口Withdraw cooldown / window48 h / 7 d窗口外须重新申请Re-request outside the window
t_SES会话密钥最长有效期Session key maximum lifetime30 d按通道授权,无撤销,泄露损失以一个通道为上限Per channel, no revoke; a leak is bounded by one channel
G_SET一次链上结算One on-chain settlement88 998 gas ≈ $0.0034覆盖此前任意多次调用Covers any number of prior calls
G_CALL单次调用 gasGas per call0凭证在链下签发Vouchers are signed off chain
N_Q采信所需一致提供者数Providers required to agree≥ 2须互相独立Mutually independent

关于摊销。一次结算 0.0034 美元。若每 1000 次调用结算一次,单价 0.001 BEM 时 gas 占收入 3.35%,0.01 BEM 时占 0.34%。gas 不是定价的约束,提供者的边际成本才是。

On amortisation. One settlement costs $0.0034. Settling every 1000 calls, gas is 3.35% of revenue at 0.001 BEM per call and 0.34% at 0.01 BEM. Gas does not constrain the price; the provider's marginal cost does.

06

一致性真值表

Agreement Truth Table

两份已验证信封的比较结果。这是 TapeAPI 最重要的一条规则。

Comparing two verified envelopes. This is the most important rule in TapeAPI.

提供者 A 应答A answered 提供者 B 应答B answered 签名有效Signatures valid 结果一致Results identical 输出Output
1111采信ACCEPT
1110拒绝REJECT
110×拒绝REJECT
101×拒绝REJECT

没有多数决。三家里两家一致、一家不同,默认结果是拒绝。理由:多数决在三取二时可被合谋伪造,而拒绝只会让调用失败。调用方可以显式降级,但那是它自己的选择。

There is no majority vote. Two of three agreeing with one dissenting is a rejection by default. A majority rule is forgeable by two colluding providers out of three; rejection only denies. A caller may opt into the weaker mode explicitly, but that is its own decision.

07

典型应用

Typical Applications

APP 01

Web2 企业

Web2 company

一份配置把现有 REST 端点变成按次计费的服务,收入直接进你的链上身份,无需开户系统。

One config turns an existing REST endpoint into a pay-per-call service. Revenue lands on your on-chain identity; no accounts to manage.

APP 02

DeFi 协议

DeFi protocol

不需要委员会的可验证数据源,以及不锁资金池的跨链询价。价格按容差比较,因为跨源价格永远不会字节相同。

A verifiable data source without a committee, and cross-chain quoting without a pooled bridge. Prices compare within a tolerance, since cross-source prices are never byte-identical.

APP 03

游戏

Games

存档与排行榜跟着玩家的容器走。回合结算规则可以是一枚电路,任何人都能在链上重算。

Saves and leaderboards follow the player's container. A round's settlement rule can be a circuit anyone re-evaluates on chain.

APP 04

公链与 L2

Chains and L2s

发布一个带签名的读取服务,TapeOut 生态的应用无需跨链桥即可读你的链,结果锚定在具体区块哈希上。

Publish a signed read service and every TapeOut app can read your chain with no bridge, anchored to a specific block hash.

08

典型应用电路

Typical Application Circuit

// 解析身份,验签,要求两家独立提供者一致Resolve, verify, require two independent providers to agree
import { createTapeAPI } from '@tapeapi/sdk'

const api = createTapeAPI({ rpcUrls: RPC_URLS, quorum: 2 })

// 按名字或容器地址解析,不需要任何目录合约Resolve by name or by container address; no directory contract needed
const a = await api.resolve('11.1013.tape')
const b = await api.resolve('0x…')   // 第二家独立提供者a second, independent provider

// 钉同一个区块,两家的答案才可比较Pin one block so the answers are comparable
const first = await api.call(a, 'bnbUsd', {})
const block = first.result.blockPinned.blockNumber
const r = await api.callQuorum([a, b], 'bnbUsd', { block }, { quorum: 2 })

// 两份信封各自验签通过,且结果逐字节相同,才会返回Returns only if both envelopes verified and the results matched byte for byte
console.log(r.result.bnbUsd, r.agreed)
图 2最小调用回路。今天 api.tapeapi.fun 是这些方法唯一的公共提供者,第二家要由你或别人运行(示例在 examples/public-api/)。付费方法再加一个 payer,凭证在本地签发,不产生链上交易;它要等托管合约审计并部署之后。
Fig. 2Minimum call loop. Today api.tapeapi.fun is the only public provider of these methods, so the second one is yours or someone else's to run (examples/public-api/). A paid method adds a payer that signs vouchers locally, with no on-chain transaction; that waits for the escrow to be audited and deployed.
09

费用

Cost of Operation

项目Item 收费方Charged by 金额Amount
解析身份、读清单、验签Resolve, read manifest, verify无Nobody0
TapeAPI 协议费TapeAPI protocol fee无Nobody0
自愿维护贡献Voluntary maintenance contribution提供者自设Provider sets it默认 0,建议 1%Default 0, suggested 1%
服务调用价Service call price提供者Provider自定Provider's choice
开通一个容器Opening a containerTapeOut0.012 BNB

合约里没有任何我们能调的费率开关。贡献由提供者自己设、默认为 0、不给功能完全一样。TAP-22 明写其它托管部署同样合规。

There is no operator fee switch anywhere in the contracts. The contribution is provider-set, defaults to zero, and refusing it changes nothing. TAP-22 states that alternative escrow deployments are equally conforming.

10

路线图

Roadmap

以下都还没有上线,也不承诺日期

None of this is live yet, and no dates are promised

NEXT 01

开发者控制台(完整版)

Developer dashboard, full

只读版“我的服务”已上线。接下来:自动列出你名下的服务,并在同一页面完成续期与管理。

A read-only My services page is live. Next: list the services you hold automatically, and renew and manage them on the same page.

NEXT 02

托管服务

Hosted services

在浏览器里创建一个服务,不必自己运行服务器。

Create a service in the browser, without running a server of your own.

AFTER AUDIT

付费调用

Paid calls

按次计费的凭证支付(TAP-22)需要托管合约,而托管合约要先通过独立审计才会部署。在此之前,所有公共方法都免费。

Metered voucher payment (TAP-22) needs the escrow contract, and the escrow is deployed only after an independent audit. Until then every public method is free.

11

规范索引

Specification Index

TAP-1TAP 流程与编号TAP purpose and processDraft
TAP-20服务身份与清单Service identity and manifestDraft
TAP-21签名响应信封Signed response envelopeDraft
TAP-22计量支付凭证与托管Metered vouchers and escrowDraft
TAP-23带证明的跨链读取Attested readDraft
TAP-24跨链意图询价Intent RFQDraft · Frozen
TAP-25可由电路验证的方法Circuit-verified methodsDraft
TAP-26容器间的私密通道Private channels between containersDraft
TAP-27容器间的私密群聊Private groups between containersDraft

TAP 编号是提案。它们已提交给 TapeOut 维护者,尚未正式分配。

TAP numbers are proposals. They are proposed to the TapeOut maintainers and not yet assigned.