diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 00000000..8a51c3c8 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_PATH: "localgemstore" diff --git a/.gitignore b/.gitignore index f40fbd8b..d3c21e20 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ _site .sass-cache .jekyll-cache .jekyll-metadata -vendor +localgemstore diff --git a/CAIPs/caip-1.md b/CAIPs/caip-1.md index 256f4b55..9a284ada 100644 --- a/CAIPs/caip-1.md +++ b/CAIPs/caip-1.md @@ -5,7 +5,7 @@ status: Review type: Meta author: ligi created: 2019-08-31 -updated: 2019-08-31 +updated: 2024-04-15 --- ## What is an CAIP? @@ -33,7 +33,7 @@ Each CAIP must begin with an [RFC 822](https://www.ietf.org/rfc/rfc822.txt) styl ` * discussions-to:` \ -` status:` +` status:` `* review-period-end:` @@ -95,9 +95,13 @@ The `updated` header records the date(s) when the CAIP was updated with "substan CAIPs may have a `requires` header, indicating the CAIP(s) on which this CAIP depends. Note that if the CAIP requires multiple others, the value should be an array of integers (no `"` needed) and/or URLs (wrapped in `"`s) within square brackets (`[]`). -#### `superseded-by` and `replaces` headers +#### `status` header -CAIPs may also have a `superseded-by` header indicating that a CAIP has been rendered obsolete by a later document; the value is the number of the CAIP that replaces the current document. The newer CAIP must have a `replaces` header containing the number of the CAIP that it rendered obsolete. +The status header refers to the editorial lifecycle, as attested by the author(s) of a given proposal. + +`Review` and `Last Call` (an optional subset of `Review` expressing urgency to reviewers) should used in combination with the optional parameter `review-period-end` to express the review deadline to which the author is commits themself. + +`Superseded` is a variant of `Withdrawn` which redirects readers to another proposal; here as well, the optional parameters `superseded-by` (on the superseded proposal) and `replaces` (on the superseding proposal) help link these proposals. `Final` proposals cannot be changed to `Withdrawn` or `Superseded`. ## Auxiliary Files @@ -129,9 +133,9 @@ Once the CAIP is ready for the repository, the CAIP editor will: - Merge the corresponding pull request -- Send a message back to the CAIP author with the next step. +- Leave a comment making explicit to the CAIP author(s) what the next steps are. -The editors don't pass judgment on CAIPs. We merely do the administrative & editorial part. +The editors don't pass judgment on CAIPs. We merely do the administrative & editorial part. Substantive and normative judgments should be made by author(s) whenever possible. ## History diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a0f8a285..5e5dcc65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,8 +5,8 @@ 3. Add your CAIP to your fork of the repository. There is a [template CAIP here](caip-template.md). 4. Submit a Pull Request to Chain Agnostics's [CAIPs repository](https://github.com/ChainAgnostic/CAIPs). -Your first PR should be a first draft of the complete and implementable CAIP. -An editor will manually review the first PR for a new CAIP and assign it a number before merging it. +Your first Pull Request (hereafter "PR") should be a first draft of the complete and implementable CAIP; the CAIP number will be taken from the PR that creates it, unless a different number is requested or assigned by an editor. +An editor will manually review the first PR and, if necessary, [re-]assign a number before merging it. Make sure you include a `discussions-to` header with the URL of an issue or discussion on this repository, or any other forum where you would welcome discussion. If your CAIP requires images, the image files should be included in a subdirectory of the `assets` folder for that CAIP as follows: `assets/caip-N` (where **N** is to be replaced with the CAIP number). @@ -14,6 +14,15 @@ When linking to an image in the CAIP, use relative links such as `../assets/caip It is recommended that you render your PR locally to check the Jekyll syntax; to do so, run `bundle exec jekyll serve`. +## Status Lifecycle (see CAIP-1) + +We recommend all specifications be published in "Draft" status initially. +We recommend not changing the status to "Review" until there is at least 1 reviewable implementation and other potential implementers are evaluating or considering implementing. +Editors reserve the right to mark a "Draft" as "Stale" after significant periods of inactivity, or authors can mark them as such themselves. +We recommend moving from "Review" to "Final" only when interoperability and further adoption is hindered by the risk of breakage. + +Note: When opening a PR to "Final" status that a second, identical copy of the file and any assets or attachments should be placed in the "/final" folder to render a second copy at the `/final` path (this allows "Final"-status CAIPs to be marked as such at archival URLs). + ## Style Guide Github-flavored Markdown is encouraged for all CAIP documents, with the following conventions observed: diff --git a/Gemfile.lock b/Gemfile.lock index 987b2795..b455223d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,18 +1,18 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.8.1) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) colorator (1.1.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.3) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) eventmachine (1.2.7) - ffi (1.15.5) + ffi (1.16.3) forwardable-extended (2.6.0) http_parser.rb (0.8.0) - i18n (1.12.0) + i18n (1.14.4) concurrent-ruby (~> 1.0) jekyll (4.2.2) addressable (~> 2.4) @@ -29,7 +29,7 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 2.0) - jekyll-feed (0.16.0) + jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) jekyll-sass-converter (2.2.0) sassc (> 2.0.1, < 3.0) @@ -41,8 +41,8 @@ GEM rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - liquid (4.0.3) - listen (3.7.1) + liquid (4.0.4) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) @@ -52,11 +52,11 @@ GEM jekyll-seo-tag (~> 2.1) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (5.0.0) + public_suffix (5.0.4) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rexml (3.2.5) + rexml (3.2.6) rouge (3.30.0) safe_yaml (1.0.5) sassc (2.4.0) @@ -67,6 +67,7 @@ GEM webrick (1.8.1) PLATFORMS + ruby x86_64-linux DEPENDENCIES @@ -80,4 +81,4 @@ DEPENDENCIES webrick (~> 1.8) BUNDLED WITH - 2.3.24 + 2.5.6 diff --git a/_config.yml b/_config.yml index 060b97cb..f5504d09 100644 --- a/_config.yml +++ b/_config.yml @@ -21,7 +21,7 @@ title: Chain Agnostic Improvement Proposals description: >- # this means to ignore newlines until "baseurl:" Chain Agnostic Improvement Proposals (CAIPs) describe standards for blockchain projects that are not specific to a single chain. -url: "" # the base hostname & protocol for your site, e.g. http://example.com +baseurl: "" # the base hostname & protocol for your site, e.g. http://example.com github_username: ChainAgnostic repository: ChainAgnostic/CAIPs @@ -35,13 +35,18 @@ markdown: kramdown plugins: - jekyll-feed -permalink: /:slug +permalink: /:path defaults: - scope: path: "CAIPs" values: layout: "caip" + - scope: + path: "final" + values: + layout: "caip-final" exclude: - caip-template.md + diff --git a/_includes/caiptable.html b/_includes/caiptable.html index 4ba81a26..c4ef447f 100644 --- a/_includes/caiptable.html +++ b/_includes/caiptable.html @@ -22,14 +22,16 @@

{{status}}

{% endif %} {% for page in caips %} - -
{{page.caip|xml_escape}} - {% if status == "Last Call" and page.last-call-deadline != undefined %} - {{ page.last-call-deadline | xml_escape }} - {% endif %} - {{page.title|xml_escape}} - {% include authorlist.html authors=page.author %} - + {% unless page.path contains "final" %} + + {{page.caip|xml_escape}} + {% if status == "Last Call" and page.last-call-deadline != undefined %} + {{ page.last-call-deadline | xml_escape }} + {% endif %} + {{page.title|xml_escape}} + {% include authorlist.html authors=page.author %} + + {% endunless %} {% endfor %} {% endif %} diff --git a/_layouts/caip-final.html b/_layouts/caip-final.html new file mode 100644 index 00000000..98860e4f --- /dev/null +++ b/_layouts/caip-final.html @@ -0,0 +1,116 @@ +--- +layout: default +--- + +
+

+ CAIP-{{ page.caip | xml_escape }}: {{ page.title | xml_escape }} + +

+

{{ page.description | xml_escape }}

+ + + + + + {% if page["discussions-to"] != undefined %} + + + + + {% endif %} + + + + + + + + + {% endif %} + + + + + + + {% if page.category != undefined %} + + + + + {% endif %} + + + + + {% if page.updated != undefined %} + + + + + {% endif %} + {% if page.requires != undefined %} + + + + + {% endif %} + {% if page.superseded-by != undefined %} + + + + + {% endif %} + {% if page["withdrawal-reason"] != undefined %} + + + + + {% endif %} +
Author{% include authorlist.html authors=page.author %}
Discussions-To{% include discussion_links.html links=page.discussions-to %}
Status + {{ page.status | xml_escape }} + {% if page.last-call-deadline != undefined %} +
Last Call Deadline{{ page.last-call-deadline | xml_escape }}
Type{{ page.type | xml_escape }}
Category{{ page.category | xml_escape }}
Created{{ page.created | xml_escape }}
Updated{{ page.updated | xml_escape }}
Requires{% include caipnums.html caips=page.requires %}
Superseded By{% include superseded_by.html caips=page.superseded-by %}
Withdrawal reason{{ page["withdrawal-reason"] | xml_escape }}
+ +
+

Table of Contents

+ {% include toc.html html=content sanitize=true h_max=3 %} +
+ + {% include anchor_headings.html html=content anchorClass="anchor-link" beforeHeading=true %} + +

Citation

+

Please cite this document as:

+ {% comment %} + IEEE specification for reference formatting: + https://ieee-dataport.org/sites/default/files/analysis/27/IEEE%20Citation%20Guidelines.pdf + {% endcomment %} +

{% include authorlist.html authors=page.author %}, "CAIP-{{ page.caip | xml_escape }}: {{ page.title | xml_escape + }}{% if page.status == "Draft" or page.status == "Last Call" or page.status == "Abandoned" %} [DRAFT]{% endif %}," Chain Agnostic Improvement Proposals, no. {{ + page.caip | xml_escape }}, {{ page.created | date: "%B %Y" }}. [Online serial]. Available: + https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-{{ page.caip | xml_escape }}.md

+
+{% comment %} +Article schema specification: +https://schema.org/TechArticle +{% endcomment %} + \ No newline at end of file diff --git a/_layouts/caip.html b/_layouts/caip.html index 5d520b41..46abf190 100644 --- a/_layouts/caip.html +++ b/_layouts/caip.html @@ -23,8 +23,15 @@

{{ page.description | xml_escape }}

{% endif %} Status - {{ page.status | xml_escape }} + + {% if page.status contains "Final" %} + Final + {% else %} + {{ page.status | xml_escape }} + {% endif %} {% if page.last-call-deadline != undefined %} + + Last Call Deadline {{ page.last-call-deadline | xml_escape }} diff --git a/final/caip-10.md b/final/caip-10.md new file mode 100644 index 00000000..8ad183b9 --- /dev/null +++ b/final/caip-10.md @@ -0,0 +1,151 @@ +--- +caip: 10 +title: Account ID Specification +author: Pedro Gomes (@pedrouid) +discussions-to: https://github.com/ChainAgnostic/CAIPs/pull/10 +status: Final +type: Standard +created: 2020-03-13 +updated: 2022-10-23 +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][] chain id specification. This is useful for both +decentralized applications and wallets to communicate user accounts (EOA in EVM +terminology) or smart contracts/abstraction 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 a colon sign (`:`) + +### Syntax + +The `account_id` is a case-sensitive string in the form + +``` +account_id: chain_id + ":" + account_address +chain_id: [-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32} (See [CAIP-2][]) +account_address: [-.%a-zA-Z0-9]{1,128} +``` + +Note that `-`, `%` and `.` characters are allowed, but no other +non-alphanumerics such as `:`, `/` or `\`. Implementers are recommended to use +"URL encoding" (% + 2-character codes, canonically capitalized) as per [Section +2][rfc3986sec2.1] of [RFC 3986][rfc3986] to escape any further non-alphanumeric +characters, and to consider [homograph attack surfaces][homograph] in the handling +of any non-alphanumerics. + +### Semantics + +The `chain_id` is specified by the [CAIP-2][] 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 the prefix of a chainId to quickly identify before parsing the address +- Restricted to constrained set of characters and length for parsing + +## Canonicalization + +Note that some namespaces like the EVM offer canonicalization schemes that use +capitalization (e.g. [EIP-55][]), an option suffix (e.g. [HIP-15][]), or some +other transformation. At the present time, this specification does NOT require +canonicalization, and implementers are advised to consider deduplication or +canonicalization in their consumption of CAIP-addresses. CAIP-10 profiles in +CASA [namespaces][] may contain additional information per namespace. + +## Test Cases + +This is a list of manually composed examples + +``` +# Ethereum mainnet (canonicalized with [EIP-55][] checksum) +eip155:1:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb + +# Bitcoin mainnet +bip122:000000000019d6689c085ae165831e93:128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6 + +# Cosmos Hub +cosmos:cosmoshub-3:cosmos1t2uflqwqe0fsj0shcfkrvpukewcw40yjj6hdc0 + +# Kusama network +polkadot:b0a8d493285c2df73290dfb7e61f870f:5hmuyxw9xdgbpptgypokw4thfyoe3ryenebr381z9iaegmfy + +# StarkNet Testnet +starknet:SN_GOERLI:0x02dd1b492765c064eac4039e3841aa5f382773b598097a40073bd8b48170ab57 + +# Dummy max length (64+1+8+1+32 = 106 chars/bytes) +chainstd:8c3444cf8970a9e41a706fab93e7a6c4:6d9b0b4b9994e8a6afbd3dc3ed983cd51c755afb27cd1dc7825ef59c134a39f7 + +# Hedera address (with optional checksum suffix per [HIP-15][]) +hedera:mainnet:0.0.1234567890-zbhlt + +``` + +## Backwards Compatibility + +Previously, the character set was much more restrictive for CAIP-10s, allowing +no non-alphanumeric characters. See [pre-2022-10-23 +version](https://github.com/ChainAgnostic/CAIPs/blob/8fdb5bfd1bdf15c9daf8aacfbcc423533764dfe9/CAIPs/caip-10.md) +of specification for details. + +Before that, legacy CAIP-10 schema was defined by appending as suffix the CAIP-2 +chainId delimited by the at sign (`@`). See [pre-2021-08-21 +version](https://github.com/ChainAgnostic/CAIPs/blob/0697e26601d30d8e99df17954ed3e5a1fd59e049/CAIPs/caip-10.md) +of specification for details. + +``` +# Legacy example pre-2021-08-21 +0xab16a96d359ec26a11e2c2b3d8f8b8942d5bfcdb@eip155:1 +``` + +## Changelog + +- 2022-10-23: expanded charset to include `-`,`.`, and `%`; also added + canonicalization section and links +- 2022-03-10: update RegEx to incorporate CAIP-2 reference +- 2021-08-11: switch from `{account id}@{chain id}` to `{chain id}:{account id}` + syntax + +## Links + +- [IETF RFC 3986][rfc3986] - the IETF standard for URL, URI and URN syntax +- [CAIP-2][] - CASA Chain ID specification +- [EIP-55][] - Ethereum Improvement Proposal for canonicalizing ethereum addresses to by deterministic capitalization of a-f characters +- [HIP-15][] - Hedera Improvement Proposal defining a checksum suffix for addresses + +[namespaces]: https://namespaces.chainagnostic.org/ +[EIP-55]: https://eips.ethereum.org/EIPS/eip-55 +[HIP-15]: https://github.com/hashgraph/hedera-improvement-proposal/blob/main/HIP/hip-15.md +[CAIP-2]: https://ChainAgnostic.org/CAIPs/caip-2 +[rfc3986]: https://www.rfc-editor.org/rfc/rfc3986 +[rfc3986sec2.1]: https://www.rfc-editor.org/rfc/rfc3986#section-2.1 +[homograph]: https://en.wikipedia.org/wiki/IDN_homograph_attack + +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE). diff --git a/final/caip-2.md b/final/caip-2.md new file mode 100644 index 00000000..65f0e804 --- /dev/null +++ b/final/caip-2.md @@ -0,0 +1,111 @@ +--- +caip: 2 +title: Blockchain ID Specification +author: Simon Warta (@webmaster128), ligi , Pedro Gomes (@pedrouid), Antoine Herzog (@antoineherzog) +discussions-to: https://github.com/ChainAgnostic/CAIPs/pull/1, https://github.com/UCRegistry/registry/pull/13, https://ethereum-magicians.org/t/caip-2-blockchain-references/3612, +status: Final +type: Standard +created: 2019-12-05 +updated: 2021-08-25 +--- + +## Simple Summary + +CAIP-2 defines a way to identify a blockchain (e.g. Ethereum Mainnet, Görli, Bitcoin, Cosmos Hub) in a human-readable, developer-friendly and transaction-friendly way. + +## Abstract + +Often you need to reference a blockchain, for example when you want to state where some asset or smart contract is located. In Ethereum the [EIP155](https://eips.ethereum.org/EIPS/eip-155) chain ID is used most of the time. But with an Ethereum chain ID you cannot reference e.g. a Bitcoin or Cosmos chain. + +## Motivation + +The final trigger to create this CAIP (and the CAIP process itself) was a discussion around [EIP2256] at [Ethereum-Magicians](https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedtokens-json-rpc-method/3600/14). +Independently, the [Universal Chain Registry](https://github.com/UCRegistry) was created that needs properly specified chain identifiers at its core. A [discussion about the network ID format](https://github.com/UCRegistry/registry/pull/13) brought this group together with ChainAgnostic. + +## Specification + +The blockchain ID (short "chain ID") is a string designed to uniquely identify blockchains in a developer-friendly fashion. + +### Syntax + +The `chain_id` is a case-sensitive string in the form + +``` +chain_id: namespace + ":" + reference +namespace: [-a-z0-9]{3,8} +reference: [-_a-zA-Z0-9]{1,32} +``` + +### Semantics + +Each `namespace` covers a class of similar blockchains. Usually it describes an ecosystem or standard, such as e.g. `cosmos` or `eip155`. +One namespace should refer to one resolution method to resolve the chain's reference. A `reference` is a way to identify a blockchain within a given namespace. +The semantics as well as the more granular syntax which are delegated to each namespace specification shall be defined in separate CAIPs describing resolution methods. + +## Rationale + +The goals of the general chain ID format is: + +- Uniqueness within the entire blockchain ecosystem +- To some degree human-readable and helps for basic debugging +- Restricted in a way that it can be stored on chain +- Character set basic enough to display in hardware wallets as part of a transaction content + +The following secondary goals can easily be achieved: + +- Can be used unescaped in URL paths +- Can be used as filename in a case-sensitive UNIX file system (Linux/git). + +These secondary goals have been given up along the way: + +- Can be used as filename in a case-insensitive UNIX file system (macOS). +- Can be used as filename in a Windows file system. + +## Test Cases + +This is a list of manually composed examples + +``` +# Ethereum mainnet +eip155:1 + +# Bitcoin mainnet (see https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki#definition-of-chain-id) +bip122:000000000019d6689c085ae165831e93 + +# Litecoin +bip122:12a765e31ffd4059bada1e25190f6e98 + +# Feathercoin (Litecoin fork) +bip122:fdbe99b90c90bae7505796461471d89a + +# Cosmos Hub (Tendermint + Cosmos SDK) +cosmos:cosmoshub-2 +cosmos:cosmoshub-3 + +# Binance chain (Tendermint + Cosmos SDK; see https://dataseed5.defibit.io/genesis) +cosmos:Binance-Chain-Tigris + +# IOV Mainnet (Tendermint + weave) +cosmos:iov-mainnet + +# StarkNet Testnet +starknet:SN_GOERLI + +# Lisk Mainnet (LIP-0009; see https://github.com/LiskHQ/lips/blob/master/proposals/lip-0009.md) +lip9:9ee11e9df416b18b + +# Dummy max length (8+1+32 = 41 chars/bytes) +chainstd:8c3444cf8970a9e41a706fab93e7a6c4 +``` + +## Links + +- [EIP155](https://eips.ethereum.org/EIPS/eip-155) +- [BIP122](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki) +- [EIP2256](https://eips.ethereum.org/EIPS/eip-2256) +- [LIP9](https://github.com/LiskHQ/lips/blob/master/proposals/lip-0009.md) +- [Cosmos chain ID best practice](https://github.com/cosmos/cosmos-sdk/issues/5363) + +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE).