From 9d83489e7a2d90a13768835eeaf899cc3e659d59 Mon Sep 17 00:00:00 2001 From: xcshuan Date: Sat, 25 Dec 2021 21:56:29 +0800 Subject: [PATCH 1/7] add udt info --- rfcs/0000-sudt-info/0000-sudt info.md | 184 ++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 rfcs/0000-sudt-info/0000-sudt info.md diff --git a/rfcs/0000-sudt-info/0000-sudt info.md b/rfcs/0000-sudt-info/0000-sudt info.md new file mode 100644 index 000000000..52991cd6d --- /dev/null +++ b/rfcs/0000-sudt-info/0000-sudt info.md @@ -0,0 +1,184 @@ +--- +Number: "0000" +Category: Standards Track +Status: Proposal +Author: Xiang Cheng +Organization: Lay2dev +Created: 2021-12-25 +--- + +# sudt info + +## 1.Overview + +sudt is a very simple udt standard. With the udt deployed by this standard, we can only get the balance from the chain, but not the token name, token symbol, decimals and other parameters. + +To extend the existing sudt standard, it is necessary to design a scheme to store token information and bind it to the corresponding sudt, but does not destroy any compatibility with the existing sudt. + +## 2. sudt Info format + +In sudt info, the most basic information that must be included is token_name, token_symbol, and decimals. As for total supply and balance, they can all be obtained by indexing the cell. + +A sudt Info in specification looks like following: + +``` +decimals: uint8 +name: Common knowledge Byte +symbol: CKB +extra: {website:"https://nervos.org"} // optional +``` + +The serialization format of sudt info should be json. + +**Data:** + +- **decimals:** the number of decimal digits used by the token, if decimals are 8 it means that the token can be divided to 0.00000001 at least, uint8 type. +- **token name:** name of the token, an array of characters encoded in UTF8. +- **symbol:** identifier of the token, such as “HIX”, an array of characters encoded in UTF8. +- extra: Anything you want to write, such as the website, the hash value of a certain picture, etc. + +The first three items are parameters that must be filled in, and information can be added as required. + +If info is placed in a cell, the cell should look like this: + +```` +Data: + sudt info +Type: + code_hash: sudt_info typescript + args: sudt type script hash or type_ID +Lock: + ... +```` + +## 3. Info data in Cell + +### 3.1. For Single Owner sudt + +The issuance of sudt on CKB is controlled by lockscript, so the simplest sudt is issued by an individual or organization using a lockscript controlled by a private key, such as USDC and other stable coins. + +For this type of sudt, you can construct an info_cell while minting sudt, whose typescript's code_hash is info_cell typescript, its args is sudt's type_script hash. Info_cell will check whether the transaction meets the conditions. + +```` +// Issue new Sudt/Sudt_Info +Inputs: + <... one of the input cells must have owner lock script as lock> +Outputs: + Sudt_Cell: + Data: + amount: uint128 + Type: + code_hash: simple_udt type script + args: owner lock script hash (...) + Lock: + + Sudt_Info_Cell: + Data: + sudt info + Type: + code_hash: sudt_info type script + args: sudt type script hash + Lock: + sudt creator defined +```` + +The following rules should be met in a Sudt Info Cell (typescript): + +- **Rule 1:** In this transaction, at least one sudt cell must exist in the output cell, and the hash of its typescript matches the args of Info_cell. +- **Rule 2:** In this transaction, at least one cell must exist in the input cell, and its lockscript is the owner lockscript of sudt. +- **Rule 3:** the lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. +- **Rule 4:** If there are multiple Info_cells, choose the info_cell with the smallest block height at the time of generation. If it is at the same block height, choose the info_cell with the smallest transaction index. The same transaction cannot generate two info_cells. + +### 3.2. For Script-drive sudt + +However, there is another type of sudt on CKB, which is not issued by a lockscript controlled by a private key but follows a specific script logic. Such as NexisDAO's dCKB and Tai, and the previous Info_cell design is no longer suitable for this situation. + +Since anyone can mint sudt while following the script logic, if we continue to use the previous logic, anyone can generate the corresponding info_cell. So we need to add new logic on the basis of the previous design. + +Since it is impossible to distinguish whether an owner lockscript is script-driven from the outside, it should be checked first according to the script-driven logic. + +```` +// Issue new Sudt/Sudt_Info +Inputs: + ... +Outputs: + Sudt_Info_Cell: + Data: + sudt info + Type: + code_hash: sudt_info type script + args: type_id + Lock: + sudt creator defined +```` + +The following rules should be met in a Sudt Info Cell (typescript): + +- **Rule1**: The cell data conforms to the format. +- **Rule2**: The args conform to the rules of type id. +- **Rule 3:** The lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. +- **Rule 4:** After constructing this Info cell, use the hash of info_cell's type_script as the first 32 bytes of the args of the lockscript of sudt owner. + +The type script of the info cell checks whether the transaction satisfies one of the two logics(single-owner or script-driven) above. + +## 4. info data in witness + +The above describes a solution to put info data in the cell, but if we don’t change info often, we can treat sudt Info as static data and put it in witness. This solution is an additional solution to info_cell and does not conflict with info_cell. + +The advantage is that it can reduce the state occupation on the chain. When sudt is useless, no state will be occupied, and there will be no situation where the state is still occupied on the chain after the EOS fundraising ends. The disadvantage is that if the blockchain of ckb is to be prune in the future, the information may be lost. + +### 4.1. For Single Owner sudt + +```` +// Issue new sudt Info +Inputs: + <... one of the input cells must have owner lock script as lock> +Outputs: + udt_Cell: + Data: + amount: uint128 + Type: + code_hash: simple_udt typescript + args: owner lock script hash (...) + Lock: + sudt creator defined +Witnesses: + ... + lock:signature,input_type:...,output_type:udt_info_data + ... +```` + +For a single-owner-controlled sudt, info_data satisfies the following rules: + +- **Rule 1**: First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. +- **Rule 2**: When there is no corresponding info_cell, scan the entire chain to find the first sudt issuance transaction that has data in the sudt info format in the output_type of the witness corresponding to owner_lock, and use the sudt info. + +### 4.2. For Script-drive sudt + +Script-driven sudt stands for, the owner_lock of sudt is not a lock controlled by a private key, but a special script. + +Since it is impossible to distinguish whether an owner lockscript is script-driven from the outside, it should be checked first according to the script-driven logic. + +```` +// Issue new Sudt/Sudt_Info +Inputs: + <... one of the input cells must have owner lock script as lock> +Outputs: + udt_Cell: + Data: + amount: uint128 + Type: + code_hash: simple_udt typescript + args: owner lock script hash (...) + Lock: + +Witnesses: + ... + lock:signature,input_type:...,output_type:udt_info_data + ... +```` + +For a script-drive sudt, info_data satisfies the following rules: + +- **Rule 1**: First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. +- **Rule 2**: When there is no corresponding info_cell, scan the entire chain to find the first issuance transaction corresponding to sudt with data in the sudt info format in the output_type of the witness corresponding to the owner lockscript, and the hash of info_data is equal to the first 32 bytes of the owner lockscript args. \ No newline at end of file From 17942e0efc8d9dd0ecbab714856bfa250502715f Mon Sep 17 00:00:00 2001 From: xcshuan Date: Mon, 10 Jan 2022 23:28:29 +0800 Subject: [PATCH 2/7] add some rules;fix typo --- rfcs/0000-sudt-info/0000-sudt info.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/rfcs/0000-sudt-info/0000-sudt info.md b/rfcs/0000-sudt-info/0000-sudt info.md index 52991cd6d..b438b7f5d 100644 --- a/rfcs/0000-sudt-info/0000-sudt info.md +++ b/rfcs/0000-sudt-info/0000-sudt info.md @@ -84,10 +84,11 @@ Outputs: The following rules should be met in a Sudt Info Cell (typescript): -- **Rule 1:** In this transaction, at least one sudt cell must exist in the output cell, and the hash of its typescript matches the args of Info_cell. -- **Rule 2:** In this transaction, at least one cell must exist in the input cell, and its lockscript is the owner lockscript of sudt. -- **Rule 3:** the lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. -- **Rule 4:** If there are multiple Info_cells, choose the info_cell with the smallest block height at the time of generation. If it is at the same block height, choose the info_cell with the smallest transaction index. The same transaction cannot generate two info_cells. +- **Rule 1:** validate the format of info cell data. +- **Rule 2:** In this transaction, at least one sudt cell must exist in the output cell, and the hash of its typescript matches the args of Info_cell. +- **Rule 3:** In this transaction, at least one cell must exist in the input cell, and its lockscript is the owner lockscript of sudt. +- **Rule 4:** the lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. +- **Rule 5:** If there are multiple Info_cells, choose the info_cell with the smallest block height at the time of generation. If it is at the same block height, choose the info_cell with the smallest transaction index. The same transaction cannot generate two info_cells. ### 3.2. For Script-drive sudt @@ -114,8 +115,8 @@ Outputs: The following rules should be met in a Sudt Info Cell (typescript): -- **Rule1**: The cell data conforms to the format. -- **Rule2**: The args conform to the rules of type id. +- **Rule 1:** validate the format of info cell data. +- **Rule 2:** The args conform to the rules of type id. - **Rule 3:** The lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. - **Rule 4:** After constructing this Info cell, use the hash of info_cell's type_script as the first 32 bytes of the args of the lockscript of sudt owner. @@ -150,8 +151,8 @@ Witnesses: For a single-owner-controlled sudt, info_data satisfies the following rules: -- **Rule 1**: First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. -- **Rule 2**: When there is no corresponding info_cell, scan the entire chain to find the first sudt issuance transaction that has data in the sudt info format in the output_type of the witness corresponding to owner_lock, and use the sudt info. +- **Rule 1:** First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. +- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first sudt issuance transaction that has data in the sudt info format in the output_type of the witness corresponding to owner_lock, and use the sudt info. ### 4.2. For Script-drive sudt @@ -180,5 +181,5 @@ Witnesses: For a script-drive sudt, info_data satisfies the following rules: -- **Rule 1**: First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. -- **Rule 2**: When there is no corresponding info_cell, scan the entire chain to find the first issuance transaction corresponding to sudt with data in the sudt info format in the output_type of the witness corresponding to the owner lockscript, and the hash of info_data is equal to the first 32 bytes of the owner lockscript args. \ No newline at end of file +- **Rule 1:** First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. +- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first issuance transaction corresponding to sudt with data in the sudt info format in the output_type of the witness corresponding to the owner lockscript, and the hash of info_data is equal to the first 32 bytes of the owner lockscript args. \ No newline at end of file From 0b54827d758a2f8b6fee563deb34ad2947424784 Mon Sep 17 00:00:00 2001 From: xcshuan Date: Sat, 15 Jan 2022 10:51:13 +0800 Subject: [PATCH 3/7] fix typo: Unified as SUDT Info --- rfcs/0000-sudt-info/0000-sudt info.md | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/rfcs/0000-sudt-info/0000-sudt info.md b/rfcs/0000-sudt-info/0000-sudt info.md index b438b7f5d..9e8e6dd36 100644 --- a/rfcs/0000-sudt-info/0000-sudt info.md +++ b/rfcs/0000-sudt-info/0000-sudt info.md @@ -7,7 +7,7 @@ Organization: Lay2dev Created: 2021-12-25 --- -# sudt info +# SUDT Info ## 1.Overview @@ -15,11 +15,11 @@ sudt is a very simple udt standard. With the udt deployed by this standard, we c To extend the existing sudt standard, it is necessary to design a scheme to store token information and bind it to the corresponding sudt, but does not destroy any compatibility with the existing sudt. -## 2. sudt Info format +## 2. SUDT Info format -In sudt info, the most basic information that must be included is token_name, token_symbol, and decimals. As for total supply and balance, they can all be obtained by indexing the cell. +In SUDT Info, the most basic information that must be included is token_name, token_symbol, and decimals. As for total supply and balance, they can all be obtained by indexing the cell. -A sudt Info in specification looks like following: +A SUDT Info in specification looks like following: ``` decimals: uint8 @@ -28,7 +28,7 @@ symbol: CKB extra: {website:"https://nervos.org"} // optional ``` -The serialization format of sudt info should be json. +The serialization format of SUDT Info should be json. **Data:** @@ -43,9 +43,9 @@ If info is placed in a cell, the cell should look like this: ```` Data: - sudt info + SUDT Info Type: - code_hash: sudt_info typescript + code_hash: SUDT_Info typescript args: sudt type script hash or type_ID Lock: ... @@ -60,7 +60,7 @@ The issuance of sudt on CKB is controlled by lockscript, so the simplest sudt is For this type of sudt, you can construct an info_cell while minting sudt, whose typescript's code_hash is info_cell typescript, its args is sudt's type_script hash. Info_cell will check whether the transaction meets the conditions. ```` -// Issue new Sudt/Sudt_Info +// Issue new SUDT/ create a new SUDT_Info cell Inputs: <... one of the input cells must have owner lock script as lock> Outputs: @@ -72,17 +72,17 @@ Outputs: args: owner lock script hash (...) Lock: - Sudt_Info_Cell: + SUDT_Info_Cell: Data: - sudt info + SUDT Info Type: - code_hash: sudt_info type script + code_hash: SUDT_Info type script args: sudt type script hash Lock: sudt creator defined ```` -The following rules should be met in a Sudt Info Cell (typescript): +The following rules should be met in a SUDT Info Cell (typescript): - **Rule 1:** validate the format of info cell data. - **Rule 2:** In this transaction, at least one sudt cell must exist in the output cell, and the hash of its typescript matches the args of Info_cell. @@ -99,21 +99,21 @@ Since anyone can mint sudt while following the script logic, if we continue to u Since it is impossible to distinguish whether an owner lockscript is script-driven from the outside, it should be checked first according to the script-driven logic. ```` -// Issue new Sudt/Sudt_Info +// Create a new SUDT_Info cell Inputs: ... Outputs: - Sudt_Info_Cell: + SUDT_Info_Cell: Data: - sudt info + SUDT Info Type: - code_hash: sudt_info type script + code_hash: SUDT_Info type script args: type_id Lock: sudt creator defined ```` -The following rules should be met in a Sudt Info Cell (typescript): +The following rules should be met in a SUDT Info Cell (typescript): - **Rule 1:** validate the format of info cell data. - **Rule 2:** The args conform to the rules of type id. @@ -124,14 +124,14 @@ The type script of the info cell checks whether the transaction satisfies one of ## 4. info data in witness -The above describes a solution to put info data in the cell, but if we don’t change info often, we can treat sudt Info as static data and put it in witness. This solution is an additional solution to info_cell and does not conflict with info_cell. +The above describes a solution to put info data in the cell, but if we don’t change info often, we can treat SUDT Info as static data and put it in witness. This solution is an additional solution to info_cell and does not conflict with info_cell. The advantage is that it can reduce the state occupation on the chain. When sudt is useless, no state will be occupied, and there will be no situation where the state is still occupied on the chain after the EOS fundraising ends. The disadvantage is that if the blockchain of ckb is to be prune in the future, the information may be lost. ### 4.1. For Single Owner sudt ```` -// Issue new sudt Info +// Create new SUDT_Info data Inputs: <... one of the input cells must have owner lock script as lock> Outputs: @@ -152,7 +152,7 @@ Witnesses: For a single-owner-controlled sudt, info_data satisfies the following rules: - **Rule 1:** First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. -- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first sudt issuance transaction that has data in the sudt info format in the output_type of the witness corresponding to owner_lock, and use the sudt info. +- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first sudt issuance transaction that has data in the SUDT Info format in the output_type of the witness corresponding to owner_lock, and use the SUDT Info. ### 4.2. For Script-drive sudt @@ -161,7 +161,7 @@ Script-driven sudt stands for, the owner_lock of sudt is not a lock controlled b Since it is impossible to distinguish whether an owner lockscript is script-driven from the outside, it should be checked first according to the script-driven logic. ```` -// Issue new Sudt/Sudt_Info +// Create a new SUDT_Info data Inputs: <... one of the input cells must have owner lock script as lock> Outputs: @@ -182,4 +182,4 @@ Witnesses: For a script-drive sudt, info_data satisfies the following rules: - **Rule 1:** First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. -- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first issuance transaction corresponding to sudt with data in the sudt info format in the output_type of the witness corresponding to the owner lockscript, and the hash of info_data is equal to the first 32 bytes of the owner lockscript args. \ No newline at end of file +- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first issuance transaction corresponding to sudt with data in the SUDT Info format in the output_type of the witness corresponding to the owner lockscript, and the hash of info_data is equal to the first 32 bytes of the owner lockscript args. \ No newline at end of file From ae787c3e2a1ae45a401b50f0e910698c7b5ac36b Mon Sep 17 00:00:00 2001 From: xcshuan Date: Wed, 19 Jan 2022 18:50:43 +0800 Subject: [PATCH 4/7] change rfc number to 0038 --- rfcs/0000-sudt-info/0000-sudt info.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0000-sudt-info/0000-sudt info.md b/rfcs/0000-sudt-info/0000-sudt info.md index 9e8e6dd36..7ecda1d1c 100644 --- a/rfcs/0000-sudt-info/0000-sudt info.md +++ b/rfcs/0000-sudt-info/0000-sudt info.md @@ -1,5 +1,5 @@ --- -Number: "0000" +Number: "0038" Category: Standards Track Status: Proposal Author: Xiang Cheng From a17a810e0b0742f00408463cee1141315524a93c Mon Sep 17 00:00:00 2001 From: xcshuan Date: Wed, 19 Jan 2022 18:53:39 +0800 Subject: [PATCH 5/7] change some words to uppercase --- rfcs/0000-sudt-info/0000-sudt info.md | 66 +++++++++++++-------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/rfcs/0000-sudt-info/0000-sudt info.md b/rfcs/0000-sudt-info/0000-sudt info.md index 7ecda1d1c..2ad51c695 100644 --- a/rfcs/0000-sudt-info/0000-sudt info.md +++ b/rfcs/0000-sudt-info/0000-sudt info.md @@ -11,9 +11,9 @@ Created: 2021-12-25 ## 1.Overview -sudt is a very simple udt standard. With the udt deployed by this standard, we can only get the balance from the chain, but not the token name, token symbol, decimals and other parameters. +SUDT is a very simple UDT standard. With the UDT deployed by this standard, we can only get the balance from the chain, but not the token name, token symbol, decimals and other parameters. -To extend the existing sudt standard, it is necessary to design a scheme to store token information and bind it to the corresponding sudt, but does not destroy any compatibility with the existing sudt. +To extend the existing SUDT standard, it is necessary to design a scheme to store token information and bind it to the corresponding SUDT, but does not destroy any compatibility with the existing SUDT. ## 2. SUDT Info format @@ -28,7 +28,7 @@ symbol: CKB extra: {website:"https://nervos.org"} // optional ``` -The serialization format of SUDT Info should be json. +The serialization format of SUDT Info should be JSON. **Data:** @@ -46,29 +46,29 @@ Data: SUDT Info Type: code_hash: SUDT_Info typescript - args: sudt type script hash or type_ID + args: SUDT type script hash or type_ID Lock: ... ```` ## 3. Info data in Cell -### 3.1. For Single Owner sudt +### 3.1. For Single Owner SUDT -The issuance of sudt on CKB is controlled by lockscript, so the simplest sudt is issued by an individual or organization using a lockscript controlled by a private key, such as USDC and other stable coins. +The issuance of SUDT on CKB is controlled by lockscript, so the simplest SUDT is issued by an individual or organization using a lockscript controlled by a private key, such as USDC and other stable coins. -For this type of sudt, you can construct an info_cell while minting sudt, whose typescript's code_hash is info_cell typescript, its args is sudt's type_script hash. Info_cell will check whether the transaction meets the conditions. +For this type of SUDT, you can construct an info_cell while minting SUDT, whose typescript's code_hash is info_cell typescript, its args is SUDT's type_script hash. Info_cell will check whether the transaction meets the conditions. ```` // Issue new SUDT/ create a new SUDT_Info cell Inputs: <... one of the input cells must have owner lock script as lock> Outputs: - Sudt_Cell: + SUDT_Cell: Data: amount: uint128 Type: - code_hash: simple_udt type script + code_hash: simple_UDT type script args: owner lock script hash (...) Lock: @@ -77,24 +77,24 @@ Outputs: SUDT Info Type: code_hash: SUDT_Info type script - args: sudt type script hash + args: SUDT type script hash Lock: - sudt creator defined + SUDT creator defined ```` The following rules should be met in a SUDT Info Cell (typescript): - **Rule 1:** validate the format of info cell data. -- **Rule 2:** In this transaction, at least one sudt cell must exist in the output cell, and the hash of its typescript matches the args of Info_cell. -- **Rule 3:** In this transaction, at least one cell must exist in the input cell, and its lockscript is the owner lockscript of sudt. +- **Rule 2:** In this transaction, at least one SUDT cell must exist in the output cell, and the hash of its typescript matches the args of Info_cell. +- **Rule 3:** In this transaction, at least one cell must exist in the input cell, and its lockscript is the owner lockscript of SUDT. - **Rule 4:** the lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. - **Rule 5:** If there are multiple Info_cells, choose the info_cell with the smallest block height at the time of generation. If it is at the same block height, choose the info_cell with the smallest transaction index. The same transaction cannot generate two info_cells. -### 3.2. For Script-drive sudt +### 3.2. For Script-drive SUDT -However, there is another type of sudt on CKB, which is not issued by a lockscript controlled by a private key but follows a specific script logic. Such as NexisDAO's dCKB and Tai, and the previous Info_cell design is no longer suitable for this situation. +However, there is another type of SUDT on CKB, which is not issued by a lockscript controlled by a private key but follows a specific script logic. Such as NexisDAO's dCKB and Tai, and the previous Info_cell design is no longer suitable for this situation. -Since anyone can mint sudt while following the script logic, if we continue to use the previous logic, anyone can generate the corresponding info_cell. So we need to add new logic on the basis of the previous design. +Since anyone can mint SUDT while following the script logic, if we continue to use the previous logic, anyone can generate the corresponding info_cell. So we need to add new logic on the basis of the previous design. Since it is impossible to distinguish whether an owner lockscript is script-driven from the outside, it should be checked first according to the script-driven logic. @@ -110,7 +110,7 @@ Outputs: code_hash: SUDT_Info type script args: type_id Lock: - sudt creator defined + SUDT creator defined ```` The following rules should be met in a SUDT Info Cell (typescript): @@ -118,7 +118,7 @@ The following rules should be met in a SUDT Info Cell (typescript): - **Rule 1:** validate the format of info cell data. - **Rule 2:** The args conform to the rules of type id. - **Rule 3:** The lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. -- **Rule 4:** After constructing this Info cell, use the hash of info_cell's type_script as the first 32 bytes of the args of the lockscript of sudt owner. +- **Rule 4:** After constructing this Info cell, use the hash of info_cell's type_script as the first 32 bytes of the args of the lockscript of SUDT owner. The type script of the info cell checks whether the transaction satisfies one of the two logics(single-owner or script-driven) above. @@ -126,37 +126,37 @@ The type script of the info cell checks whether the transaction satisfies one of The above describes a solution to put info data in the cell, but if we don’t change info often, we can treat SUDT Info as static data and put it in witness. This solution is an additional solution to info_cell and does not conflict with info_cell. -The advantage is that it can reduce the state occupation on the chain. When sudt is useless, no state will be occupied, and there will be no situation where the state is still occupied on the chain after the EOS fundraising ends. The disadvantage is that if the blockchain of ckb is to be prune in the future, the information may be lost. +The advantage is that it can reduce the state occupation on the chain. When SUDT is useless, no state will be occupied, and there will be no situation where the state is still occupied on the chain after the EOS fundraising ends. The disadvantage is that if the blockchain of ckb is to be prune in the future, the information may be lost. -### 4.1. For Single Owner sudt +### 4.1. For Single Owner SUDT ```` // Create new SUDT_Info data Inputs: <... one of the input cells must have owner lock script as lock> Outputs: - udt_Cell: + UDT_Cell: Data: amount: uint128 Type: - code_hash: simple_udt typescript + code_hash: simple_UDT typescript args: owner lock script hash (...) Lock: - sudt creator defined + SUDT creator defined Witnesses: ... - lock:signature,input_type:...,output_type:udt_info_data + lock:signature,input_type:...,output_type:UDT_info_data ... ```` -For a single-owner-controlled sudt, info_data satisfies the following rules: +For a single-owner-controlled SUDT, info_data satisfies the following rules: - **Rule 1:** First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. -- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first sudt issuance transaction that has data in the SUDT Info format in the output_type of the witness corresponding to owner_lock, and use the SUDT Info. +- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first SUDT issuance transaction that has data in the SUDT Info format in the output_type of the witness corresponding to owner_lock, and use the SUDT Info. -### 4.2. For Script-drive sudt +### 4.2. For Script-drive SUDT -Script-driven sudt stands for, the owner_lock of sudt is not a lock controlled by a private key, but a special script. +Script-driven SUDT stands for, the owner_lock of SUDT is not a lock controlled by a private key, but a special script. Since it is impossible to distinguish whether an owner lockscript is script-driven from the outside, it should be checked first according to the script-driven logic. @@ -165,21 +165,21 @@ Since it is impossible to distinguish whether an owner lockscript is script-driv Inputs: <... one of the input cells must have owner lock script as lock> Outputs: - udt_Cell: + UDT_Cell: Data: amount: uint128 Type: - code_hash: simple_udt typescript + code_hash: simple_UDT typescript args: owner lock script hash (...) Lock: Witnesses: ... - lock:signature,input_type:...,output_type:udt_info_data + lock:signature,input_type:...,output_type:UDT_info_data ... ```` -For a script-drive sudt, info_data satisfies the following rules: +For a script-drive SUDT, info_data satisfies the following rules: - **Rule 1:** First, check according to the rules of info_cell, if there is a corresponding info_cell, use info_cell. -- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first issuance transaction corresponding to sudt with data in the SUDT Info format in the output_type of the witness corresponding to the owner lockscript, and the hash of info_data is equal to the first 32 bytes of the owner lockscript args. \ No newline at end of file +- **Rule 2:** When there is no corresponding info_cell, scan the entire chain to find the first issuance transaction corresponding to SUDT with data in the SUDT Info format in the output_type of the witness corresponding to the owner lockscript, and the hash of info_data is equal to the first 32 bytes of the owner lockscript args. \ No newline at end of file From 0d8fb63c71e4a6b660e03ac64f25c67363f4d71a Mon Sep 17 00:00:00 2001 From: xcshuan Date: Wed, 19 Jan 2022 18:55:11 +0800 Subject: [PATCH 6/7] rename to rfc number 0038 --- .../0000-sudt info.md => 0038-sudt-info/0038-sudt info.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rfcs/{0000-sudt-info/0000-sudt info.md => 0038-sudt-info/0038-sudt info.md} (100%) diff --git a/rfcs/0000-sudt-info/0000-sudt info.md b/rfcs/0038-sudt-info/0038-sudt info.md similarity index 100% rename from rfcs/0000-sudt-info/0000-sudt info.md rename to rfcs/0038-sudt-info/0038-sudt info.md From 6d89f9201d0b3cab128a1562de832d360abbfc91 Mon Sep 17 00:00:00 2001 From: huwenchao Date: Thu, 20 Jan 2022 18:32:10 +0800 Subject: [PATCH 7/7] doc: remove the sudt info verification --- rfcs/0038-sudt-info/0038-sudt info.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfcs/0038-sudt-info/0038-sudt info.md b/rfcs/0038-sudt-info/0038-sudt info.md index 2ad51c695..086e0f6d5 100644 --- a/rfcs/0038-sudt-info/0038-sudt info.md +++ b/rfcs/0038-sudt-info/0038-sudt info.md @@ -84,7 +84,7 @@ Outputs: The following rules should be met in a SUDT Info Cell (typescript): -- **Rule 1:** validate the format of info cell data. +- **Rule 1:** The info cell data should match the SUDT info format we mention above. We will not validate the format on-chain. If it is invalid when we parse it off-chain, just ignore the info and treat it as a SUDT without info. - **Rule 2:** In this transaction, at least one SUDT cell must exist in the output cell, and the hash of its typescript matches the args of Info_cell. - **Rule 3:** In this transaction, at least one cell must exist in the input cell, and its lockscript is the owner lockscript of SUDT. - **Rule 4:** the lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. @@ -115,7 +115,7 @@ Outputs: The following rules should be met in a SUDT Info Cell (typescript): -- **Rule 1:** validate the format of info cell data. +- **Rule 1:** The info cell data should match the SUDT info format we mention above. We will not validate the format on-chain. If it is invalid when we parse it off-chain, just ignore the info and treat it as a SUDT without info. - **Rule 2:** The args conform to the rules of type id. - **Rule 3:** The lockscript of info_cell should be set to deadlock by default, in some cases, developers can choose other lockscript. - **Rule 4:** After constructing this Info cell, use the hash of info_cell's type_script as the first 32 bytes of the args of the lockscript of SUDT owner.