From 56e55f5e86ab9bb5f42bee4cb9686a3c4ee75a00 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev Date: Tue, 8 Oct 2024 20:14:29 -0500 Subject: [PATCH 01/12] Initial Commit --- ERCS/eic-chain-identifiers.md | 105 ++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 ERCS/eic-chain-identifiers.md diff --git a/ERCS/eic-chain-identifiers.md b/ERCS/eic-chain-identifiers.md new file mode 100644 index 0000000000..a3345433df --- /dev/null +++ b/ERCS/eic-chain-identifiers.md @@ -0,0 +1,105 @@ +--- +title: On-chain registration of chain identifiers +description: Derive chain identifiers by hashing their chain name and use ENS to map chain names to these identifiers +author: Marco Stronati (@paracetamolo), Jeff Lau +discussions-to: https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299 +status: Draft +type: Meta +created: 2024-09-26 +--- + +## Abstract + +This ERC proposes to derive chain identifiers as a digest of their chain name (and other information) and to use ENS to map chain names to identifiers in place of the centralized list on GitHub. +A solution to support existing chain identifiers that were not derived following this ERC is also proposed. + +## Motivation + +The mapping between chain names and identifiers, such as `Mainnet -> 0x1`, is currently maintained in a centralized list on GitHub (see ```ethereum-lists/chains``` repo). +However this solution has two main shortcomings: +- It does not scale with the growing number of L2s. +- The list maintainers are a single point of failure. + +Desired properties: +- the ability to register new chain names and identifiers in a censorship-resistant way +- the ability to resolve chain names and identifiers in a trustless way +- maintain a unique mapping between names and identifiers + +### Chain Identifier Spoofing and Replay Attacks + +An important property of the centralized list is that it keeps a one-to-one correspondence between names and indentifiers. + +Without this property, an attacker could register a fresh name pointing to an existing identifier. For example `my-testnet` could point to mainnet `0x1`. A user could be tricked into signing a transaction for the innocent looking `my-testnet` while actually signing a transaction for mainnet, a transaction that we attacker can then replay. + +## Specification + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174. + +### Extending chain identifiers + +Current chain identifiers are usually chosen arbitrarily to be short. While these identifiers are convenient on a small scale, as their number increases it is more desirable to draw them from a larger space. + +We propose to extend the size of identifiers to 32 bytes and to derive them using a cryptographic hash function. +The input to the function MUST contain the chain name and MAY contain additional information. + +An example for a L2: +``` +chain_id = Keccak-256(CHAIN_NAME, L1_CHAIN_ID, VERSION, BRIDGE) +``` +where: +- `L1_CHAIN_ID` is the id of the L1 where the L2 settles, it could be Mainnet or a testnet. +- `VERSION` is to separate the domain of the hash function with an arbitrary string +- `BRIDGE` is the address of the L2 on the L1 + +### Chain name resolution + +Any ENS name can resolve to a chain identifier as specified in ENSIP-11. The name should resolve to a record containing not only the chain identifier, but also all the optional information necessary to verify the identifier. + +For example the chain name `rollup` can be converted to a chain identifier on Mainnet by resolving: +``` +rollup.eth -> {version : uint, bridge : address, chain_id : chain_id} +``` +and then verified using: +``` +chain_id == hash("rollup", 0x1, version, bridge) +``` + +## Rationale + + + +TBD + +## Backwards Compatibility + +Existing identifiers, that were not derived using the scheme above, can be supported using a reverse mapping from chain identifiers to chain names, so that one can check for uniqueness. + +For example the chain name `legacy-rollup.eth` can be resolved to the chain identifier `0x123`. +Then `0x123` can be resolved in the `chainid.reverse` domain to a `chain_name`. +If `chain_name == legacy-rollup` then the mapping is valid. + +### Bootstrapping and handover + +In order to bootstrap the handling of legacy chain identifiers, we imagine the EF populating the `chainid.reverse` domain, a temporary `l2.eth` for names and then handing them over. + +- EF populates two subdomains `l2.eth` and `chainid.reverse` using Ethereum lists. +- A rollup registers a `rollup.eth` and points it to their `chain_id. +- EF hands over to the rollup `rollup.l2.eth` and `chain_id.chainid.reverse` +- The rollup updates `chain_id.chainid.reverse` to return `rollup.eth` + + +## Security Considerations + +Domain spoofing can lead to replay attacks as described above and can be eliminated by deriving new identifiers using a hash function and by checking the reverse mapping for legacy identifiers. + +Domain squatting, the practice of ammassing a large number of domains in the hope to selling them later to legitimate users, is a possibility but with an increasing number of L2 registrations we can expect the same problem to appear in the centralized Github list. + +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE.md). From c832e526aa3cbc063d17b35abf2f860315eaae97 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev Date: Tue, 8 Oct 2024 20:18:49 -0500 Subject: [PATCH 02/12] renamed file --- ERCS/{eic-chain-identifiers.md => erc-chain-identifiers.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ERCS/{eic-chain-identifiers.md => erc-chain-identifiers.md} (100%) diff --git a/ERCS/eic-chain-identifiers.md b/ERCS/erc-chain-identifiers.md similarity index 100% rename from ERCS/eic-chain-identifiers.md rename to ERCS/erc-chain-identifiers.md From 753774f84309966de8515c138ec5958e2ae90156 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev <158060999+yuliyaalexiev@users.noreply.github.com> Date: Tue, 8 Oct 2024 20:34:40 -0500 Subject: [PATCH 03/12] Update ERCS/erc-chain-identifiers.md Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com> --- ERCS/erc-chain-identifiers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ERCS/erc-chain-identifiers.md b/ERCS/erc-chain-identifiers.md index a3345433df..2e1f956d7a 100644 --- a/ERCS/erc-chain-identifiers.md +++ b/ERCS/erc-chain-identifiers.md @@ -1,4 +1,5 @@ --- +eip: 7785 title: On-chain registration of chain identifiers description: Derive chain identifiers by hashing their chain name and use ENS to map chain names to these identifiers author: Marco Stronati (@paracetamolo), Jeff Lau From b887df2a4a43e7cf16bdbeaaa1a1007898909f01 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev <158060999+yuliyaalexiev@users.noreply.github.com> Date: Tue, 8 Oct 2024 20:35:10 -0500 Subject: [PATCH 04/12] Update ERCS/erc-chain-identifiers.md Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com> --- ERCS/erc-chain-identifiers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-chain-identifiers.md b/ERCS/erc-chain-identifiers.md index 2e1f956d7a..6ff5e672f8 100644 --- a/ERCS/erc-chain-identifiers.md +++ b/ERCS/erc-chain-identifiers.md @@ -1,6 +1,6 @@ --- eip: 7785 -title: On-chain registration of chain identifiers +title: Onchain registration of chain identifiers description: Derive chain identifiers by hashing their chain name and use ENS to map chain names to these identifiers author: Marco Stronati (@paracetamolo), Jeff Lau discussions-to: https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299 From a5636744a62fd056849d5c95c960c46c8193a951 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev Date: Tue, 8 Oct 2024 20:36:42 -0500 Subject: [PATCH 05/12] Renamed the file --- ERCS/{erc-chain-identifiers.md => erc-7785.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ERCS/{erc-chain-identifiers.md => erc-7785.md} (100%) diff --git a/ERCS/erc-chain-identifiers.md b/ERCS/erc-7785.md similarity index 100% rename from ERCS/erc-chain-identifiers.md rename to ERCS/erc-7785.md From 2dc2b85e466f0c52a7cea210bd2c284eb48114f0 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev Date: Tue, 8 Oct 2024 20:52:45 -0500 Subject: [PATCH 06/12] changed type to ERC --- ERCS/erc-7785.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-7785.md b/ERCS/erc-7785.md index 6ff5e672f8..c262911b0e 100644 --- a/ERCS/erc-7785.md +++ b/ERCS/erc-7785.md @@ -5,7 +5,7 @@ description: Derive chain identifiers by hashing their chain name and use ENS to author: Marco Stronati (@paracetamolo), Jeff Lau discussions-to: https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299 status: Draft -type: Meta +type: ERC created: 2024-09-26 --- From cd5fb08f3561048289658c15799819c6eb56dc65 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev Date: Tue, 8 Oct 2024 21:03:45 -0500 Subject: [PATCH 07/12] Back to type: Meta --- ERCS/erc-7785.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-7785.md b/ERCS/erc-7785.md index c262911b0e..6ff5e672f8 100644 --- a/ERCS/erc-7785.md +++ b/ERCS/erc-7785.md @@ -5,7 +5,7 @@ description: Derive chain identifiers by hashing their chain name and use ENS to author: Marco Stronati (@paracetamolo), Jeff Lau discussions-to: https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299 status: Draft -type: ERC +type: Meta created: 2024-09-26 --- From 9fc09d4b9d607f1c5a3a8fada1155882b9139857 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev Date: Tue, 8 Oct 2024 21:06:58 -0500 Subject: [PATCH 08/12] Trial and error --- ERCS/erc-7785.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ERCS/erc-7785.md b/ERCS/erc-7785.md index 6ff5e672f8..f3e60e1599 100644 --- a/ERCS/erc-7785.md +++ b/ERCS/erc-7785.md @@ -5,7 +5,8 @@ description: Derive chain identifiers by hashing their chain name and use ENS to author: Marco Stronati (@paracetamolo), Jeff Lau discussions-to: https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299 status: Draft -type: Meta +category: ERC +type: Standards Track created: 2024-09-26 --- From ab1af04b01565e14e17d5a5a7c95347de09a82f1 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev Date: Tue, 8 Oct 2024 21:10:12 -0500 Subject: [PATCH 09/12] changed order --- ERCS/erc-7785.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-7785.md b/ERCS/erc-7785.md index f3e60e1599..958b4dd6e6 100644 --- a/ERCS/erc-7785.md +++ b/ERCS/erc-7785.md @@ -5,8 +5,8 @@ description: Derive chain identifiers by hashing their chain name and use ENS to author: Marco Stronati (@paracetamolo), Jeff Lau discussions-to: https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299 status: Draft -category: ERC type: Standards Track +category: ERC created: 2024-09-26 --- From 7fee9bd0053b62a6b7da18c3593618305e665bb0 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev <158060999+yuliyaalexiev@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:53:19 -0500 Subject: [PATCH 10/12] Update ERCS/erc-7785.md Updated Jeff's contact to GH user name Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com> --- ERCS/erc-7785.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-7785.md b/ERCS/erc-7785.md index 958b4dd6e6..408c15b504 100644 --- a/ERCS/erc-7785.md +++ b/ERCS/erc-7785.md @@ -2,7 +2,7 @@ eip: 7785 title: Onchain registration of chain identifiers description: Derive chain identifiers by hashing their chain name and use ENS to map chain names to these identifiers -author: Marco Stronati (@paracetamolo), Jeff Lau +author: Marco Stronati (@paracetamolo), Jeff Lau (@jefflau) discussions-to: https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299 status: Draft type: Standards Track From da73ebf4a114d2e045551fc3f194795d6b686ef2 Mon Sep 17 00:00:00 2001 From: yuliyaalexiev <158060999+yuliyaalexiev@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:56:53 -0500 Subject: [PATCH 11/12] Update ERCS/erc-7785.md Co-authored-by: sampkaML <131076291+sampkaML@users.noreply.github.com> --- ERCS/erc-7785.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-7785.md b/ERCS/erc-7785.md index 408c15b504..e9b67b4475 100644 --- a/ERCS/erc-7785.md +++ b/ERCS/erc-7785.md @@ -46,7 +46,7 @@ The input to the function MUST contain the chain name and MAY contain additional An example for a L2: ``` -chain_id = Keccak-256(CHAIN_NAME, L1_CHAIN_ID, VERSION, BRIDGE) +chain_id = Keccak-256(CHAIN_NAME, SETTLEMENT_CHAIN_ID, VERSION, DEPLOYER_CONTRACT_ADDRESS, SALT) ``` where: - `L1_CHAIN_ID` is the id of the L1 where the L2 settles, it could be Mainnet or a testnet. From a11ac49810b9a9f9176309d25ef7440b014cc15b Mon Sep 17 00:00:00 2001 From: yuliyaalexiev <158060999+yuliyaalexiev@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:33:06 -0500 Subject: [PATCH 12/12] Update ERCS/erc-7785.md Co-authored-by: Bumblefudge --- ERCS/erc-7785.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ERCS/erc-7785.md b/ERCS/erc-7785.md index e9b67b4475..76e70b493f 100644 --- a/ERCS/erc-7785.md +++ b/ERCS/erc-7785.md @@ -49,7 +49,7 @@ An example for a L2: chain_id = Keccak-256(CHAIN_NAME, SETTLEMENT_CHAIN_ID, VERSION, DEPLOYER_CONTRACT_ADDRESS, SALT) ``` where: -- `L1_CHAIN_ID` is the id of the L1 where the L2 settles, it could be Mainnet or a testnet. +- `SETTLEMENT_CHAIN_ID` is the id of the L1 where the L2 settles, it could be Mainnet or a testnet. - `VERSION` is to separate the domain of the hash function with an arbitrary string - `BRIDGE` is the address of the L2 on the L1