Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Keith-CY opened this issue Aug 9, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@Keith-CY
Copy link
Member

Keith-CY commented Aug 9, 2023

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

@Keith-CY Keith-CY added the documentation Improvements or additions to documentation label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: 🔖 Ready
Development

No branches or pull requests

1 participant