Force Bridge 跨链锁(bridge lockscript)约束Force Bridge bridge lockscript Constraints
来源:nervosnetwork/force-bridge@f3d7df7 ckb-contracts/lib/bridge-lockscript-lib/src/lib.rs + adapter.rs · mainnet 0x93bc…1789 / testnet 0x2170…b50e,hash_type type(force-bridge 官方配置)Source: nervosnetwork/force-bridge@f3d7df7 ckb-contracts/lib/bridge-lockscript-lib/src/lib.rs + adapter.rs · mainnet 0x93bc…1789 / testnet 0x2170…b50e, hash_type type (force-bridge official config)
给 AI agent:For AI agents: force_bridge_lock.md · llms.txt
1 → N解锁:由 owner cell 的 lock(委员会多签)授权Unlock: authorised by the owner cell lock (committee multisig)
Inputs 输入Inputs
input(bridge lock)input (bridge lock)Cell{
lock: { codeHash: BRIDGE_LOCK,
args: ForceBridgeLockscriptArgs{
owner_cell_type_hash, chain, asset } }
}
另一个 input(owner 授权)another input (owner authorisation)Cell{ lock: hash = owner cell 的 lock hash }Cell{ lock: hash = owner cell lock hash }
Outputs 输出Outputs
outputs:任意outputs: any本 lock 不检查 outputsthis lock does not check outputs
cell_depscell_deps
owner cellCell{
type: hash = owner_cell_type_hash(Type ID),
lock: 委员会多签
}
按顺序找第一个 type hash 匹配的 cell_depCell{
type: hash = owner_cell_type_hash (Type ID),
lock: committee multisig
}
first cell_dep (in order) whose type hash matches
args 字节布局(molecule table)args byte layout (molecule table)
header16B
owner_cell_type_hash32B
chain1B
asset4+nB
- header16Btotal_size + 3 个 offsettotal_size + 3 offsetsmolecule 严格校验strict molecule verify-1
- owner_cell_type_hash32Bowner cell 的 type script hashtype script hash of the owner cell必须在 cell_deps 里找到must be found in cell_deps-1
- chain1B来源链(链下 ChainType:0 BTC / 1 ETH / 2 EOS / 3 TRON / 4 POLKADOT)origin chain (off-chain ChainType: 0 BTC / 1 ETH / 2 EOS / 3 TRON / 4 POLKADOT)lock 不检查not checked by the lock
- asset4+nB资产标识(如 ETH 代币地址字符串)asset id (e.g. ETH token address string)lock 不检查not checked by the lock
args0x5f000000 10000000 30000000 31000000 | c5fe9a19…e18d | 01 | 2a000000 "0xeca82185adCE47f39c684352B0439f030f860318"
限制Constraints
- argsForceBridgeLockscriptArgsReader::verify(args, false) 通过ForceBridgeLockscriptArgsReader::verify(args, false) passes-1
- owner cellcell_deps 中存在 type hash = owner_cell_type_hash 的 cell,否则 panic “owner cell not found”a cell_dep with type hash = owner_cell_type_hash exists, else panic "owner cell not found"-1
- inputs某个 input 的 lock hash = 该 owner cell 的 lock hash,否则 panic “not authorized to unlock the cell”some input lock hash = that owner cell lock hash, else panic "not authorized to unlock the cell"-1
部署与来源Deployments & source 未核验unverified
源码source
nervosnetwork/force-bridge@f3d7df76 · ckb-contracts/contracts/bridge-lockscript/src/main.rs · ckb-contracts/lib/bridge-lockscript-lib/src/lib.rs · ckb-contracts/lib/bridge-lockscript-lib/src/adapter.rs · ckb-contracts/types/schemas/force_bridge_lockscript.mol · ckb-contracts/contracts-helper/src/entry.rs (default-branch HEAD read 2026-11-06 (bridge-lockscript last changed 2abe679, 2021-06-16))
二进制核验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 | 0x93bc7a915d3d8f8b9678bc6c7a1751738c99ce6e66bba4dfab56672f6d691789 type | 0x3f9fd8ba3b…322d0441:0 code | 0x32cf6f895f…bd9cf770 | 0xfd8264c1d3…2617e871 | 0x3f9fd8ba3b…322d0441 #5483659 |
| testnet | 0x2170ffdb67574651c7bc51455d98f29394f2ee134a306c84533732f52e0eb50e type | 0x9b76017d20…6b45814b:0 code | 0xa899df4e89…c51d651e | 0x3ad1982c4f…3bae3b28 | 0x9b76017d20…6b45814b #2277171 |
链上数据核对于 on-chain data checked 2026-11-06
所有失败都是 panic,contracts-helper 的 panic_handler 统一 exit(-1),没有细分错误码。Every failure is a panic; contracts-helper panic_handler exits with -1, so there are no finer error codes.
不检查签名:安全性完全来自 owner cell 的 lock(官方部署文档:委员会 secp256k1 多签)和 owner cell 的 Type ID 唯一性。No signature is checked here: security comes entirely from the owner cell lock (committee secp256k1 multisig per the official deployment doc) and the Type ID uniqueness of the owner cell.
注意:CKB Explorer 注册表里名为 “Force Bridge” 的 0x9f3a…f52f 不是这个 bridge lockscript,而是 Force Bridge 部署的未发布版 Omnilock(见 omnilock_v1 页)。Note: the CKB Explorer registry entry named "Force Bridge" (0x9f3a…f52f) is not this bridge lockscript but a pre-release Omnilock deployed by Force Bridge (see the omnilock_v1 page).
同仓库的 recipient-typescript 不在清单中,未收录。The recipient-typescript in the same repo is not in the list and was not added.
不检查签名:安全性完全来自 owner cell 的 lock(官方部署文档:委员会 secp256k1 多签)和 owner cell 的 Type ID 唯一性。No signature is checked here: security comes entirely from the owner cell lock (committee secp256k1 multisig per the official deployment doc) and the Type ID uniqueness of the owner cell.
注意:CKB Explorer 注册表里名为 “Force Bridge” 的 0x9f3a…f52f 不是这个 bridge lockscript,而是 Force Bridge 部署的未发布版 Omnilock(见 omnilock_v1 页)。Note: the CKB Explorer registry entry named "Force Bridge" (0x9f3a…f52f) is not this bridge lockscript but a pre-release Omnilock deployed by Force Bridge (see the omnilock_v1 page).
同仓库的 recipient-typescript 不在清单中,未收录。The recipient-typescript in the same repo is not in the list and was not added.