tomi Domains
tomi Domains
tomi Domains
  • Introduction
    • Domains
      • Terminology
      • Frequently Asked Questions
      • Domains Deployments
      • Registrar Frequently Asked Questions
      • DNS Registrar guide
      • Domains Improvement Proposals
      • DomainsIP-2: Initial Hash Registrar
      • DomainsIP-3: Reverse Resolution
      • DomainsIP-4: Support for contract ABIs
      • DomainsIP-5: Text Records
      • DomainsIP-6: DNS-in-Domains
      • DomainsIP-7: Interface Discovery
      • DomainsIP-8: Multichain Address Resolution
      • DomainsIP-9: Wildcard Resolution
      • DomainsIP-10: EVM compatible Chain Address Resolution
      • DomainsIP-11: Avatar Text Records
      • DomainsIP-12: SAFE Authentication for Domains
      • DomainsIP-13: On-chain Source Parameter
      • Dapp Developer Guide
      • Managing Names
      • Registering & Renewing Names
      • Domains Front-End Design Guidelines
      • Domains AS NFT
      • Domains Layer2 and offchain data support
      • Domains Data guide
      • Name Processing
      • Registry
      • ReverseRegistrar
      • TestRegistrar
      • PublicResolver
      • .tomi Permanent Registrar
        • Registrar
        • Controller
      • DNS Registrar
      • Subgraph
        • Query Examples
      • Resolving Names On-chain
      • Writing a Resolver
      • Writing a Registrar
      • Guide for DApp Developers
      • Technical Description
Powered by GitBook
On this page
  1. Introduction
  2. Domains

DomainsIP-10: EVM compatible Chain Address Resolution

Introduces coinType for EVM compatible chains.

Abstract

This DomainsIP extends DomainsSIP 8 (multichain address resolution), dedicates a range of coin types for EVM compatible chains, and specifies a way to derive EVM chain IDs to the designated coin types.

The dedicated range uses over 0x80000000 (2147483648) which is reserved under DomainsIP 8 so there will be no possibility of coin type collision with other non EVM coin types to be added in future. However, some of coin types previously allocated to EVM chain ides will be deprecated.

Motivation

The existing DomainsIP 8 relies on the existence of coin types on SLIP44 which was designed to define address encoding type for deterministic wallets. As the majority of EVM compatible chains inherit the same encoding type as Ethereum, it is redundant to keep requesting the addition of EVM compatible chains into SLIP 44. This specification standardises a way to derive coinType based on Chain ID.

Specification

This specification amends DomainsIP 8 to specify that coin types with the most-significant bit set are to be treated as EVM chain IDs. The MSB is reserved in SLIP44 for other purposes relating to HD wallet key derivation, so no coin types exist in this range.

To compute the new coin type for EVM chains, bitwise-OR the chain ID with 0x80000000: 0x80000000 | chainId.

export const convertEVMChainIdToCoinType = (chainId: number) =>{
 return  (0x80000000 | chainId) >>> 0
}

And to reverse the operation, bitwise-AND the cointType with 0x7fffffff: 0x7fffffff & coinType.

export const convertCoinTypeToEVMChainId = (coinType: number) =>{
 return  (0x7fffffff & coinType) >> 0
}

Example

To compute the new coin type for EVM chains, call convertEVMChainIdToCoinType(chainId).

const encoder = require('@tdnsdomains/address-encoder')
>  encoder.convertEVMChainIdToCoinType(61)
2147483709
> encoder.convertCoinTypeToEVMChainId(2147483709)
61

You can also use existing functions formatsByName and formatsByCoinType to derive these chain IDs

> encoder.formatsByName['XDAI']
{
coinType: 2147483748,
decoder: [Function (anonymous)],
encoder: [Function (anonymous)],
name: 'XDAI'
}
> encoder.formatsByCoinType[2147483748]
{
coinType: 2147483748,
decoder: [Function (anonymous)],
encoder: [Function (anonymous)],
name: 'XDAI'
}

Exceptions

The following EVM chains are the exception to this standard.

  • AVAX = AVAX has multiple chain address formats, and only c chain is EVM compatible.

  • RSK = RSK has its own additional validation.

They will continue using coinType defined at SLIP44

Backwards Compatibility

The following EVM compatible cointypes existed before introducing this new standard.

  • NRG

  • POA

  • TT

  • CELO

  • CLO

  • TOMO

  • EWT

  • THETA

  • GO

  • FTM

  • XDAI

  • ETC

When you display them for backward compatibility purposes, append _LEGACY to the cointype and make them read only.

PreviousDomainsIP-9: Wildcard ResolutionNextDomainsIP-11: Avatar Text Records

Last updated 9 months ago