From 97d9e69f41e53a6bd733b9a3861054042e3427ff Mon Sep 17 00:00:00 2001 From: SunMi Lee Date: Tue, 15 Jun 2021 03:00:57 -0700 Subject: [PATCH 1/4] On-chain Domain Resolution --- dips/dip-182.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 dips/dip-182.md diff --git a/dips/dip-182.md b/dips/dip-182.md new file mode 100644 index 00000000..58ddc220 --- /dev/null +++ b/dips/dip-182.md @@ -0,0 +1,71 @@ +--- +dip: 182 +title: On-Chain Domain Resolution +authors: Sunmi Lee (@sunmilee), David Wolinsky (@davidiw) +status: Draft +type: Informational +created: 06/08/2021 +last_updated: 06/015/2021 +issue: https://github.com/diem/dip/issues/182 +--- + +# Summary + +This DIP describes the on-chain domain name resolution process. + +On-chain domain name resolution allows organizations to be able to define their product names, and for VASPs to look up other VASPs using the product names. +Having a human-readable VASP identifier gives Diem Ecosystem the ability enumerate all VASPs by their names, which is useful for merchant purposes as well as p2p transaction. +For example, given a VASP domain name in a payment transaction, VASPs can look up where to route the payment correctly using an approved and accurate mapping of VASP identifier to an on-chain address. + +# On-chain data + +## Domain Format +A VASP domain name is a unique string that is mapped to a VASP. Specification: +* Case insensitive +* Valid regular expression: `^[a-zA-Z0-9][a-zA-Z0-9.]*$` +* Maximum length: 63 characters (64 including `@`) + +## DiemID Domain + +``` +resource struct DiemIdDomains { + domains: vector, +} +struct DiemIdDomain { + domain: vector, // Utf-8 encoded +} +``` +* Field definitions: + * `domain` - name of a DiemID domain +* The `DiemIdDomains` resource can only be published into an account with `Role == PARENT_VASP_ROLE_ID`. +* The `DiemIdDomains` contains a list of `DiemIdDomain` structs that are associated with a VASP. As such, it is possible to register more than one DiemID Domain for a given VASP +* Only the special TreasuryCompliance account (address `0xB1E55ED`) can manipulate a DiemIdDomains resource: + * Only TC account can create and publish a `DiemIdDomains` resource + * Only TC account can add, remove or update a `DiemIdDomain` within `DiemIdDomains` resource +* `DiemIDDomains` resource will be created in an empty state as part of creating a `ParentVASP` account resource, and existing `ParentVASP` accounts without `DiemIDDomains` will have the resource instantiated by the DiemRoot account +* In order to register a DiemID domain, a VASP needs to submit a request to Diem Association. After approval, Diem Association will use TreasuryCompliance account to issue an on-chain transaction to register a DiemID Domain + +## DiemID Domain Events + +The Move contract that manages DiemID domains must emit an event every time DiemID domain is created, removed or updated. Those events are critical for applications to be able to efficiently index existing DiemID domains. +An application can be built to listen for these events to construct a mapping of DiemID domains to VASP accounts for lookup of onchain addresses given a DiemID domain. +While DiemID domains are published into VASP account resource, DiemID domain events are published under the TreasuryCompliance account. We consolidate events under single account to allow indexers to follow a single event stream. + +To store events, `DiemIdDomainManager` resource is published under the TreasuryCompliance account(address `0xB1E55ED`). + +``` +resource struct DiemIdDomainManager { + /// Events are emmitted + diem_id_domain_events: Event::EventHandle, +} +struct DiemIdDomainEvent { + removed: bool, + domain: DiemIdDomain, + address: address, +} +``` + +* Fields definition: + * `removed` - `true`, if DiemIdDomain was removed, `false` if it was created or updated + * `domain` - exact copy of `DiemIdDomain` that was added/removed from `DiemIdDomains` resource of a VASP account + * `address` - address of an account where `DiemIdDomain` was added or removed From 982d1701c6c9da7d88f49d73d6be6a28568fff05 Mon Sep 17 00:00:00 2001 From: SunMi Lee Date: Thu, 24 Jun 2021 01:13:01 -0700 Subject: [PATCH 2/4] Comments --- dips/dip-182.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dips/dip-182.md b/dips/dip-182.md index 58ddc220..fca5d2dd 100644 --- a/dips/dip-182.md +++ b/dips/dip-182.md @@ -11,10 +11,10 @@ issue: https://github.com/diem/dip/issues/182 # Summary -This DIP describes the on-chain domain name resolution process. +This DIP proposes adding VASP domain names on-chain and describes the domain name resolution process. On-chain domain name resolution allows organizations to be able to define their product names, and for VASPs to look up other VASPs using the product names. -Having a human-readable VASP identifier gives Diem Ecosystem the ability enumerate all VASPs by their names, which is useful for merchant purposes as well as p2p transaction. +Having a human-readable VASP identifier gives the Diem community the ability enumerate all VASPs by their names, which is useful for merchant purposes as well as p2p transactions. For example, given a VASP domain name in a payment transaction, VASPs can look up where to route the payment correctly using an approved and accurate mapping of VASP identifier to an on-chain address. # On-chain data @@ -43,7 +43,7 @@ struct DiemIdDomain { * Only TC account can create and publish a `DiemIdDomains` resource * Only TC account can add, remove or update a `DiemIdDomain` within `DiemIdDomains` resource * `DiemIDDomains` resource will be created in an empty state as part of creating a `ParentVASP` account resource, and existing `ParentVASP` accounts without `DiemIDDomains` will have the resource instantiated by the DiemRoot account -* In order to register a DiemID domain, a VASP needs to submit a request to Diem Association. After approval, Diem Association will use TreasuryCompliance account to issue an on-chain transaction to register a DiemID Domain +* In order to register a DiemID domain, a VASP needs to submit a request to Diem Association. After approval, Diem Association will use TreasuryCompliance account to issue an on-chain transaction to register a DiemID Domain. Diem Association will ensure uniqueness of all VASP domain names. ## DiemID Domain Events From aad116b51ecf042e2695e466ae557b2e00c57f0d Mon Sep 17 00:00:00 2001 From: SunMi Lee Date: Fri, 25 Jun 2021 02:09:52 -0700 Subject: [PATCH 3/4] nits --- dips/dip-182.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dips/dip-182.md b/dips/dip-182.md index fca5d2dd..2c8a7689 100644 --- a/dips/dip-182.md +++ b/dips/dip-182.md @@ -13,9 +13,9 @@ issue: https://github.com/diem/dip/issues/182 This DIP proposes adding VASP domain names on-chain and describes the domain name resolution process. -On-chain domain name resolution allows organizations to be able to define their product names, and for VASPs to look up other VASPs using the product names. -Having a human-readable VASP identifier gives the Diem community the ability enumerate all VASPs by their names, which is useful for merchant purposes as well as p2p transactions. -For example, given a VASP domain name in a payment transaction, VASPs can look up where to route the payment correctly using an approved and accurate mapping of VASP identifier to an on-chain address. +On-chain domain name resolution allows organizations to define their product names, and for VASPs to look up other VASPs using the product names. +Having a human-readable VASP identifier means we can enumerate all VASPs by their names, which is useful for merchant purposes as well as p2p transactions. +For example, given a VASP domain name in a payment transaction, VASPs can look up where to route the payment correctly using an approved mapping of VASP identifiers to on-chain addresses. # On-chain data @@ -23,7 +23,7 @@ For example, given a VASP domain name in a payment transaction, VASPs can look u A VASP domain name is a unique string that is mapped to a VASP. Specification: * Case insensitive * Valid regular expression: `^[a-zA-Z0-9][a-zA-Z0-9.]*$` -* Maximum length: 63 characters (64 including `@`) +* Maximum length: 63 characters ## DiemID Domain @@ -36,22 +36,22 @@ struct DiemIdDomain { } ``` * Field definitions: - * `domain` - name of a DiemID domain -* The `DiemIdDomains` resource can only be published into an account with `Role == PARENT_VASP_ROLE_ID`. -* The `DiemIdDomains` contains a list of `DiemIdDomain` structs that are associated with a VASP. As such, it is possible to register more than one DiemID Domain for a given VASP -* Only the special TreasuryCompliance account (address `0xB1E55ED`) can manipulate a DiemIdDomains resource: + * `domain` - name of a VASP domain +* The `DiemIdDomains` resource can only be published into an account with `Role == PARENT_VASP_ROLE_ID` +* The `DiemIdDomains` contains a list of `DiemIdDomain` structs that are associated with a VASP. It is possible to register more than one DiemIDDomain for a given VASP +* Only the Treasury Compliance (TC) account (address `0xB1E55ED`) can manipulate a DiemIdDomains resource: * Only TC account can create and publish a `DiemIdDomains` resource * Only TC account can add, remove or update a `DiemIdDomain` within `DiemIdDomains` resource * `DiemIDDomains` resource will be created in an empty state as part of creating a `ParentVASP` account resource, and existing `ParentVASP` accounts without `DiemIDDomains` will have the resource instantiated by the DiemRoot account -* In order to register a DiemID domain, a VASP needs to submit a request to Diem Association. After approval, Diem Association will use TreasuryCompliance account to issue an on-chain transaction to register a DiemID Domain. Diem Association will ensure uniqueness of all VASP domain names. +* In order to register a DiemID domain, a VASP needs to submit a request to Diem Association. After approval, Diem Association will use TC account to issue an on-chain transaction to register a DiemIDDomain. Diem Association will ensure uniqueness of domain names across all VASPs. ## DiemID Domain Events -The Move contract that manages DiemID domains must emit an event every time DiemID domain is created, removed or updated. Those events are critical for applications to be able to efficiently index existing DiemID domains. -An application can be built to listen for these events to construct a mapping of DiemID domains to VASP accounts for lookup of onchain addresses given a DiemID domain. -While DiemID domains are published into VASP account resource, DiemID domain events are published under the TreasuryCompliance account. We consolidate events under single account to allow indexers to follow a single event stream. +The Move contract that manages domains must emit an event every time DiemIDDomain is created, removed or updated. Those events are critical for applications to be able to efficiently index existing DiemIDDomains. +An application can be built to listen for these events to construct a mapping of domains to VASP accounts for lookup of onchain addresses given a DiemIDDomain. +While the domains are published into VASP account resources, domain events are published under the TC account. We consolidate events under a single account to allow indexers to follow a single event stream. -To store events, `DiemIdDomainManager` resource is published under the TreasuryCompliance account(address `0xB1E55ED`). +To store events, `DiemIdDomainManager` resource is published under the TC account. ``` resource struct DiemIdDomainManager { From a6ff72bdd95199f6a8c614302e520fc6f65338c2 Mon Sep 17 00:00:00 2001 From: SunMi Lee Date: Fri, 25 Jun 2021 02:22:07 -0700 Subject: [PATCH 4/4] Rename to remove diemID --- dips/dip-182.md | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/dips/dip-182.md b/dips/dip-182.md index 2c8a7689..29882123 100644 --- a/dips/dip-182.md +++ b/dips/dip-182.md @@ -25,47 +25,47 @@ A VASP domain name is a unique string that is mapped to a VASP. Specification: * Valid regular expression: `^[a-zA-Z0-9][a-zA-Z0-9.]*$` * Maximum length: 63 characters -## DiemID Domain +## VASP Domain ``` -resource struct DiemIdDomains { - domains: vector, +resource struct VaspDomains { + domains: vector, } -struct DiemIdDomain { +struct VaspDomain { domain: vector, // Utf-8 encoded } ``` * Field definitions: * `domain` - name of a VASP domain -* The `DiemIdDomains` resource can only be published into an account with `Role == PARENT_VASP_ROLE_ID` -* The `DiemIdDomains` contains a list of `DiemIdDomain` structs that are associated with a VASP. It is possible to register more than one DiemIDDomain for a given VASP -* Only the Treasury Compliance (TC) account (address `0xB1E55ED`) can manipulate a DiemIdDomains resource: - * Only TC account can create and publish a `DiemIdDomains` resource - * Only TC account can add, remove or update a `DiemIdDomain` within `DiemIdDomains` resource -* `DiemIDDomains` resource will be created in an empty state as part of creating a `ParentVASP` account resource, and existing `ParentVASP` accounts without `DiemIDDomains` will have the resource instantiated by the DiemRoot account -* In order to register a DiemID domain, a VASP needs to submit a request to Diem Association. After approval, Diem Association will use TC account to issue an on-chain transaction to register a DiemIDDomain. Diem Association will ensure uniqueness of domain names across all VASPs. +* The `VaspDomains` resource can only be published into an account with `Role == PARENT_VASP_ROLE_ID` +* The `VaspDomains` contains a list of `VaspDomain` structs that are associated with a VASP. It is possible to register more than one VaspDomain for a given VASP +* Only the Treasury Compliance (TC) account (address `0xB1E55ED`) can manipulate a `VaspDomains` resource: + * Only TC account can create and publish a `VaspDomains` resource + * Only TC account can add, remove or update a `VaspDomain` within `VaspDomains` resource +* `VaspDomains` resource will be created in an empty state as part of creating a `ParentVASP` account resource, and existing `ParentVASP` accounts without `VaspDomains` will have the resource instantiated by the DiemRoot account +* In order to register a VASP domain, a VASP needs to submit a request to Diem Association. After approval, Diem Association will use TC account to issue an on-chain transaction to register a VaspDomain. Diem Association will ensure uniqueness of domain names across all VASPs. -## DiemID Domain Events +## VASP Domain Events -The Move contract that manages domains must emit an event every time DiemIDDomain is created, removed or updated. Those events are critical for applications to be able to efficiently index existing DiemIDDomains. -An application can be built to listen for these events to construct a mapping of domains to VASP accounts for lookup of onchain addresses given a DiemIDDomain. +The Move contract that manages domains must emit an event every time VaspDomain is created, removed or updated. Those events are critical for applications to be able to efficiently index existing VaspDomains. +An application can be built to listen for these events to construct a mapping of domains to VASP accounts for lookup of onchain addresses given a VaspDomain. While the domains are published into VASP account resources, domain events are published under the TC account. We consolidate events under a single account to allow indexers to follow a single event stream. -To store events, `DiemIdDomainManager` resource is published under the TC account. +To store events, `VaspDomainManager` resource is published under the TC account. ``` -resource struct DiemIdDomainManager { +resource struct VaspDomainManager { /// Events are emmitted - diem_id_domain_events: Event::EventHandle, + vasp_domain_events: Event::EventHandle, } -struct DiemIdDomainEvent { +struct VaspDomainEvent { removed: bool, - domain: DiemIdDomain, + domain: VaspDomain, address: address, } ``` * Fields definition: - * `removed` - `true`, if DiemIdDomain was removed, `false` if it was created or updated - * `domain` - exact copy of `DiemIdDomain` that was added/removed from `DiemIdDomains` resource of a VASP account - * `address` - address of an account where `DiemIdDomain` was added or removed + * `removed` - `true`, if VaspDomain was removed, `false` if it was created or updated + * `domain` - exact copy of `VaspDomain` that was added/removed from `VaspDomains` resource of a VASP account + * `address` - address of a VASP account where `VaspDomain` was added or removed