Skip to content

Support constructing custom transactions based on outputs of store models #426

@Keith-CY

Description

@Keith-CY

This issue comes from #232

The case provided by .bit team is https://github.com/dotbitHQ/das-contracts/blob/docs/docs/zh-hans/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/%E4%BA%A4%E6%98%93%E7%BB%93%E6%9E%84%E5%8D%8F%E8%AE%AE.md#%E5%88%9B%E5%BB%BA%E5%8F%8D%E5%90%91%E8%A7%A3%E6%9E%90-smt-%E6%A0%91createreverserecordroot

And it's actually transactions of business logic but not contract deployment. So the case is tracked by this issue, respectively.


There are two types of transactions:

  1. create a cell for reverse record
CellDeps:
  das-lock
  balance-cell-type
  reverse-record-root-cell-type
  ConfigCellMain
  ConfigCellReverseResolution
Inputs:
  BalanceCell {1,}
Outputs:
  ReverseRecordRootCell {1,}
  BalanceCell {1,}
  1. update a cell of reverse record
HeaderDeps:
  block_hash(ReverseRecordRootCell)
CellDeps:
  das-lock
  balance-cell-type
  reverse-record-root-cell-type
  ConfigCellMain
  ConfigCellReverseResolution
  ConfigCellSMTNodeWhitelist
Inputs:
  ReverseRecordRootCell
  BalanceCell {1,}
Outputs:
  ReverseRecordRootCell
  BalanceCell {1,}

The differences between these two types of transactions are as follows:

+ HeaderDeps:
+   block_hash(ReverseRecordRootCell)
  CellDeps:
    das-lock
    balance-cell-type
    reverse-record-root-cell-type
    ConfigCellMain
    ConfigCellReverseResolution
+   ConfigCellSMTNodeWhitelist
  Inputs:
+   ReverseRecordRootCell
    BalanceCell {1,}
  Outputs:
    ReverseRecordRootCell
    BalanceCell {1,}

Among them,

+   ReverseRecordRootCell

is updated by store model, and

+ HeaderDeps:
+   block_hash(ReverseRecordRootCell)
  CellDeps:
+   ConfigCellSMTNodeWhitelist

is updated by the view layer in MVP dapp at https://github.com/ckb-js/kuai/blob/develop/packages/samples/mvp-dapp/src/views/tx.view.ts#L20

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    Status

    🔖 Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions