.bit Time Info Type 约束.bit Time Info Type Constraints
来源:dotbitHQ/ckb-time-script @37343ab contracts/info-typeSource: dotbitHQ/ckb-time-script @37343ab contracts/info-type
给 AI agent:For AI agents: dotbit_time_info.md · llms.txt
0 → 1创建(与 Index State 同一笔交易)Create (in the same tx as the Index State)
Inputs 输入Inputs
(无)(none)
Outputs 输出Outputs
输出 #0:Index State Celloutput #0: Index State CellCell{ type: { codeHash: INDEX_STATE, args: A } }
Info CellCell{
type: { codeHash: INFO, args: A },
data: index u8 ‖ type u8 ‖ value u64 BE
}
限制Constraints
- output #0必须有 typemust have a type13
- args= 输出 #0 type 的 args= output #0 type args5
- data10 字节10 bytes6
1 → 1更新:写入新的时间 / 高度Update: write a new time / height
Inputs 输入Inputs
Info Celldata: i_old ‖ type ‖ old
since: …
Outputs 输出Outputs
输出 #0:Index State Celloutput #0: Index State Celldata: i ‖ 12
Info Celldata: i ‖ type ‖ new > old
data 字节布局data byte layout
index1B
type1B
value8B BE
- index1B与 Index State 对应matches Index State= 输出 #0 data[0]= output #0 data[0]9
- type1B0 任意 · 1 时间戳 · 2 区块高度0 arbitrary · 1 timestamp · 2 block number——
- value8B BE时间戳或区块高度timestamp or block number严格变大,并等于 sincestrictly increases and equals since10 · 11 · 12
限制Constraints
- 输出 #0 dataoutput #0 data2 字节(假定输出 #0 是 Index State)2 bytes (output #0 is assumed to be the Index State)7
- data输入、输出都 10 字节input and output both 10 bytes6
- index= 输出 #0 data[0]= output #0 data[0]9
- type = 1新值 > 旧值;组内第一个输入的 since = (1<<62) + 新时间戳new > old; the group's first input since = (1<<62) + new timestamp10 · 12
- type = 2新值 > 旧值;since = 新区块高度new > old; since = new block number11 · 12
- type 其他other type不检查内容content not checked—
1 → 0回收Recycle
Inputs 输入Inputs
Info CellCell{ type: INFO }
Outputs 输出Outputs
(无)(none)
限制Constraints
- —输出里没有同 code hash 的 type 即通过passes when no output has a type with this code hash—
部署与来源Deployments & source 未核验unverified
源码source
dotbitHQ/ckb-time-script@37343ab5 · contracts/info-type/src/entry.rs · contracts/info-type/src/error.rs · libs/common/src/constants.rs · migrations/mainnet/2021-08-24-000000.json (commit 37343ab "chore: deploy script to mainnet" adds migrations/mainnet/2021-08-24-000000.json (hashes used here); contract code last changed at a2fa7d9 (2021-08-09). No reproducible build attempted.)
二进制核验binary check
未核验unverified no binary or checksum at the recorded commit matched the deployed data hash (reproducible build not attempted)
| 网络network | code_hash | cell_dep | type_id args | 数据哈希data hash | 部署交易deploy tx |
|---|---|---|---|---|---|
| mainnet | 0x9e537bf5b8ec044ca3f53355e879f3fd8832217e4a9b41d9994cf0c547241a79 type | 0x3ba4c4b6cb…b1c905a5:0 code | 0x4b673f820a…e7f33b95 | 0x1871b6ecbe…848b7209 | 0x3ba4c4b6cb…b1c905a5 #15198605 |
| testnet | 0x96248cdefb09eed910018a847cfb51ad044c2d7db650112931760e3ef34a7e9a type | 0x9155635997…1b053a73:0 code | 0xd7d02a6191…ad6276ba | 0x1871b6ecbe…848b7209 | 0x9155635997…1b053a73 #2386188 |
链上数据核对于 on-chain data checked 2026-11-06
这两个脚本组成 .bit 的链上时间 / 区块高度预言机:1 个 Index State cell 指向 12 个 Info cell 中最新的一个,每次更新同时改 Index State 和一个 Info cell。The two scripts form the .bit on-chain time / block-number oracle: one Index State cell points to the newest of 12 Info cells; each update rewrites the Index State and one Info cell.
“输入里是否已有本脚本”只比较 code_hash,不比较 args:输入有、输出没有就当作回收直接通过,任何持有 lock 的人都能销毁。"Is this script already in the inputs" compares code_hash only, not args: present in inputs but absent from outputs is treated as recycling and always passes; whoever holds the lock can destroy the cell.
合约没有检查谁能更新:权限完全来自 cell 的 lock。The scripts do not check who may update; authority comes entirely from the lock of the cells.
部署:哈希来自仓库 migrations(主网 2021-08-24、测试网 2021-08-09-103746),链上 code cell 已核对;二进制没有可复现构建。Deployment: hashes from the repo migrations (mainnet 2021-08-24, testnet 2021-08-09-103746), checked on chain; no reproducible build of the binary.
since 让 CKB 共识保证写入值不超过链上真实时间 / 高度:交易不能早于该时间 / 高度上链。The since field makes CKB consensus guarantee the written value is not ahead of the chain: the tx cannot be committed before that time / height.
错误码:1–4 syscall · 5 InvalidArgument · 6 InfoDataLenError · 7 IndexStateDataLenError · 8 InfoTypeNotExist · 9 InfoIndexNotSame · 10 OutputTimestampNotBigger · 11 OutputBlockNumberNotBigger · 12 InvalidTimeInfoSince · 13 IndexStateTypeNotExistError codes: 1–4 syscall · 5 InvalidArgument · 6 InfoDataLenError · 7 IndexStateDataLenError · 8 InfoTypeNotExist · 9 InfoIndexNotSame · 10 OutputTimestampNotBigger · 11 OutputBlockNumberNotBigger · 12 InvalidTimeInfoSince · 13 IndexStateTypeNotExist
“输入里是否已有本脚本”只比较 code_hash,不比较 args:输入有、输出没有就当作回收直接通过,任何持有 lock 的人都能销毁。"Is this script already in the inputs" compares code_hash only, not args: present in inputs but absent from outputs is treated as recycling and always passes; whoever holds the lock can destroy the cell.
合约没有检查谁能更新:权限完全来自 cell 的 lock。The scripts do not check who may update; authority comes entirely from the lock of the cells.
部署:哈希来自仓库 migrations(主网 2021-08-24、测试网 2021-08-09-103746),链上 code cell 已核对;二进制没有可复现构建。Deployment: hashes from the repo migrations (mainnet 2021-08-24, testnet 2021-08-09-103746), checked on chain; no reproducible build of the binary.
since 让 CKB 共识保证写入值不超过链上真实时间 / 高度:交易不能早于该时间 / 高度上链。The since field makes CKB consensus guarantee the written value is not ahead of the chain: the tx cannot be committed before that time / height.
错误码:1–4 syscall · 5 InvalidArgument · 6 InfoDataLenError · 7 IndexStateDataLenError · 8 InfoTypeNotExist · 9 InfoIndexNotSame · 10 OutputTimestampNotBigger · 11 OutputBlockNumberNotBigger · 12 InvalidTimeInfoSince · 13 IndexStateTypeNotExistError codes: 1–4 syscall · 5 InvalidArgument · 6 InfoDataLenError · 7 IndexStateDataLenError · 8 InfoTypeNotExist · 9 InfoIndexNotSame · 10 OutputTimestampNotBigger · 11 OutputBlockNumberNotBigger · 12 InvalidTimeInfoSince · 13 IndexStateTypeNotExist