From 2140eb6c79fbdaff3f23748f416dd947c4fe804b Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Fri, 13 Mar 2020 15:37:15 +0000 Subject: [PATCH 1/4] Create caip-7.md --- CAIPs/caip-7.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 CAIPs/caip-7.md diff --git a/CAIPs/caip-7.md b/CAIPs/caip-7.md new file mode 100644 index 00000000..cb5458a1 --- /dev/null +++ b/CAIPs/caip-7.md @@ -0,0 +1,75 @@ +--- +caip: 10 +title: Account ID Specification +author: Pedro Gomes (@pedrouid) +discussions-to: https://github.com/ChainAgnostic/CAIPs/pull/10 +status: Draft +type: Standard +created: 2020-03-13 +updated: 2020-03-13 +requires: 2 +--- + +## Simple Summary + +CAIP-10 defines a way to identify an account in any blockchain specified by CAIP-2 blockchain id. + +## Abstract + +This proposal aims to facilitate specifying accounts for any blockchain extending CAIP-2 blockchain id specification. This is useful for both decentralized applications and wallets to communicate user accounts for multiple chains using string identifiers specific to each chain. Currently wallets are usually designed for each chain and multi-chain wallets use proprietray data structures to differentiate accounts. This proposal aims to standardize these identifiers for accounts to allow interoperability. + +## Motivation + +The motivation for proposal stem from designing a chain-agnostic protocol for communication between dapps and wallets that was independent of any blockchain but provide the flexibility to be backwards compatible with existing applications. + +## Specification + +The account id specification will be prefixed with the CAIP-2 blockchain ID and delimited with an at sign (`@`) commonly used to define addresses. + +### Syntax + +The `account_id` is a case-sensitive string in the form + +``` +account_id: chain_id + "@" + account_address +chain_id: [:-a-zA-Z0-9]{5,64} +account_address: [a-zA-Z0-9]{1,63} +``` + +### Semantics + +The `chain_id` is specified by the [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) which describes the blockchain id. +The `account_address` is a case sensitive string which its format is specific to the blockchain that is referred to by the `chain_id` + +## Rationale + +The goals of the general account ID format is: + - Uniqueness between chains regardless if they are mainnet or testnet + - Readibility using `@` to easily identify the account address + - Restricted to constrained set of characters and length for parsing + +## Test Cases + +This is a list of manually composed examples + +``` +# Ethereum mainnet +eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb + +# Bitcoin mainnet +bip122:000000000019d6689c085ae165831e93@128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6 + +# Cosmos Hub (Tendermint + Cosmos SDK) +cosmos:cosmoshub-3@cosmos1t2uflqwqe0fsj0shcfkrvpukewcw40yjj6hdc0 + +# Dummy max length (16+1+47 = 64 chars/bytes) +max-namespace-16:xip3343-8c3444cf8970a9e41a706fab93e7a6c4-xxxyyy@bd57219062044ed77c7e5b865339a6d727309c548763141f11e26e9242bbd34 +``` + +## Links + +n/a + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From be0b1dc18c4b8b2e8ac5399b6104db6a99476b5e Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Fri, 13 Mar 2020 15:45:56 +0000 Subject: [PATCH 2/4] Rename caip-7.md to caip-10.md --- CAIPs/{caip-7.md => caip-10.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CAIPs/{caip-7.md => caip-10.md} (100%) diff --git a/CAIPs/caip-7.md b/CAIPs/caip-10.md similarity index 100% rename from CAIPs/caip-7.md rename to CAIPs/caip-10.md From f487a94022bb01faa1cd00ef9f63c895626a1a90 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Fri, 13 Mar 2020 15:46:10 +0000 Subject: [PATCH 3/4] Update caip-10.md --- CAIPs/caip-10.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CAIPs/caip-10.md b/CAIPs/caip-10.md index cb5458a1..8ec68e28 100644 --- a/CAIPs/caip-10.md +++ b/CAIPs/caip-10.md @@ -54,7 +54,7 @@ This is a list of manually composed examples ``` # Ethereum mainnet -eip155:1:0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb +eip155:1@0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb # Bitcoin mainnet bip122:000000000019d6689c085ae165831e93@128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6 From 551b82dbe28f7b2a8899642c686608ed550b6a40 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 18 Mar 2020 12:59:56 +0100 Subject: [PATCH 4/4] reverse caip-10 syntax order --- CAIPs/caip-10.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CAIPs/caip-10.md b/CAIPs/caip-10.md index 8ec68e28..d159525e 100644 --- a/CAIPs/caip-10.md +++ b/CAIPs/caip-10.md @@ -6,7 +6,7 @@ discussions-to: https://github.com/ChainAgnostic/CAIPs/pull/10 status: Draft type: Standard created: 2020-03-13 -updated: 2020-03-13 +updated: 2020-03-18 requires: 2 --- @@ -31,15 +31,15 @@ The account id specification will be prefixed with the CAIP-2 blockchain ID and The `account_id` is a case-sensitive string in the form ``` -account_id: chain_id + "@" + account_address -chain_id: [:-a-zA-Z0-9]{5,64} +account_id: account_address + "@" + chain_id account_address: [a-zA-Z0-9]{1,63} +chain_id: [:-a-zA-Z0-9]{5,64} ``` ### Semantics -The `chain_id` is specified by the [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) which describes the blockchain id. The `account_address` is a case sensitive string which its format is specific to the blockchain that is referred to by the `chain_id` +The `chain_id` is specified by the [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) which describes the blockchain id. ## Rationale @@ -54,16 +54,16 @@ This is a list of manually composed examples ``` # Ethereum mainnet -eip155:1@0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb +0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb@eip155:1 # Bitcoin mainnet -bip122:000000000019d6689c085ae165831e93@128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6 +128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6@bip122:000000000019d6689c085ae165831e93 # Cosmos Hub (Tendermint + Cosmos SDK) -cosmos:cosmoshub-3@cosmos1t2uflqwqe0fsj0shcfkrvpukewcw40yjj6hdc0 +cosmos1t2uflqwqe0fsj0shcfkrvpukewcw40yjj6hdc0@cosmos:cosmoshub-3 # Dummy max length (16+1+47 = 64 chars/bytes) -max-namespace-16:xip3343-8c3444cf8970a9e41a706fab93e7a6c4-xxxyyy@bd57219062044ed77c7e5b865339a6d727309c548763141f11e26e9242bbd34 +bd57219062044ed77c7e5b865339a6d727309c548763141f11e26e9242bbd34@max-namespace-16:xip3343-8c3444cf8970a9e41a706fab93e7a6c4-xxxyyy ``` ## Links