ICE Blockchain
Search
⌃K

Accounts Mapping

Ethereum - Substrate account Mapping
EVM pallet enables the Ethereum EVM capabilities on a native Substrate chain. To make use of EVM similar to any EVM-based blockchain, one should understand how an Ethereum account is mapped relative to the Substrate chain.

Ethereum / SNOW Address Conversion tool

Head over to the SNOW address converter (Source Code) to easily convert your Ethereum address to Substrate/SNOW address and vice versa.
Just select the input address format from the dropdown and enter the selected input format address in the input field and click on go. For example:
  • Select the input address format to H160(ethereum)
  • Enter your Ethereum address and click on go
  • You will get your equivalent SS58(substrate) address
  • In my case H160, SS58, Public Key and SNOW address were:
H160 address: 0x7c0f5F59A22B657C8D9E21b44D2Dc0118fD2BE7B
SS58 address: 5DLri6vcHLAGAs3kQFoE8wP9cG4gHfcqmNrFVZJT2tNMQREX
Public Key: 0x388df59fae952b4e08b8a7b13a5dba9df0151e7ccdd8f897d2fe1e2413c71278
SNOW address: nhyYBGP1JvqpB7v8wpwFGWVu1HKJe965TPMw3A8m54j6ih9wL

Ethereum (H160) to SNOW Address Mapping

Every Ethereum address(20-byte) on the EVM is mapped with a unique public key(32-byte) on the Substrate chain, which acts as a proxy to maintain balance for the Ethereum address. This unique public key can be encoded to SNOW address format, which is generated deterministically from the Ethereum address on funding.
Sample SNOW address: ni3NqFqifz5csgiuFmKFQz8KKGBZsENGyvkSXMKdSxw76LpZo
The deterministically generated ss58 address is generated by the following steps:
  • Consider a 20-byte Ethereum address: 0x6be02d1d3665660d22ff9624b7be0551ee1ac91b.
  • Add bytes of evm: as prefix and concat it with the 20-byte Ethereum address bytes.
  • Perform blake2b Hash on the concatenated bytes. This hash is the public key associated with the H160 address.
  • Convert the hashed Hex to SNOW address format base address to get the Mapping Substrate account.
Alternatively, one can run the script(substrate-address.js) provided available with this repo, to generate a Substrate address from the Ethereum address.

SNOW address to H160 address mapping

H160 address is simply the first 20 bytes of the Substrate public key. This mapping is direct and deterministic which simplifies the address translation.
For Example The SS58 address nhyMVM8op8o7ujq7Mvs6ojUV3cckpwfpsMd4HC47Awbmkjv5X has 32 byte public key 0x306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20. This account’s equivalent Ethereum address will be 0x306721211d5404bd9da88e0204360a1a9ab8b87c.

Balance Mapping

Whenever the base Substrate account is funded with some units. A new account is created automatically (if it doesn't exist) & funds will be transferred from the source account to the receiver account.
During any transaction on the EVM, the funds are used by default from the mapped-Substrate address, the EVM always translates the 20-byte Ethereum address to the deterministically generated SS58 address.
To fund the Ethereum/Substrate account with Faucet on Arctic Testnet, Please refer here.
Note that the private key you hold on either Substrate or EVM side will not give you access to the corresponding mapped address on EVM or Substrate respectively.