-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
199b25e
commit 2e934b9
Showing
2 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
--- | ||
namespace-identifier: eip155 | ||
title: EIP155 Namespace, aka EVM 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/XXX | ||
status: Draft | ||
type: Standard | ||
created: 2022-01-19 | ||
updated: 2022-01-19 | ||
requires: 2, 10, 19 | ||
supercedes: 3, 21, 22 | ||
--- | ||
|
||
# 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 superceded by future EIPs. | ||
|
||
## 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 strives for uniqueness and the fact | ||
that the standard is used for replay protection ensure that creators of a new | ||
Ethereum network have an incentive to use an ID that is not used elsewhere. | ||
These new Ethereum networks can be self-registered in the [chainid.network][] | ||
registry. | ||
|
||
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 | ||
``` | ||
|
||
## 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. | ||
|
||
### 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 | ||
``` | ||
|
||
### 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. | ||
|
||
## 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 | ||
- [Chainid.network][]: 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://chainid.network/ | ||
[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. |