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

docs: nexus works with custody unlocking #152

Merged
merged 3 commits into from
Apr 25, 2023
Merged

docs: nexus works with custody unlocking #152

merged 3 commits into from
Apr 25, 2023

Conversation

homura
Copy link
Contributor

@homura homura commented Mar 27, 2023

What Changes

Resolve #132

A documentation for how rule-based ownership to work with Nexus with custody-unlocking

https://github.com/ckb-js/nexus/blob/docs-p2sh/docs/custody-unlocking.md

Motivation

Change Type

Indicate the type of change your pull request is:

  • documentation
  • patch
  • minor
  • major

🐤 Download canary assets:

nexus--canary.152.4528074063.zip

@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Merging #152 (e2c5155) into main (7e382da) will decrease coverage by 1.10%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #152      +/-   ##
==========================================
- Coverage   87.22%   86.12%   -1.10%     
==========================================
  Files          48       45       -3     
  Lines         814      872      +58     
  Branches       97      114      +17     
==========================================
+ Hits          710      751      +41     
+ Misses         21       20       -1     
- Partials       83      101      +18     

see 31 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@homura homura added the documentation Changes only affect the documentation label Mar 27, 2023
@homura
Copy link
Contributor Author

homura commented Mar 30, 2023

the naming of "P2SH" is ambiguous, we will use "self-owned" asset and "custody" asset as the term

@homura
Copy link
Contributor Author

homura commented Apr 10, 2023

There is a new ACID (i.e. Auth, Combine, Injection, Delegation) concept that has been proposed, and the ownership will be described as these four types, and we need to consider making changes correspondingly

@homura homura marked this pull request as ready for review April 14, 2023 13:33
So for assets controlled by contracts, the contract will require the user to prove his identity, and then the contract
will decide whether to allow the user to operate the asset. The [
cheque](https://github.com/duanyytop/ckb-cheque-script/blob/89c0ef98e161882a374e2c091147808f30ca5c5b/contracts/ckb-cheque-script/src/entry.rs#L47-L53)
lock is an example, its unlocking(claiming) rule is:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be one of its unlocking(claiming) rule is:

Because cheque has another unlocking rule, reiver_signature on the cheque cell, and I think that rule is more suitable for a wallet, because in that way, cheque cell won't require any balance held by the receiver lock.

In the rule described here, the receiver must have some balance on the blockchain, making it not so convenient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, but to simplify the understanding, I only took the custody-unlocking part, I think this simplified model can be easier to understand with custody-unlocking

## Working With Existing Contracts

However, not all systems have implemented custody unlocking, but adding custody unlocking rules may not be difficult. In
general, the contracts will have a design similar to `flag`/`version` for extensibility.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems flag/version is a pattern for contracts. But there is nothing about version in context. Can you add more detail to explain it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the next section, I use .bit as an example of how the flag in .bit type script can be migrated to custody unlocking

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the next section, I use .bit as an example of how the flag in .bit type script can be migrated to custody unlocking

and where is the 'version'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version is a bit similar to flag when used to update contract, so I put them together

Copy link
Contributor

@IronLu233 IronLu233 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can request an external developer(Not belongs to Nexus) review this PR. If he is no doubt and understand all of it, It means the document is well readable.

@homura homura changed the title docs: rule-based ownership skeleton docs: nexus works with custody unlocking Apr 24, 2023
@homura
Copy link
Contributor Author

homura commented Apr 25, 2023

Maybe we can request an external developer(Not belongs to Nexus) review this PR. If he is no doubt and understand all of it, It means the document is well readable.

You're right, but non-contributors may pay less attention to PRs, and review by contributors is to ensure that the documentation makes sense first, and if users have any suggestions, we'd welcome any

@homura homura merged commit 74e3edc into main Apr 25, 2023
@homura homura deleted the docs-p2sh branch April 25, 2023 03:23
@github-actions
Copy link

🚀 PR was released in v0.0.16 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes only affect the documentation released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation for unlocking by another script
3 participants