每个响应由它签名,每次调用付一张链下凭证,进一条只属于这个 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.
BNB Smart Chain 主网 · 免费 · 无需注册,无需密钥
BNB Smart Chain mainnet · free · no sign-up, no key
8 个免费的签名方法,按区块钉定读取 BNB Chain 与 TapeOut:
Eight free, signed, block-pinned reads of BNB Chain and TapeOut:
blockNumber · balance · tokenInfo · tokenBalance · nftOwner · pairPrice · bnbUsd · tapeName
容器之间的端到端加密通道(TAP-26)。中继只存密文,看不到内容与身份。
End-to-end encrypted channels between containers (TAP-26). The relay stores ciphertext and never sees content or identities.
把通道帧直接写上链的合约。没有所有者,没有状态,不可升级。
Carries channel frames on chain. No owner, no state, not upgradeable.
输入服务名,在浏览器里调用,看到 SDK 做的每一项核对。无需安装。
Type a service name, call it from the browser and see every check the SDK makes. Nothing to install.
公共服务与中继的健康、延迟、签名密钥与委托到期时间。
Health, latency, signer and delegation expiry of the public service and relay.
添加你的服务名,一览是否在线、委托还剩几天,一键去调试或续期。只读:不签名、不发交易。
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.
给 TapeOut 电路持有人:在钱包浏览器里把自己的容器发布成 TapeAPI 服务。
For TapeOut circuit holders: publish your container as a TapeAPI service from a wallet browser.
公开仓库。代码 MIT,规范 CC0。
Public repository. Code MIT, specs CC0.
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
今天的网站要调用服务,必须连上某家公司的服务器。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.
超出这些值的行为由合约或规范直接拒绝
Beyond these values the contract or the spec refuses outright
| 符号Symbol | 参数Parameter | 值Value | 依据Source |
|---|---|---|---|
| MAX_CONTRIBUTION | 自愿贡献比例上限Voluntary contribution cap | 5000 bps | TAP-22 |
| MAX_PAYLOAD | TapeSend 单条消息TapeSend message | 16 000 B | TAP-10 |
| CHUNK | DeWEB 单块写入DeWEB chunk write | 24 000 B | SPEC B.5 |
| FILE_MAX | DeWEB 单文件DeWEB single file | 8.4 MB | SPEC B.5 |
| EVAL_GAS | 链上电路重算上限On-chain circuit re-evaluation | 12 M ≈ 4 800 gates | TAP-25 |
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 / window | 48 h / 7 d | 窗口外须重新申请Re-request outside the window |
| t_SES | 会话密钥最长有效期Session key maximum lifetime | 30 d | 按通道授权,无撤销,泄露损失以一个通道为上限Per channel, no revoke; a leak is bounded by one channel |
| G_SET | 一次链上结算One on-chain settlement | 88 998 gas ≈ $0.0034 | 覆盖此前任意多次调用Covers any number of prior calls |
| G_CALL | 单次调用 gasGas per call | 0 | 凭证在链下签发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.
两份已验证信封的比较结果。这是 TapeAPI 最重要的一条规则。
Comparing two verified envelopes. This is the most important rule in TapeAPI.
| 提供者 A 应答A answered | 提供者 B 应答B answered | 签名有效Signatures valid | 结果一致Results identical | 输出Output |
|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 采信ACCEPT |
| 1 | 1 | 1 | 0 | 拒绝REJECT |
| 1 | 1 | 0 | × | 拒绝REJECT |
| 1 | 0 | 1 | × | 拒绝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.
一份配置把现有 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.
不需要委员会的可验证数据源,以及不锁资金池的跨链询价。价格按容差比较,因为跨源价格永远不会字节相同。
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.
存档与排行榜跟着玩家的容器走。回合结算规则可以是一枚电路,任何人都能在链上重算。
Saves and leaderboards follow the player's container. A round's settlement rule can be a circuit anyone re-evaluates on chain.
发布一个带签名的读取服务,TapeOut 生态的应用无需跨链桥即可读你的链,结果锚定在具体区块哈希上。
Publish a signed read service and every TapeOut app can read your chain with no bridge, anchored to a specific block hash.
// 解析身份,验签,要求两家独立提供者一致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)
| 项目Item | 收费方Charged by | 金额Amount |
|---|---|---|
| 解析身份、读清单、验签Resolve, read manifest, verify | 无Nobody | 0 |
| TapeAPI 协议费TapeAPI protocol fee | 无Nobody | 0 |
| 自愿维护贡献Voluntary maintenance contribution | 提供者自设Provider sets it | 默认 0,建议 1%Default 0, suggested 1% |
| 服务调用价Service call price | 提供者Provider | 自定Provider's choice |
| 开通一个容器Opening a container | TapeOut | 0.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.
以下都还没有上线,也不承诺日期
None of this is live yet, and no dates are promised
只读版“我的服务”已上线。接下来:自动列出你名下的服务,并在同一页面完成续期与管理。
A read-only My services page is live. Next: list the services you hold automatically, and renew and manage them on the same page.
在浏览器里创建一个服务,不必自己运行服务器。
Create a service in the browser, without running a server of your own.
按次计费的凭证支付(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.
TAP 编号是提案。它们已提交给 TapeOut 维护者,尚未正式分配。
TAP numbers are proposals. They are proposed to the TapeOut maintainers and not yet assigned.