CKB Contract Flow

.bit IncomeCell Type 约束.bit IncomeCell Type Constraints

来源:dotbitHQ/did-contracts @0cc9fbf contracts/income-cell-typeSource: dotbitHQ/did-contracts @0cc9fbf contracts/income-cell-type
Type 脚本Type script身份 / 钱包Identity / wallet主网Mainnet测试网Testnet开源Open source社区Community
贡献者:Contributed by @linkdesu @linkdesu

给 AI agent:For AI agents: dotbit_income.md · llms.txt

0 → 1create_income:创建 IncomeCellcreate_income: create an IncomeCell

Inputs 输入Inputs
(无)(none)
Outputs 输出Outputs
IncomeCellCell{ lock: always-success, type: INCOME, capacity: = basic_capacity }

限制Constraints

  • witnessdas ActionData witness 可解析das ActionData witness decodes46
  • 系统开关system switchConfigCellMain.status ≠ off(配置,未检查)ConfigCellMain.status ≠ off (config, not checked)-1
  • 数量count输入 0 个、输出 1 个 IncomeCell0 IncomeCells in inputs, 1 in outputs6
  • lockalways-success lock(code_hash = ALWAYS_SUCCESS_LOCK_TYPE_ID,hash_type type)always-success lock (code_hash = ALWAYS_SUCCESS_LOCK_TYPE_ID, hash_type type)30
  • witness 记录witness records只有 1 条,属于 creator,金额 = basic_capacity(未检查)exactly 1, owned by the creator, amount = basic_capacity (not checked)6
  • capacity= ConfigCellIncome.basic_capacity(配置,未检查)= ConfigCellIncome.basic_capacity (config, not checked)-122

n → mconsolidate_income:合并收入记录consolidate_income: merge income records

Inputs 输入Inputs
IncomeCell × n(n ≥ 2)IncomeCell × n (n ≥ 2)Cell{ type: INCOME }
Outputs 输出Outputs
IncomeCell × m(m ≤ n)IncomeCell × m (m ≤ n)Cell{ type: INCOME }
转给记录所有者的 cellcells paid to record ownersCell{ lock: owner, capacity: ≥ amount − fee }

限制Constraints

  • witnessdas ActionData witness 可解析das ActionData witness decodes46
  • 系统开关system switchConfigCellMain.status ≠ off(配置,未检查)ConfigCellMain.status ≠ off (config, not checked)-1
  • 数量count输入 ≥ 2,输出 ≤ 输入inputs ≥ 2, outputs ≤ inputs-126
  • 记录records按 max_records、min_transfer_capacity、合并费率分为转出 / 保留;每个转出记录在输出中恰好 1 个同 lock 的 cell 且金额足够;不能浪费(未检查:需要解码 witness 和配置)split into transfer / keep by max_records, min_transfer_capacity and the consolidate profit rate; each transferred record has exactly one output cell with its lock and enough capacity; no waste (not checked: needs decoded witnesses and config)-125 · -124 · -123 · 6

* → *其他业务中出现Used inside other actions

Inputs 输入Inputs
(无)(none)
Outputs 输出Outputs
IncomeCellCell{ type: INCOME }

限制Constraints

  • witnessdas ActionData witness 可解析das ActionData witness decodes46
  • 系统开关system switchConfigCellMain.status ≠ off(配置,未检查)ConfigCellMain.status ≠ off (config, not checked)-1
  • confirm_proposal输入中有 ProposalCell(按配置 type id,未检查)a ProposalCell is in inputs (by config type id, not checked)6
  • buy_account输入中有 AccountSaleCell(未检查)an AccountSaleCell is in inputs (not checked)6
  • accept_offer输入中有 OfferCell(未检查)an OfferCell is in inputs (not checked)6
  • renew_account输入中有 AccountCell(未检查)an AccountCell is in inputs (not checked)6
  • 其他 actionother actions不支持not supported27
部署与来源Deployments & source 未核验unverified
源码source
dotbitHQ/did-contracts@0cc9fbf5 · contracts/income-cell-type/src/entry.rs · libs/das-core/src/verifiers/misc.rs · libs/das-core/src/verifiers/common.rs · libs/das-core/src/error.rs · .env.mainnet · .env.testnet2 ("sync the source code from latest deployed contracts" (2025-03-20); type-id args from dotbitHQ/das-lib core/env.go @57eb578)
二进制核验binary check
未核验unverified no binary or checksum at the recorded commit matched the deployed data hash (reproducible build not attempted)
网络networkcode_hashcell_deptype_id args数据哈希data hash部署交易deploy tx
mainnet0x6c1d69a358954fc471a2ffa82a98aed5a4912e6002a5e761524f2304ab53bf39 type0x0266b5a13e…58dfd8e8:0 code0x108fba6a9b…bbca2d460x4c14e91789…ce0293540x0266b5a13e…58dfd8e8 #15198783
testnet0x08d1cdc6ab92d9cabe0096a2c7642f73d0ef1b24c94c43f21c6c3a32ffe0bb5e type0x2219d49ae7…025fd221:0 code0xd7b9d82136…00ff37160x5cbc65b40c…9cdc7c3d0x2219d49ae7…025fd221 #14851498
链上数据核对于 on-chain data checked 2026-11-06
部署:code hash 是 Type ID 脚本哈希;type-id args 来自 dotbitHQ/das-lib core/env.go(主网 0x108fba6a…,测试网 Testnet2 0xd7b9d821…),两网都已在链上看到活的 code cell 和交易。Deployment: the code hash is the Type ID script hash; type-id args come from dotbitHQ/das-lib core/env.go (mainnet 0x108fba6a…, testnet Testnet2 0xd7b9d821…); live code cells and txs seen on both networks.
这个 type 不检查 lock 以外的签名:IncomeCell 用 always-success lock,规则全部在 type 里。This type does not check signatures: IncomeCells use the always-success lock, so all rules live in the type.
大部分规则依赖 IncomeCell witness 的 molecule 记录和 cell_deps 里的 ConfigCellIncome / ConfigCellProfitRate;解码器不加载 cell_deps 数据,本插件也不解码 IncomeCell witness,所以这些项显示为未检查。Most rules depend on the molecule records in IncomeCell witnesses and on ConfigCellIncome / ConfigCellProfitRate in cell_deps; the decoder does not load cell_dep data and this plugin does not decode IncomeCell witnesses, so those items show as not checked.
Type ID 合约可升级;所读源码 0cc9fbf 官方注明从最新部署合约同步,未做可复现构建。Type ID contracts are upgradable; the source read (0cc9fbf) is officially described as synced from the latest deployed contracts; no reproducible build.
错误码(das-core error.rs):-1 SystemOff · 6 InvalidTransactionStructure · 27 ActionNotSupported · 30 AlwaysSuccessLockIsRequired · 46 WitnessDataDecodingError · -126 ConsolidateConditionNotSatisfied · -125 ConsolidateError · -124 ConsolidateWaste · -123 TransferError · -122 CapacityErrorError codes (das-core error.rs): -1 SystemOff · 6 InvalidTransactionStructure · 27 ActionNotSupported · 30 AlwaysSuccessLockIsRequired · 46 WitnessDataDecodingError · -126 ConsolidateConditionNotSatisfied · -125 ConsolidateError · -124 ConsolidateWaste · -123 TransferError · -122 CapacityError