Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LAST CALL - READY to add eip155 #2

Merged
merged 12 commits into from
Apr 1, 2022
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ If your CAN requires images, the image files should be included in a subdirector

# CAN Index

- [`eip155`](eip155.md) - Draft
40 changes: 40 additions & 0 deletions eip155/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
namespace-identifier: eip155
title: EIP155 Namespace, aka EVM Chains
---

# Namespace for EIP155 chains

This document describes the syntax and structure of the [EIP155][] namespace,
commonly referred to as the "EVM" namespace for chains using the Ethereum
Virtual Machine.

## Introduction

[EIP155][] is an Ethereum Improvement Process specifying addressing across
Ethereum-based chains, generalized by [CAIP-2][]. Definition of valid
`references` within that namespace and constraints are deferred to the
[EIP155][] specification, which may be superseded by future EIPs.

## References

- [EIP155][]: Ethereum Improvement Proposal specifying generation and validation of ChainIDs
- [ethereum-lists/chains][]: An open registry for eip155 network operators to claim a
unique chainID and self-publish RPC/node information for them.
- [ERC20][]: Basic [aka Fungible] Token Standard
- [ERC721][]: Non-Fungible Token Standard

[Chainid.network]: https://github.com/ethereum-lists/chains
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md
[CAIP-19]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-19.md
[CAIP-21]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-21.md
[CAIP-22]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-22.md
[EIP155]: https://eips.ethereum.org/EIPS/eip-155
[ERC20]: https://eips.ethereum.org/EIPS/eip-20
[ERC721]: https://eips.ethereum.org/EIPS/eip-721


## Rights

Copyright and related rights waived via CC0.
80 changes: 80 additions & 0 deletions eip155/caip10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
namespace-identifier: eip155-caip10
title: EIP155 Namespace, aka EVM Chains - Addresses
author: Simon Warta (@webmaster128), ligi <ligi@ligi.de>, Pedro Gomes (@pedrouid), Antoine Herzog (@antoineherzog), Pedro Gomes (@pedrouid), Joel Thorstensson (@oed)
discussions-to: https://github.com/ChainAgnostic/namespaces/pulls/2
status: Draft
type: Standard
created: 2022-01-19
updated: 2022-01-19
requires: CAIP-2, CAIP-10
supersedes: CAIP-3
---

# CAIP-10

*For context, see the [CAIP-10][] specification.*

## Rationale

While Ethereum "accounts" were the unstated norm in the definition of
[CAIP-10][], there are still some particularities of the syntax that should be
specified for the unfamiliar.

## Syntax

Ethereum addresses were, historically, case-insensitive and normalized to use
all-lowercase letters (`abcdef`) like most hexadecimal numeric types. With the
ratification of [EIP55][], however, a particular normalization of lowercase- and
uppercase- `abcdefABCDEF` characters was invented as an efficient form of
checksum. See [EIP55][] for specification.

### Backwards Compatibility

An earlier version of the CAIP-10 schema was defined by appending as suffix the
CAIP-2 chainId delimited by the at sign (@), i.e.
`0x22227A31dd842196A246d8f3b775998560eAa61d@eip155:1` in the above example. This
was changed [Aug 11,
2021](https://github.com/ChainAgnostic/CAIPs/commit/0697e26601d30d8e99df17954ed3
e5a1fd59e049) and some systems built against the earlier drafts may present
accounts in this manner.

## Test Cases

```
# Ethereum mainnet (valid/checksummed)
eip155:1:0x22227A31dd842196A246d8f3b775998560eAa61d

# Ethereum mainnet (will not validate in EIP155-conformant systems)
eip155:1:0x22227a31dd842196a246d8f3b775998560eaa61d

# Polygon mainnet (valid/checksummed)
eip155:137:0x0495766cD136138Fc492Dd499B8DC87A92D6685b

# Polygon mainnet (will not validate in EIP155-conformant systems)
eip155:137:0x0495766CD136138FC492DD499B8DC87A92D6685B

```

## References

- [EIP155][]: Ethereum Improvement Proposal specifying generation and validation of ChainIDs
- [ethereum-lists/chains][]: An open registry for eip155 network operators to claim a
unique chainID and self-publish RPC/node information for them.
- [ERC20][]: Basic [aka Fungible] Token Standard
- [ERC721][]: Non-Fungible Token Standard

[Chainid.network]: https://github.com/ethereum-lists/chains
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md
[CAIP-19]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-19.md
[CAIP-21]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-21.md
[CAIP-22]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-22.md
[EIP155]: https://eips.ethereum.org/EIPS/eip-155
[ERC20]: https://eips.ethereum.org/EIPS/eip-20
[ERC721]: https://eips.ethereum.org/EIPS/eip-721


## Rights

Copyright and related rights waived via CC0.
76 changes: 76 additions & 0 deletions eip155/caip19.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
namespace-identifier: eip155-caip19
title: EIP155 Namespace, aka EVM Chains - Assets
author: Simon Warta (@webmaster128), ligi <ligi@ligi.de>, Pedro Gomes (@pedrouid), Antoine Herzog (@antoineherzog), Pedro Gomes (@pedrouid), Joel Thorstensson (@oed)
discussions-to: https://github.com/ChainAgnostic/namespaces/pulls/2
status: Draft
type: Standard
created: 2022-01-19
updated: 2022-01-19
requires: CAIP-2, CAIP-10, CAIP-19
supersedes: CAIP-21, CAIP-22
---

# CAIP-19

*For context, see the [CAIP-19][] specification.*

## Rationale

In the Ethereum space, most assets are either a unique on-chain token referenced
by its address, often called a "native token" ([erc20][] tokens being the most
common), or a uniquely-identifiable token within a registry governed by a
contract at a given address ([erc721][] being the most common), often called an
"NFT". An unambiguous and unique representation is easily achieved by using on-
chain address prefixed by CAIP-2 information.

## Syntax

After the CAIP-2 namespace+chainID, a slash defines an `asset_namespace` and an `asset_reference`.
- In the case of ERC20 tokens, the namespace is `erc20` and the address of the
smart contract is the reference.
- In the case of ERC721 tokens, the namespace is `erc721` and the address of the
smart contract is the reference, with an optional additional identifier for
the specific token separated from the reference by a "/"

## Examples

```
# DAI Token
eip155:1/erc20:0x6b175474e89094c44da98b954eedeac495271d0f

# REQ Token
eip155:1/erc20:0x8f8221afbb33998d8584a2b05749ba73c37a938a

# CryptoKitties Collectible
eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d

# CryptoKitties Collectible ID
eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769

# CryptoCoven.xyz Collectible ID
eip155:1/erc721:0x5180db8f5c931aae63c74266b211f580155ecac8/4663
```

## References

- [EIP155][]: Ethereum Improvement Proposal specifying generation and validation of ChainIDs
- [ethereum-lists/chains][]: An open registry for eip155 network operators to claim a
unique chainID and self-publish RPC/node information for them.
- [ERC20][]: Basic [aka Fungible] Token Standard
- [ERC721][]: Non-Fungible Token Standard

[Chainid.network]: https://github.com/ethereum-lists/chains
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md
[CAIP-19]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-19.md
[CAIP-21]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-21.md
[CAIP-22]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-22.md
[EIP155]: https://eips.ethereum.org/EIPS/eip-155
[ERC20]: https://eips.ethereum.org/EIPS/eip-20
[ERC721]: https://eips.ethereum.org/EIPS/eip-721


## Rights

Copyright and related rights waived via CC0.
94 changes: 94 additions & 0 deletions eip155/caip2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
namespace-identifier: eip155-caip2
title: EIP155 Namespace, aka EVM Chains - Chains
author: Simon Warta (@webmaster128), ligi <ligi@ligi.de>, Pedro Gomes (@pedrouid), Antoine Herzog (@antoineherzog), Pedro Gomes (@pedrouid), Joel Thorstensson (@oed)
discussions-to: https://github.com/ChainAgnostic/namespaces/pulls/2
status: Draft
type: Standard
created: 2022-01-19
updated: 2022-01-19
requires: CAIP-2
supersedes: CAIP-3
---

# CAIP-2

*For context, see the [CAIP-2][] specification.*

## Rationale

The chain ID defined in EIP155 is the most widely used chain identifier in the
Ethereum ecosystem known to the authors. It optimizes for uniqueness and its
usage for replay protection has helped it achieve wide adoption. Unique network
IDs can be self-registered in the [ethereum-lists/chains][] registry.

## Syntax

For reference, The format of reference currently specified in EIP155 is an
unsigned integer in decimal representation. Due to length restrictions of the
reference field (32 characters), the largest supported `CHAIN_ID` at time of
writing is `99999999999999999999999999999999`.


### Resolution Method

To resolve a blockchain reference for the EIP155 namespace, make a JSON-RPC
request to a blockchain node with method `eth_chainId`, for example:

```
// Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": []
}

// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x1"
}
```

The response will return a base-16-encoded integer that should be converted to
base 10 to format an EIP155-compatible blockchain reference.

## Test Cases

This is a list of manually composed examples

```
# Ethereum mainnet
eip155:1

# Görli
eip155:5

# Auxilium Network Mainnet
eip155:28945486
```

## References

- [EIP155][]: Ethereum Improvement Proposal specifying generation and validation of ChainIDs
- [ethereum-lists/chains][]: An open registry for eip155 network operators to claim a
unique chainID and self-publish RPC/node information for them.
- [ERC20][]: Basic [aka Fungible] Token Standard
- [ERC721][]: Non-Fungible Token Standard

[Chainid.network]: https://github.com/ethereum-lists/chains
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md
[CAIP-19]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-19.md
[CAIP-21]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-21.md
[CAIP-22]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-22.md
[EIP155]: https://eips.ethereum.org/EIPS/eip-155
[ERC20]: https://eips.ethereum.org/EIPS/eip-20
[ERC721]: https://eips.ethereum.org/EIPS/eip-721


## Rights

Copyright and related rights waived via CC0.