cosmos-sdk icon indicating copy to clipboard operation
cosmos-sdk copied to clipboard

EVM Address Support

Open aaronc opened this issue 7 months ago • 1 comments
trafficstars

Although the basic public type used in both Ethereum and Cosmos is secp256k1, the address derivation is different so Ethereum and Cosmos addresses are not the same for the same public key.

aaronc avatar Apr 03 '25 20:04 aaronc

here are my thoughts:

  • Issues with coin types and HD derivation paths are purely a wallet issue and completely opaque to state machines. As long as the desired Ethereum wallets support custom HD paths, it should be possible to import existing private keys and derive the same public key.
  • The general design of having two address spaces makes a lot of sense and is the conclusion we previously came to regarding supporting multiple VMs - basically when you're in the Cosmos world a pubkey gets a cosmos1 address and when you're in the EVM world the same pubkey should get a different 0x address
  • We do need to address more than just secp256k1 public keys. They are less common, but there are other address types that are supported in Cosmos. In particular, all chains have synthetic module account addresses which are sometimes 32 bytes long. We need a mechanism to derive an EVM address for all account types.
  • Creating a separate account type such as ETHAccount is the right instinct, but overloading AccountI is somewhat problematic in general. If all accounts should actually have an EVM address, then I believe a better solution is to actually have a map in state from Cosmos address -> EVM Address (ex. collections.Map[sdk.AccAddress, EVMAddress]).

aaronc avatar Apr 03 '25 20:04 aaronc