![Axon 架构](https://user-images.githubusercontent.com/32355308/146116093-a41352f1-9f8c-486b-a78f-9ff0af62dc60.png)
脚本逻辑
1. selection lock
Code hash: Selection Lock script code hash
Hash type: Data
Args: <32 byte omni_lock_hash><32 byte checkpoint_lock_hash>
selection lock 控制 AT 代币的发行。AT 代币的发行有两种方式:一种是侧链管理员发币,这种方式发行的数量可以设上限;另一种方式是共识节点提交 checkpoint 并获得出块奖励。第一种方式由 omni lock 验证,而第二种方式则由 checkpoint lock 验证。selection lock 确保 AT 代币的发行过程要么由 omni lock 验证,要么由 checkpoint lock 验证。不允许在一笔交易里同时执行 omni lock 和 checkpoint lock。
selection lock 的验证逻辑:
- 加载脚本参数,获得 omni_lock_hash 和 checkpoint_lock_hash
- 遍历 input cells,统计 lock_hash == omni_lock_hash 以及 lock_hash == checkpoint_lock_hash 的 cell 数量,分别用 omni_lock_count 和 checkpoint_lock_count 表示
- 验证 omni_lock_count + checkpoint_lock_count == 1
2. checkpoint lock
Code hash: Checkpoint Lock script code hash
Hash type: Type
Args: <21 byte admin_identity><32 byte type_id_hash>
vector Bytes <byte>;
option BytesOpt (BytesVec);
table CheckpointLockWitnessLock {
lock: BytesOpt,
input_type: BytesOpt, // input_type == 0x00,lock 存储 admin_signature,
// input_type == 0x01, lock 存储 checkpoint
output_type: BytesOpt,
}
Checkpoint Cell Data:
version: byte
state: byte // 0x00 表示停止更新 0x01 表示开启更新
period: Byte8 // little endian number,表示最新的 period 序号
era: Byte8 // little endian number,表示最新的 era 序号
block_hash: Byte32 // 最新 checkpoint 的区块哈希
period_interval: Byte4 // little endian number,表示相邻 period 的 L2 区块间隔
era_period: Byte4 // little endian number,表示相邻 era 的间隔,单位 period
unlock_period: Byte4 // little endian number,表示 Withdrawal AT Cell 的解锁间隔,单位 period
base_reward: Byte16 // little endian number,表示提交 checkpoint 的基础 AT 奖励数量
half_period: Byte8 // little endian number,表示奖励减半的 L2 间隔,单位 period
// 设置为 u64::MAX 相当于永不减半
common_ref: Byte10 // BLS 聚合签名的 common 信息,用于 bls 验签
sudt_type_hash: Byte32 // sUDT type script hash
stake_lock_hash: Byte32 // stake lock script hash
withdrawal_lock_code_hash: Byte32
当 state = 0x01,共识节点可以提交 checkpoint 以更新 Checkpoint Cell 的 period、era 和 block_hash,并获得出块奖励。checkpoint lock 检查共识节点提交的 checkpoint,以及获得的 AT 奖励是否正确。若有侧链管理员的签名,则侧链管理员可以更新 state 以开启或关闭 checkpoint 的更新,还可以调整一些系统参数,比如 unlock_period。侧链管理员还可以不受约束地调整 period、era 和 block_hash,用以实现侧链的回滚。
checkpoint lock 的验证逻辑:
- 加载脚本参数 admin_identity 和 type_id_hash
- 根据 type_id_hash 查找 input 和 output 中的 Checkpoint Cell,分别解析 data
- 验证 input 和 output 的 Checkpoint Cell 的 capacity 相同(避免被薅)
- 加载脚本所在的 input cell 对应的 witness,若 input_type == 0x00,表示 admin 模式,若 input_type == 0x01,表示 checkpoint 模式,其他取值则返回错误。
- admin 模式
- 基于 admin_identity 验签
- 验证 input 和 output 的 version、period_interval、era_period、base_reward、half_period、sudt_type_hash 和 stake_lock_hash、withdrawal_lock_code_hash 是否相同
- 根据 sudt_type_hash 查找 input 和 output 的 AT Cell,验证 input 总额 >= output 总额(admin 模式下不允许发币)
- checkpoint 模式
- 验证 input 和 output 的 version、state、period_interval、era_period、unlock_period、base_reward、half_period、sudt_type_hash、stake_type_hash、withdrawal_lock_code_hash 是否相同
- 加载 witness 中的 checkpoint(不能为空),解析 checkpoint(rlp 编码),获得 L2_block_hash, L2_block_number, L2_signature, L2_bitmap(参与聚合签名的共识节点编号), L2_last_checkpoint_block_hash, L2_proposer 等字段。根据 L2 的 block_hash 计算规则计算 block_hash(Kaccak 哈希算法),验证是否等于 L2_block_hash。
- 根据 stake_type_hash 在 cell_deps 里查找 Stake Cell,根据规则计算出 output.era 的共识节点列表,验证 L2_bitmap 中参与共识的节点数量超过 2/3 的共识节点。根据 L2_bitmap 获得参与聚合签名的共识节点的 bls_puk_key,使用 BLS 聚合签名算法验签。
- 验证 input.state == 0x01 && output.period == input.period + 1 && output.era == ⌊output.period/era_period⌋ && output.block_hash == L2_block_hash && output.period * period_interval == L2_block_number && input.block_hash == L2_last_checkpoint_block_hash
- 根据 sudt_type_hash 查找 input 和 output 的 AT Cell,验证 output 总额 - input 总额 == base_reward / (2^⌊period/half_period⌋)
- 根据 L2_proposer 在共识节点列表中查找对应的 Identity,再结合 admin_identity, checkpoint_cell_type_hash 和 withdrawal_lock_code_hash 和 withdrawal_lock_hash_type 构造出 withdrawal lock,然后计算出 withdrawal_lock_hash
- 根据 withdrawal_lock_hash 和 sudt_type_hash 查找 input 和 output 的 Withdrawal AT cell,验证 output 总额 - input 总额 == base_reward / (2^⌊period/half_period⌋),且 output.{each Withdrawal AT cell}.period == output.{Checkpoint Cell}.period + output.{Checkpoint Cell}.unlock_period
3. stake lock
Code hash: Stake Lock script code hash
Hash type: Type
Args: <21 byte admin_identity><32 byte type_id_hash><Optional, 21 byte node_identity>
table StakeLockWitnessLock {
lock: BytesOpt,
input_type: BytesOpt, // input_type == 0x00,lock 存储 admin_signature,
// input_type == 0x01, lock 存储 node_signature
output_type: BytesOpt,
}
struct StakeInfo {
Identity: Identity, // 竞选共识节点在 L1 的身份信息
l2_address: Byte20, // 共识节点在 L2 的地址,用于根据 checkpoint 的 proposer 查找 bls_pub_key
bls_pub_key: Byte97, // bls 多签公钥,用于验证 checkpoint 的聚合签名
stake_amount: Byte16, // little endian number,节点抵押的 AT 金额
inauguration_era: Byte8, // little endian number,从哪个 era 开始参与竞选
}
Stake Cell Data:
version: byte
stake_infos: vector<StakeInfo>
checkpoint_type_hash: Byte32 // checkpoint type script hash
sudt_type_hash: Byte32 // sUDT type script hash
quorum_size: byte // little endian number
stake lock 控制共识节点的竞选,抵押和赎回。Stake Cell 记录了参与竞选的共识节点和一些相关的系统参数,** Stake AT Cell 则管理着共识节点参与竞选的抵押资金 ** 。若有侧链管理员的签名,则侧链管理员可以烧掉作恶节点抵押的 AT,修改 Stake Cell 的共识列表。
为了保证共识节点列表在一段时间内保持稳定,避免共识节点对当前有效的共识列表产生分歧,设定了以下几个规则:
- 抵押金额发生变动(抵押、追加、部分赎回和全部赎回)时,需新增一条 stake info。新增的 stake info 的 inauguration_era 必须等于当前引用的 {Checkpoint Cell}.era(即当前 era) + 2。** 加 2 是为了确保所有共识节点有充足的缓冲时间确定当前 era 和下一个 era 的共识列表 ** 。因此,同一个共识节点(以 Identity 标识)可能在列表中有多条 stake info(但inauguration_era不能相同),但是同一个节点不能有多条 inauguration_era 相同的 stake info。同一个 inauguration_era 的 stake info 数量不得超过 quorum_size
- 已生效的 stake info A 的定义是 A. inauguration_era <= {Checkpoint Cell}.era,且同一节点没有另外一条 stake info B,(此处逻辑表示info_A应该是最新的) B. inauguration_era > A. inauguration_era && B. inauguration_era <= {Checkpoint Cell}.era,按 amount 金额从高到低排序,前 quorum_size 个 stake info 即为已生效的 stake info。简单来说就是在当前 era 下生效,且未被同一 identity 的其他生效的 era 覆盖的金额最多的前 quorum_size 个 stake info。所有已生效的 stake info 对应的节点,即为当前 era 下有效的共识节点
- 准生效的 stake info A 的定义是 A. inauguration_era <= {Checkpoint Cell}.era + 1 (即已生效的下一个era),且同一节点没有另外一条 stake info B,B. inauguration_era > A. inauguration_era && B. inauguration_era <= {Checkpoint Cell}.era + 1,按 amount 金额从高到低排序,前 quorum_size 个 stake info 即为准生效的 stake info。简单来说就是在 era + 1 下生效,且未被同一 identity 的其他生效的 era 覆盖的金额最多的前 quorum_size 个 stake info。准生效的 stake info 对应的节点即为下一个 era 中有效的共识节点。已生效的 stake info 集合与准生效的集合一般会有交集
- 待生效的 stake info A 的定义是所有 inauguration_era > {Checkpoint Cell}.era + 1 的 stake info。待生效的 stake info 集合与已生效和准生效的集合没有交集
- 有效的 stake info 为已生效、准生效和待生效的集合的并集
- 除了有效的 stake info 之外的都是失效的 stake info。在 output 中需要删除失效的 stake info,确保 stake info 集合的大小不会超过 3* quorum_size
- 对于一个参与竞选的节点,其有效抵押金额的定义是,其所有有效的 stake info 集合中最大的 stake_amount(这里一直不理解,等最后的代码出来再check)。
(以下两点也重要:)
- 节点在进行抵押、追加或者赎回操作时,其 output 的 Stake AT Cell 的 amount 总额必须等于 output 的 Stake Cell 中有效的抵押金额
- 查询属于同一个 identity 的 input Stake AT Cell 和 output Stake AT Cell。若 output 的 amount 总额小于 input 的 amount 总额,则计算 output 中属于该 identity 的 Withdrawal AT Cell 的金额是否等于差额,其 period 是否等于引用的 Checkpoint Cell 的 period + unlock_period
![stake info 演化图](https://user-images.githubusercontent.com/32355308/148321969-62fe293f-531a-4443-9c52-b7dbd6821948.png)
stake lock 的验证逻辑:
- 加载脚本参数 admin_identity、type_id_hash 和 node_identity
- 加载脚本所在的 input cell 对应的 witness
,获得 input_type
若 input_type == 0x00,则基于 admin_identity 验签
若 input_type == 0x00,node_identity 不为空,则为 burn 模式;若 input_type == 0x00,node_identity 为空,则为 admin 模式;若 input_type == 0x01,node_identity 不为空,则为 update 模式;若 input_type == 0x01,node_identity 也为空,则为 companion 模式
+
若 witness 为空,则为 update 模式
+
若 witness 不为空,则获取 input_type
+
若 input_type == 0x00,则基于 admin_identity 验签。若 node_identity 不为空,则为 burn 模式;若 node_identity 为空,则为 admin 模式
+
若 input_type == 0x01,则为 companion 模式,其 node_identity 不能为空
- burn 模式
- 加载脚本所在 cell 的 type_hash,用 AT_hash 表示
- 遍历 output cells,统计 type_hash == AT_hash 的 cell 数量,用 AT_count 表示,验证 AT_count == 0
- admin 模式
- 根据 type_id_hash 查找 input 和 output 中的 Stake Cell,分别解析 data
- 验证 input 和 output 的 Stake Cell 的 version、checkpoint_type_hash、sudt_type_hash 相同
- 验证 output 的 quorum_size <= 160 (axon 的 bitmap 只有 160 bit,共识节点越多,共识效率越低)
- update 模式
根据 node_identity 对 node_signature 验签
- 根据 type_id_hash 查找 input 和 output 中的 Stake Cell,分别解析 data
- 验证 input 和 output 的 Stake Cell 的 version、checkpoint_type_hash、sudt_type_hash、quorum_size 相同
- 根据 checkpoint_type_hash 从 cell deps 中读取 Checkpoint Cell,解析 data 获取 era, period, unlock_period 等
从 input 和 output 的 Stake Cell 中分别获取待生效的 stake info 集合(根据各自的 era 计算,input 和 output 的 era 不一定相同),比较这两个集合,验证 input 的是 output 的子集,且差集是一条 identity 等于 node_identity 的 stake info,用 node_stake_info 表示这条记录
+
从 input 和 output 的 Stake Cell 中分别获取待生效的 stake info 集合(根据各自的 era 计算,input 和 output 的 era 不一定相同),比较这两个集合,验证 input 的是 output 的子集,且差集只有一条,用 node_stake_info 表示这条记录,用 insert_identity 表示这条记录中的 Identity
- 将 node_stake_info 插入 input 的 stake_infos 数组中,根据以下规则进行处理
- 验证不存在 identity 和 inauguration_era 都相同的两条 stake info 记录
基于 output 的 era, 验证待生效的 stake info 集合的大小不超过 quorum_size
基于 output 的 era, 获取已生效的 stake info 集合和准生效的 stake info 集合,进而得到失效的 stake info 集合
- 将失效的 stake info 集合从 stake_infos 中删除,验证所得到的 stake_infos 与 output 的 stake_infos 相同
计算 node_identity 的有效的抵押金额
+
计算 insert_identity 的有效的抵押金额
根据 sudt_type_hash 和当前脚本的 lock_hash 查找 input 和 output 的 Stake AT Cell,验证 output 的 amount 之和等于有效的抵押金额,计算 input 减去 output 的 amount 差额,用 withdraw_amount 表示。
+
根据 sudt_type_hash 和 insert_identity 查找 input 和 output 的 Stake AT Cell,验证 output 的 amount 之和等于有效的抵押金额,计算 input 减去 output 的 amount 差额,用 withdraw_amount 表示。
- 若 withdraw_amount <= 0,验证结束
- 若 withdraw_amount > 0
根据 node_identity,再结合 admin_identity, checkpoint_type_hash 和 withdrawal_lock_code_hash 和 withdrawal_lock_hash_type 构造出 withdrawal lock,然后计算出 withdrawal_lock_hash
+
根据 insert_identity,再结合 admin_identity, checkpoint_type_hash 和 withdrawal_lock_code_hash 和 withdrawal_lock_hash_type 构造出 withdrawal lock,然后计算出 withdrawal_lock_hash
- 根据 sudt_type_hash 和 withdrawal_lock_hash 查找 output 的 Withdrawal AT Cell,验证 amount 总额 == withdraw_amount
- 验证 output.{each Withdrawal AT cell}.period == cell_deps.{Checkpoint Cell}.period + cell_deps.{Checkpoint Cell}.unlock_period
- companion 模式
+
根据 node_identity 对 node_signature 验签
遍历 input cells,获取 lock_code_hash 等于当前脚本的 code_hash 的 cell,验证其中至少有一个 cell 的 node_identity 不为空
+
验证 input cells 中至少有一个 Cell 的 type_hash 等于当前脚本参数中的 type_id_hash
4. withdrawal lock
Code hash: Withdrawal Lock script code hash
Hash type: Type
Args: <21 byte admin_identity><32 byte checkpoint_cell_type_hash><21 byte node_identity>
table WithdrawalLockWitnessLock {
lock: BytesOpt,
input_type: BytesOpt, // input_type == 0x00,lock 存储 admin_signature,
// input_type == 0x01, lock 存储 node_signature
output_type: BytesOpt,
}
Withdrawal AT Cell Data:
amount: Byte16 // little endian number
period: Byte8 // little endian number
withdrawal lock 发挥锁定 AT 的作用,使共识节点在赎回 AT 押金,或者提交 checkpoint 获得 AT 奖励后,仍然需要等待一个解锁期。这样可以避免共识节点作恶后通过快速解套降低损失。
withdrawal lock 的验证逻辑:
- 加载脚本参数 admin_identity、checkpoint_cell_type_hash 和 node_identity
加载脚本所在的 input cell 对应的 witness,获得 input_type
若 input_type == 0x00,则基于 admin_identity 验签
若 input_type == 0x00,node_identity 为空,则为 burn 模式;若 input_type == 0x01,node_identity 不为空,则为 unlock 模式;若 input_type == 0x01,node_identity 为空,则为 acp 模式.
+
加载脚本所在的 input cell 对应的 witness
+
若 witness 为空,则为 acp 模式,此时 node_identity 不能为空
+
若 witness 不为空,则获取 input_type
+
若 input_type == 0x00,则为 burn 模式,此时基于 admin_identity 验签
+
若 input_type == 0x01,则为 unlock 模式,此时 node_identity 不能为空
- burn 模式
- 加载脚本所在 cell 的 type_hash,用 AT_hash 表示
- 遍历 output cells,统计 type_hash == AT_hash 的 cell 数量,用 AT_count 表示,验证 AT_count == 0
- unlock 模式
- 根据 node_identity 对 node_signature 验签
- 根据 checkpoint_cell_type_hash 从 cell deps 中加载 Checkpoint Cell,解析 data 得到 period
- 验证脚本所在的 Cell 的 period 小于等于 Checkpoint Cell 的 period
- acp 模式
- 根据当前脚本的 hash,查找 input 和 output 中的 Withdrawal AT Cell,验证 output 的 amount 总额大于等于 input 的 amount 总额
数据结构
array Byte4 [byte; 4];
array Byte8 [byte; 8];
array Byte10 [byte; 10];
array Byte16 [byte; 16];
array Byte20 [byte; 20];
array Byte32 [byte; 32];
array Byte97 [byte; 97];
// 身份信息,具体定义见 https://github.com/XuJiandong/docs-bank/blob/master/omni_lock.md#auth
// 在实现时,一开始只考虑支持 secp pubkey 的情况
struct Identity {
flag: byte,
content: Byte20
}
// 抵押信息
struct StakeInfo {
identity: Identity, // 竞选共识节点在 L1 的身份信息
l2_address: Byte20, // 共识节点在 L2 的地址,用于根据 checkpoint 的 proposer 查找 bls_pub_key
bls_pub_key: Byte97, // bls 多签公钥,用于验证 checkpoint 的聚合签名
stake_amount: Byte16, // little endian number,节点抵押的 AT 金额
inauguration_era: Byte8, // little endian number,从哪个 era 开始参与竞选
}
Selection Cell
Data: <0x>
Type: <Null>
Lock:
code_hash: Byte32 // selection lock
args: Byte32 | Byte32 // omni_lock_hash | checkpoint_lock_hash
// 文档见 https://github.com/XuJiandong/docs-bank/blob/master/omni_lock.md
Omni Cell
Data:
version: byte
current_supply: Byte16 // little endian number
max_supply: Byte16 // little endian number,设置为 u128::MAX 相当于没有上限
sudt_type_hash: Byte32 // sUDT type script hash
Type:
code_hash: Byte32 // type ID
args: Byte32 // hash(input[0].outpoint | output_index)
Lock:
code_hash: Byte32 // omni lock
args: Identity | byte | Byte32 // admin_identity | ’08’ | omni_cell_type_hash
// admin_identity 是侧链管理员的身份
Checkpoint Cell
Data:
version: byte
state: byte // 0x00 表示停止更新 0x01 表示开启更新
period: Byte8 // little endian number,表示最新的 period 序号
era: Byte8 // little endian number,表示最新的 era 序号
block_hash: Byte32 // 最新 checkpoint 的区块哈希
period_interval: Byte4 // little endian number,表示相邻 period 的 L2 区块间隔
era_period: Byte4 // little endian number,表示相邻 era 的间隔,单位 period
unlock_period: Byte4 // little endian number,表示 Withdrawal AT Cell 的解锁间隔,单位 period
base_reward: Byte16 // little endian number,表示提交 checkpoint 的基础 AT 奖励数量
half_period: Byte8 // little endian number,表示奖励减半的 L2 间隔,单位 period
// 设置为 u64::MAX 相当于永不减半
common_ref: Byte10 // BLS 聚合签名的 common 信息,用于 bls 验签
sudt_type_hash: Byte32 // sUDT type script hash
stake_type_hash: Byte32 // stake type script hash
withdrawal_lock_code_hash: Byte32
Type:
code_hash: Byte32 // type ID
args: Byte32 // hash(input[0].outpoint | output_index)
Lock:
code_hash: Byte32 // checkpoint lock
args: Identity | Byte32 // admin_identity | checkpoint_cell_type_hash
Stake Cell
Data:
version: byte
stake_infos: vector<StakeInfo>
checkpoint_type_hash: Byte32 // checkpoint type script hash
sudt_type_hash: Byte32 // sUDT type script hash
quorum_size: byte // little endian number
Type:
code_hash: Byte32 // type ID
args: Byte32 // hash(input[0].outpoint | output_index)
Lock:
code_hash: Byte32 // stake lock
args: Identity | Byte32 // admin_identity | stake_cell_type_hash
Normal AT Cell
Data
amount: Byte16 // little endian number
Type
code_hash: Byte32 // sUDT type
args: Byte32 // selection_lock_script_hash
Lock: <Any Lock>
Stake AT Cell
Data:
amount: Byte16 // little endian number
Type:
code_hash: Byte32 // sUDT type
args: Byte32 // selection_lock_script_hash
Lock:
code_hash: Byte32 // stake lock
args: Identity | Byte32 | Identity // admin_identity | stake_cell_type_hash | node_identity
Withdrawal AT Cell
Data:
amount: Byte16 // little endian number
period: Byte8 // little endian number
Type:
code_hash: Byte32 // sUDT type
args: Byte32 // selection_lock_script_hash
Lock:
code_hash: Byte32 // withdrawal lock
args: Identity | Byte32 | Identity // admin_identity | checkpoint_cell_type_hash | node_identity
交易结构
- 创建 Selection Cell, Omni Cell, Checkpoint Cell 和 Stake Cell
CellDeps:
Secp Lock Group Cell
Inputs:
Normal CKB Cell // collect CKB
Outputs:
Selection Cell // Lock should be admin's secp lock
Omni Cell // Identity of lock args should be admin's secp lock
Checkpoint Cell
Stake Cell
Normal CKB Cell // for change
Witnesses:
<signature>
- 侧链管理员发行 AT 代币
CellDeps:
TypeID Type Deploy Cell
sUDT Type Deploy Cell
Selection Lock Deploy Cell
Omni Lock Group Cell
Secp Lock Group Cell
Acp Lock Group Cell
Inputs:
Selection Cell
Omni Cell
Normal CKB Cell // collect CKB
Acp AT Cell // Optional, if the receiver has Acp AT Cell, then put it here.
Outputs:
Selection Cell // nothing change
Omni Cell // update current_supply
Acp AT Cell // update amount
Normal CKB Cell // for change
Witnesses:
<0x>
<signature>
<signature>
<0x>
- 抵押/追加抵押/赎回/部分赎回 AT 代币
CellDeps:
Checkpoint Cell
TypeID Type Deploy Cell
sUDT Type Deploy Cell
Stake Lock Group Cell
Secp Lock Group Cell
Acp Lock Group Cell
Inputs:
Stake Cell
Acp AT Cell // Optional, used in initial staking or increasing staking
Stake AT Cell // Optional, all Stake AT Cells of this stake participant should be here
Normal CKB Cell // collect CKB
Outputs:
Stake Cell // update stake_infos
Acp AT Cell // Optional, used in initial staking or increasing staking
Stake AT Cell // Optional, amount = valid stake amount of output stake_infos.
// If the amount is zero, remove it.
Withdrawal AT Cell // Optional, used in withdrawing,
// amount = input amount - output amount of Stake AT Cell
Normal CKB Cell // for change
Witnesses:
<0x>
<Signature>
<Signature> // 必须要有 node_identity 的签名,不然任何人都能做赎回操作
<Signature>
- 共识节点提交 checkpoint
CellDeps:
Stake Cell
TypeID Type Deploy Cell
sUDT Type Deploy Cell
Selection Lock Deploy Cell
Checkpoint Lock Group Cell
Withdrawal Lock Group Cell
Secp Lock Group Cell
Inputs:
Selection Cell
Checkpoint Cell
Withdrawal AT Cell // Optional, maintain at least two Withdrawal AT Cells for rotation.
// If < 2, create new one. If >=2, use the one of max record.
Normal CKB Cell // collect CKB
Outputs:
Selection Cell // nothing change
Checkpoint Cell // update period, era(optional)
Withdrawal AT Cell // period = period of Stake Cell + unlock_period
Normal CKB Cell // for change
Witnesses:
<0x>
<checkpoint>
<0x>
<Signature>
- 共识节点 unlock Withdrawal AT Cell
CellDeps:
Checkpoint Cell
sUDT Type Deploy Cell
Withdrawal Lock Group Cell
Secp Lock Group Cell
Acp Lock Group Cell
Inputs:
Withdrawal AT Cell
Acp AT Cell
Normal CKB Cell // collect CKB
Outputs:
Acp AT Cell // update amount
Normal CKB Cell // for change
Witnesses:
<Signature>
<0x>
<Signature>
- 侧链管理员关闭/开启 checkpoint 更新,或者回滚 period,era,设置参数
CellDeps:
TypeID Type Deploy Cell
Checkpoint Lock Group Cell
Secp Lock Group Cell
Inputs:
Checkpoint Cell
Normal CKB Cell // collect CKB
Outputs:
Checkpoint Cell // update state, period, era
Normal CKB Cell // for change
Witnesses:
<Signature of admin>
<Signature>
- 侧链管理员更新共识列表,quorum_size 等参数
CellDeps:
TypeID Type Deploy Cell
sUDT Type Deploy Cell
Stake Lock Group Cell
Secp Lock Group Cell
Inputs:
Stake Cell
Normal CKB Cell // collect CKB
Outputs:
Stake Cell // update state_infos, quoram_size
Normal CKB Cell // for change
Witnesses:
<Signature of admin>
<Signature>
- 侧链管理员惩罚作恶的共识节点,罚没押金
CellDeps:
Stake Lock Group Cell
Withdrawal Lock Group Cell
Inputs:
Stake AT Cell
Withdrawal AT Cell
Outputs:
Normal CKB Cell // for change
Witnesses:
<Signature of admin>
<Signature of admin>