From d5e62161a44bed7aff69eee269be731e3e9a522f Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Thu, 26 Oct 2023 14:09:35 +0100 Subject: [PATCH] Add Anchor capability & update Bech32 examples --- tips/TIP-0050/tip-0050.md | 117 ++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 54 deletions(-) diff --git a/tips/TIP-0050/tip-0050.md b/tips/TIP-0050/tip-0050.md index d3bf51a1f..ca25fcdd3 100644 --- a/tips/TIP-0050/tip-0050.md +++ b/tips/TIP-0050/tip-0050.md @@ -113,8 +113,8 @@ The address is unlocked in a transaction if and only if the underlying `Address` Allowed Capabilities are represented as a `ByteArray` with a length prefix. For the address that contains them to be valid, the following conditions must hold: -- The length prefix must be `0` or `1`. - - Future replacements of this TIP may relax this condition. +- The length prefix must be `0`, `1` or `2`. + - This condition may be relaxed in the future and implementations should anticipate greater lengths. - Bit indices start at `0`. For each byte, they are counted starting from the least-significant bit. If there was a previous byte, the indices continue where the previous byte's indices left off. - For example: In this list of two bytes with the bit patterns `0001 0000` and `0000 0100`, bits with indices `4` and @@ -136,8 +136,9 @@ does not have it. | 3 | Can receive Outputs with an Expiration Unlock Condition. | | 4 | Can receive Outputs with a Storage Deposit Return Unlock Condition. | | 5 | Can receive Account Outputs. | -| 6 | Can receive NFT Outputs. | -| 7 | Can receive Delegation Outputs. | +| 6 | Can receive Anchor Outputs. | +| 7 | Can receive NFT Outputs. | +| 8 | Can receive Delegation Outputs. | ### Semantic transaction validation rules @@ -158,65 +159,73 @@ hold for that output: - Flag 4 **unset**: The transaction is invalid if the output contains an unlock condition of type Storage Deposit Return Unlock Condition. - Flag 5 **unset**: The transaction is invalid if the output is an Account Output. -- Flag 6 **unset**: The transaction is invalid if the output is an NFT Output. -- Flag 7 **unset**: The transaction is invalid if the output is an Delegation Output. +- Flag 6 **unset**: The transaction is invalid if the output is an Anchor Output. +- Flag 7 **unset**: The transaction is invalid if the output is an NFT Output. +- Flag 8 **unset**: The transaction is invalid if the output is an Delegation Output. ## Examples ### Allowed Capabilities Bit Patterns -The following shows examples of Allowed Capabilities bit patterns and their meaning. This only shows the first byte of -the Allowed Capabilities array. +The following shows examples of Allowed Capabilities bit patterns and their meaning. This only shows the first two bytes +of the Allowed Capabilities array. -| Bit Pattern (Byte 0) | Meaning | -| -------------------- | ------------------------------------------------------------------------- | -| 0000 0011 | Can receive Native Tokens and Mana. | -| 1110 0000 | Can receive Delegation, Account and NFT Outputs (= all kinds of Outputs). | -| 0000 1100 | Can receive Outputs with time-based unlock conditions. | +| Bit Pattern | Meaning | +| ------------------- | -------------------------------------------------------- | +| 0000 0011 0000 0000 | Can receive Native Tokens and Mana. | +| 1110 0000 0000 0001 | Can receive Account, Anchor, NFT and Delegation Outputs. | +| 0000 1100 0000 0000 | Can receive Outputs with time-based unlock conditions. | ### Bech32 Strings -- **Restricted Address Examples** - - Common Input - - Ed25519 compressed public key (32 bytes): `6f1581709bb7b1ef030d210db18e3b0ba1c776fba65d8cdaad05415142d189f8` - - BLAKE2b-256 hash (32 bytes): `efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a3` - - Bech32 HRP: `iota` - - **Ed25519 Address (Plain)** - - serialized (33 bytes): `00efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a3` - - Bech32 string: `iota1qrhacyfwlcnzkvzteumekfkrrwks98mpdm37cj4xx3drvmjvnep6xqgyzyx` - - **Restricted Ed25519 Address (Every Capability Disallowed)** - - serialized (35 bytes): `2800efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a300` - - Bech32 string: `iota19qqwlhq39mlzv2esf08n0xexcvd66q5lv9hw8mz25c695dnwfj0y8gcq3l9hek` - - **Restricted Ed25519 Address (Every Capability Allowed)** - - serialized (36 bytes): `2800efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a301ff` - - Bech32 string: `iota19qqwlhq39mlzv2esf08n0xexcvd66q5lv9hw8mz25c695dnwfj0y8gcplupydhwt` - - **Restricted Ed25519 Address (Can receive Native Tokens)** - - serialized (36 bytes): `2800efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a30101` - - Bech32 string: `iota19qqwlhq39mlzv2esf08n0xexcvd66q5lv9hw8mz25c695dnwfj0y8gcpqytmqxr4` - - **Account Address (Plain)** - - serialized (33 bytes): `08f1c011fb54df4a4e5b07462536fbacc779bf80cc45e03bc3410836587b4efc98` - - Bech32 string: `iota1prcuqy0m2n055njmqarz2dhm4nrhn0uqe3z7qw7rgyyrvkrmfm7fsnwyxu6` - - **Restricted Account Address (Every Capability Disallowed)** - - serialized (35 bytes): `2808f1c011fb54df4a4e5b07462536fbacc779bf80cc45e03bc3410836587b4efc9800` - - Bech32 string: `iota19qy0rsq3ld2d7jjwtvr5vffklwkvw7dlsrxytcpmcdqssdjc0d80exqqdyjudm` - - **Restricted Account Address (Every Capability Allowed)** - - serialized (36 bytes): `2808f1c011fb54df4a4e5b07462536fbacc779bf80cc45e03bc3410836587b4efc9801ff` - - Bech32 string: `iota19qy0rsq3ld2d7jjwtvr5vffklwkvw7dlsrxytcpmcdqssdjc0d80exqplurds6sq` - - **Restricted Account Address (Can receive Native Tokens)** - - serialized (36 bytes): `2808f1c011fb54df4a4e5b07462536fbacc779bf80cc45e03bc3410836587b4efc980101` - - Bech32 string: `iota19qy0rsq3ld2d7jjwtvr5vffklwkvw7dlsrxytcpmcdqssdjc0d80exqpqyfjata7` - - **NFT Address (Plain)** - - serialized (33 bytes): `10c72a65ae53d70b99a57f72637bfd1d5ea7baa2b4ba095c989b667d38558087db` - - Bech32 string: `iota1zrrj5edw20tshxd90aexx7lar4020w4zkjaqjhycndn86wz4szrak44cs6h` - - **Restricted NFT Address (Every Capability Disallowed)** - - serialized (35 bytes): `2810c72a65ae53d70b99a57f72637bfd1d5ea7baa2b4ba095c989b667d38558087db00` - - Bech32 string: `iota19qgvw2n94efawzue54lhycmml5w4afa6526t5z2unzdkvlfc2kqg0kcqek0lex` - - **Restricted NFT Address (Every Capability Allowed)** - - serialized (36 bytes): `2810c72a65ae53d70b99a57f72637bfd1d5ea7baa2b4ba095c989b667d38558087db01ff` - - Bech32 string: `iota19qgvw2n94efawzue54lhycmml5w4afa6526t5z2unzdkvlfc2kqg0kcpluts738a` - - **Restricted NFT Address (Can receive Native Tokens)** - - serialized (36 bytes): `2810c72a65ae53d70b99a57f72637bfd1d5ea7baa2b4ba095c989b667d38558087db0101` - - Bech32 string: `iota19qgvw2n94efawzue54lhycmml5w4afa6526t5z2unzdkvlfc2kqg0kcpqyp0nq2r` +The following examples show regular addresses and examples for when they are wrapped by a _Restricted Address_ with +various capabilities. + +- **Ed25519 Address (Plain)** + - Hex-encoded binary serialization (33 bytes): `0x00efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a3` + - Bech32 string: `iota1qrhacyfwlcnzkvzteumekfkrrwks98mpdm37cj4xx3drvmjvnep6xqgyzyx` +- **Restricted Ed25519 Address (Every Capability Disallowed)** + - Hex-encoded binary serialization (35 bytes): + `0x3000efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a300` + - Bech32 string: `iota1xqqwlhq39mlzv2esf08n0xexcvd66q5lv9hw8mz25c695dnwfj0y8gcq8mnjgf` +- **Restricted Ed25519 Address (Every Capability Allowed)** + - Hex-encoded binary serialization (37 bytes): + `0x3000efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a302ff01` + - Bech32 string: `iota1xqqwlhq39mlzv2esf08n0xexcvd66q5lv9hw8mz25c695dnwfj0y8gczluqs97eene` +- **Restricted Ed25519 Address (Can receive Native Tokens)** + - Hex-encoded binary serialization (36 bytes): + `0x3000efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a30101` + - Bech32 string: `iota1xqqwlhq39mlzv2esf08n0xexcvd66q5lv9hw8mz25c695dnwfj0y8gcpqyla70tq` +- **Account Address (Plain)** + - Hex-encoded binary serialization (33 bytes): `0x0860441c013b400f402c317833366f48730610296a09243636343e7b1b7e115409` + - Bech32 string: `iota1ppsyg8qp8dqq7spvx9urxdn0fpesvypfdgyjgd3kxsl8kxm7z92qj2lln86` +- **Restricted Account Address (Every Capability Disallowed)** + - Hex-encoded binary serialization (35 bytes): + `0x300860441c013b400f402c317833366f48730610296a09243636343e7b1b7e11540900` + - Bech32 string: `iota1xqyxq3quqya5qr6q9schsvekday8xpss994qjfpkxc6ru7cm0cg4gzgq9nu0d0` +- **Restricted Account Address (Every Capability Allowed)** + - Hex-encoded binary serialization (37 bytes): + `0x300860441c013b400f402c317833366f48730610296a09243636343e7b1b7e11540902ff01` + - Bech32 string: `iota1xqyxq3quqya5qr6q9schsvekday8xpss994qjfpkxc6ru7cm0cg4gzgzluqs9xmye3` +- **Restricted Account Address (Can receive Native Tokens)** + - Hex-encoded binary serialization (36 bytes): + `0x300860441c013b400f402c317833366f48730610296a09243636343e7b1b7e1154090101` + - Bech32 string: `iota1xqyxq3quqya5qr6q9schsvekday8xpss994qjfpkxc6ru7cm0cg4gzgpqys8pcr3` +- **NFT Address (Plain)** + - Hex-encoded binary serialization (33 bytes): `0x10140f39267a343f0d650a751250445e40600d133522085d210a2b5f3f69445139` + - Bech32 string: `iota1zq2q7wfx0g6r7rt9pf63y5zyteqxqrgnx53qshfppg4470mfg3gnjfmvts0` +- **Restricted NFT Address (Every Capability Disallowed)** + - Hex-encoded binary serialization (35 bytes): + `0x3010140f39267a343f0d650a751250445e40600d133522085d210a2b5f3f6944513900` + - Bech32 string: `iota1xqgpgreeyearg0cdv5982yjsg30yqcqdzv6jyzzayy9zkheld9z9zwgqjt4fkk` +- **Restricted NFT Address (Every Capability Allowed)** + - Hex-encoded binary serialization (37 bytes): + `0x3010140f39267a343f0d650a751250445e40600d133522085d210a2b5f3f6944513902ff01` + - Bech32 string: `iota1xqgpgreeyearg0cdv5982yjsg30yqcqdzv6jyzzayy9zkheld9z9zwgzluqs3ctnc5` +- **Restricted NFT Address (Can receive Native Tokens)** + - Hex-encoded binary serialization (36 bytes): + `0x3010140f39267a343f0d650a751250445e40600d133522085d210a2b5f3f694451390101` + - Bech32 string: `iota1xqgpgreeyearg0cdv5982yjsg30yqcqdzv6jyzzayy9zkheld9z9zwgpqysq5lyk` # Rationale & Alternatives