iCKB logic(lock + type)约束iCKB logic (lock + type) Constraints
来源:ickb/contracts / scripts/contracts/ickb_logic/src · mainnet code_hash 0x2a81…3bd3(data1,由 release 二进制计算并在链上确认)Source: ickb/contracts / scripts/contracts/ickb_logic/src · mainnet code_hash 0x2a81…3bd3 (data1, computed from the release binary and confirmed on-chain)
iCKB
- 官网Websiteickb.org
- GitHubGitHubgithub.com/ickb
来源:Source: ickb GitHub org profile; ickb/contracts README
Phase 1CKB 存入 → 存款 + 回执Deposit CKB → deposit + receipt
Inputs 输入Inputs
任意 CKBany CKBCell{ lock: user }
➜
Outputs 输出Outputs
DAO 存款(N 个,金额相同)DAO deposits (N, same amount)Cell{
lock: ICKB_LOGIC (args 空),
type: NERVOS_DAO, data: 0x0000000000000000,
unoccupied: 1,000 – 1,000,000 CKB
}Cell{
lock: ICKB_LOGIC (empty args),
type: NERVOS_DAO, data: 0x0000000000000000,
unoccupied: 1,000 – 1,000,000 CKB
}
回执receiptCell{
lock: user,
type: ICKB_LOGIC,
data: ReceiptData{ quantity: N, amount: unoccupied }
}
回执 data:ReceiptData(struct 12B)receipt data: ReceiptData (struct 12B)
deposit_quantity4B
deposit_amount8B
- deposit_quantity 4B 存款个数 u32 LEnumber of deposits u32 LE > 0 (9)
- deposit_amount 8B 单个存款的 unoccupied capacity(shannon)unoccupied capacity of one deposit (shannons) 与输出存款匹配matches the output deposits (10)
限制Constraints
- deposit:: unoccupied ≥ 1,000 CKBunoccupied ≥ 1,000 CKB (7)
- deposit:: unoccupied ≤ 1,000,000 CKBunoccupied ≤ 1,000,000 CKB (8)
- receipt:: quantity > 0quantity > 0 (9)
- accounting:: 每种金额:输出存款个数 = 回执 quantity 之和per amount: output deposit count = Σ receipt quantity (10)
Phase 2回执 → iCKB(xUDT)Receipt → iCKB (xUDT)
Inputs 输入Inputs
回执receiptCell{ type: ICKB_LOGIC, data: {quantity, amount} }
// header_deps: 回执所在块Cell{ type: ICKB_LOGIC, data: {quantity, amount} }
// header_deps: the receipt's block
➜
Outputs 输出Outputs
iCKB xUDTCell{
type: xUDT( args = hash(ICKB_LOGIC) ‖ 0x00000080 ),
data: u128 amount
}
限制Constraints
- value:: iCKB = amount × AR₀ / AR_m(AR₀ = 10¹⁶),超过 100,000 iCKB 的部分打 9 折iCKB = amount × AR₀ / AR_m (AR₀ = 10¹⁶), 10% off above 100,000 iCKB per deposit (11)
- balance:: Σ输入 UDT + Σ输入回执价值 = Σ输出 UDT + Σ输入存款价值Σ input UDT + Σ input receipt value = Σ output UDT + Σ input deposit value (11)
- udt:: 输出单个 UDT 数量 ≤ u64::MAXeach output UDT amount ≤ u64::MAX (12)
BurniCKB 换回存款iCKB → withdraw a deposit
Inputs 输入Inputs
iCKB xUDTCell{ type: iCKB xUDT, data: amount }
任一 iCKB 存款any iCKB depositCell{ lock: ICKB_LOGIC, type: NERVOS_DAO }
➜
Outputs 输出Outputs
DAO 取款请求(通常由 owned_owner 锁定)DAO withdrawal request (usually locked by owned_owner)Cell{ lock: OWNED_OWNER, type: NERVOS_DAO, data: block number }
限制Constraints
- balance:: 销毁的 iCKB = 存款按其区块 AR 计算的价值burned iCKB = deposit value at its block AR (11)
部署与来源Deployments & source 已核验verified
源码source ickb/contracts@c951927e · scripts/contracts/ickb_logic/src (default-branch HEAD recorded at backfill 2026-10-21; spec/plugin were written from the default branch shortly before (exact read commit not recorded))
二进制核验binary check 已核验verified deployed data hash matches a binary / checksum in the repo at the recorded commit
0x2a8100ab59…15873bd3: listed in scripts/deployment/mainnet/migrations/2024-09-12-151119.json; listed in scripts/deployment/testnet/migrations/2024-09-12-141730.json; blake2b of scripts/build/release/ickb_logic
0x2a8100ab59…15873bd3: listed in scripts/deployment/mainnet/migrations/2024-09-12-151119.json; listed in scripts/deployment/testnet/migrations/2024-09-12-141730.json; blake2b of scripts/build/release/ickb_logic
| 网络network | code_hash | cell_dep | type_id args | 数据哈希data hash | 部署交易deploy tx |
|---|---|---|---|---|---|
| mainnet | 0x2a8100ab5990fa055ab1b50891702e1e895c7bd1df6322cd725c1a6115873bd3 data1 | 0x621a6f38de…5d3ed165:0 dep_group | — | 0x2a8100ab59…15873bd3 | 0xd730919138…29dc8f44 #14010067 |
链上数据核对于 on-chain data checked 2026-10-20
误用检查(6 ScriptMisuse,输入输出全部 cell):DAO 存款或 iCKB xUDT 不能做 lock;ICKB_LOGIC lock 必须配 DAO 存款 typeMisuse (6 ScriptMisuse, all cells): a DAO deposit or iCKB xUDT can never be a lock; an ICKB_LOGIC lock must carry a DAO deposit type
错误码:1–4 系统 · 5 NotEmptyArgs · 6 ScriptMisuse · 7 DepositTooSmall · 8 DepositTooBig · 9 EmptyReceipt · 10 ReceiptMismatch · 11 AmountMismatch · 12 AmountUnreasonablyBigError codes: 1–4 syscall · 5 NotEmptyArgs · 6 ScriptMisuse · 7 DepositTooSmall · 8 DepositTooBig · 9 EmptyReceipt · 10 ReceiptMismatch · 11 AmountMismatch · 12 AmountUnreasonablyBig
args 必须为空,且输出中不能出现同 code 但 args 非空的 lock(5)args must be empty, and no output lock with the same code but other args may exist (5)
错误码:1–4 系统 · 5 NotEmptyArgs · 6 ScriptMisuse · 7 DepositTooSmall · 8 DepositTooBig · 9 EmptyReceipt · 10 ReceiptMismatch · 11 AmountMismatch · 12 AmountUnreasonablyBigError codes: 1–4 syscall · 5 NotEmptyArgs · 6 ScriptMisuse · 7 DepositTooSmall · 8 DepositTooBig · 9 EmptyReceipt · 10 ReceiptMismatch · 11 AmountMismatch · 12 AmountUnreasonablyBig
args 必须为空,且输出中不能出现同 code 但 args 非空的 lock(5)args must be empty, and no output lock with the same code but other args may exist (5)