From 4f671013aefe413736c165f41cd1662cb8e9eadc Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 10 Jul 2024 09:06:46 -0700 Subject: [PATCH 1/3] Create caip-draft-evm-xaddress.md --- CAIPs/caip-draft-evm-xaddress.md | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 CAIPs/caip-draft-evm-xaddress.md diff --git a/CAIPs/caip-draft-evm-xaddress.md b/CAIPs/caip-draft-evm-xaddress.md new file mode 100644 index 00000000..5eb90c17 --- /dev/null +++ b/CAIPs/caip-draft-evm-xaddress.md @@ -0,0 +1,66 @@ +--- +# Every document starts with a front matter in YAML enclosed by triple dashes. +# See https://jekyllrb.com/docs/front-matter/ to learn more about this concept. +caip: CAIP-X +title: Universal EVM-Cross-Chain Address +author: Zainan Victor Zhou (@xinbenlv) +discussions-to: TBD +status: Draft +type: Standard +created: 2024-07-10 +updated: 2024-07-10 +--- + +## Simple Summary +A standard for an extended address format for EVM chain that includes chainId with consideration of future extensions. + +## Abstract +Currently EVM address are single chain, and is 20bytes. We envision native support to make contract call between EVM chains with different chainIds. +This proposal presents one possible solutions: 1) limiting chainId number space hence the length of its possible value; +2) pack it into the 32bytes/u256 native word length for maximum compatibility; and #) reserve additional bytes for future extension + +## Motivation +We envision one day EVM contract can make contract calls to other EVM chains (which have different chainIds). +For a contract to make such call, they needs to be able to specify a contract when they are on another EVM chain with a chainId. Hence we need a cross-chain contract address. + +## Specification + +An EVM-Cross-Chain Address aka "Xaddress" is defined follows + +1. Extension section of 4bytes(32bits), denoted as `Ext` +2. Main Address 0x<20bytes single chain Address> + +`Ext === 0x0000` is reserved for "only the address of the same chain" +`Ext === 0xFFFF` is reserved for "the original address of ANY chainId" + +3. Only EIP-2294 "Safe Range" is supported by this CAIP at the version. ChainId beyond Safe Range is out of the scope of this version. +4. Confirming contracts SHALL NOT make call to address beyond Safe Range of ChainId, but confirming contracts SHOULD consider accepting chainIds beyond this range (restrictive in write, flexible on read) + + +## Rationale +1. The reason we use a 4bytes length is based on [EIP-2294](https://eips.ethereum.org/EIPS/eip-2294) to specify a SAFE boundary of max chain Id to be `2^31 - 1` based on discussion of current usage of the chainId. +2. We didn't directly use [CAIP-50](./caip-50.md) because we see the support for EVM cross-chain function call more native. We envision in the future this CAIP becomes a sub-standard UNDER CAIP-50 or its future version. +3. We provide reserved Ext=0x0000 which is inspired by 0.0.0.0 in IPv4. And 0xFFFF as masking in IPv4 as well. We see possibility in a sharded or multi-chain situation, EOA or future EIP-7702 could potential be represented the same address across any EVM chain in the same base address. + + +## Test Cases + + +## Security Considerations + + +## Privacy Considerations + + +## Backwards Compatibility +There are onchain memory and storage representations where contract addresses were assumed to be 20bytes and only 20bytes and conduct packing for storage optimization. + + +## References + + +- [CAIP-50](./caip-50.md) +- [EIP-2294](https://eips.ethereum.org/EIPS/eip-2294) + +## Copyright +Copyright and related rights waived via [CC0](../LICENSE). From d8d57a0672aa1ad059ac666830ba7d48cf89b647 Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 10 Jul 2024 09:20:27 -0700 Subject: [PATCH 2/3] Update caip-draft-evm-xaddress.md --- CAIPs/caip-draft-evm-xaddress.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CAIPs/caip-draft-evm-xaddress.md b/CAIPs/caip-draft-evm-xaddress.md index 5eb90c17..1aa48877 100644 --- a/CAIPs/caip-draft-evm-xaddress.md +++ b/CAIPs/caip-draft-evm-xaddress.md @@ -16,8 +16,10 @@ A standard for an extended address format for EVM chain that includes chainId wi ## Abstract Currently EVM address are single chain, and is 20bytes. We envision native support to make contract call between EVM chains with different chainIds. -This proposal presents one possible solutions: 1) limiting chainId number space hence the length of its possible value; -2) pack it into the 32bytes/u256 native word length for maximum compatibility; and #) reserve additional bytes for future extension +This proposal presents one possible solutions: +1. limiting chainId number space hence the length of its possible value; +2. pack it into the 32bytes/u256 native word length for maximum compatibility; and +3. reserve additional bytes for future extension ## Motivation We envision one day EVM contract can make contract calls to other EVM chains (which have different chainIds). From 3b89c63629bd36b3d3938e455e38f35d1dde0e48 Mon Sep 17 00:00:00 2001 From: xinbenlv Date: Wed, 10 Jul 2024 09:26:51 -0700 Subject: [PATCH 3/3] Update caip-draft-evm-xaddress.md --- CAIPs/caip-draft-evm-xaddress.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CAIPs/caip-draft-evm-xaddress.md b/CAIPs/caip-draft-evm-xaddress.md index 1aa48877..8745c395 100644 --- a/CAIPs/caip-draft-evm-xaddress.md +++ b/CAIPs/caip-draft-evm-xaddress.md @@ -12,7 +12,8 @@ updated: 2024-07-10 --- ## Simple Summary -A standard for an extended address format for EVM chain that includes chainId with consideration of future extensions. +A standard for an extended address format for EVM chain that includes chainId with consideration of future extensions, using 4bytes prior the 20bytes of normal address. + ## Abstract Currently EVM address are single chain, and is 20bytes. We envision native support to make contract call between EVM chains with different chainIds.