Overview
This guide covers the essential configuration requirements to ensure a smooth transition from a standard Cosmos chain to an EVM-compatible chain.The integration process focuses on two key areas: account derivation and gas token configuration. These must be set before adding the EVM module to ensure compatibility with Ethereum tooling. If you’re pre-genesis and may add Cosmos EVM in the future, we strongly recommend completing steps 1 and 2a now to avoid major migrations later.
Prerequisites
Before beginning the integration process, ensure you have:- A running Cosmos SDK chain with governance enabled
- Access to modify the chain’s configuration and codebase
- Understanding of your chain’s current account derivation setup
- Knowledge of your gas token’s decimal configuration
1) Address Derivation Setup
Proper address derivation is critical for ensuring compatibility with Ethereum wallets, CLI tools, and block explorers. This setup consists of two components that work together to generate Ethereum-compatible addresses on your Cosmos chain.Set Coin Type to 60
The coin type is part of the BIP44 public key derivation path and must be set to60 (Ethereum’s standard) for EVM compatibility. This ensures that wallets using standard Ethereum derivation paths can correctly generate keys for your chain.
Configure in your chain’s initialization:
The coin type must be set during chain initialization and before the SDK config is sealed.
Add EthSecp256k1 Key Type
TheEthSecp256k1 key type enables Ethereum-style address derivation, which uses the last 20 bytes of the public key rather than RIPEMD-160 hashing it before encoding. This makes it possible to convert between 0x prefixed addresses and Cosmos Bech32 address encodings—both of which may be reverted back to the public key bytes.
Reference implementations:
- Keyring options: cmd/evmd/cmd/root.go
- Encoding config in app.go: evmd/app.go
- Encoding config helper: encoding/config.go
Why This Matters
The combination of coin type 60 andEthSecp256k1 key type ensures:
- Unified Account Access: The same private key/mnemonic derives the same address on both Cosmos and EVM sides, so users see identical balances and can access the same funds through MetaMask or Cosmos wallets
- Wallet Compatibility: MetaMask, Ledger, and other Ethereum wallets work seamlessly
- Address Conversion: Users can easily convert between
0xand Bech32 address formats for the same underlying account - Tooling Support: Ethereum development tools (Hardhat, Foundry, Remix) function correctly
2) Gas Token Decimals
Ethereum uses 18 decimals for its gas token (1 wei = 10^-18 ETH), and maintaining this standard is strongly preferred for EVM compatibility. The decimal configuration affects how gas prices are calculated and displayed across all Ethereum tooling.Option A: 18-Decimal Gas Token (Preferred)
If your chain already uses an 18-decimal token as the gas token, no additional configuration is needed. The EVM module will work natively with your existing token. Genesis configuration:Option B: Non-18-Decimal Token with PreciseBank
For chains with non-18-decimal gas tokens (e.g., 6 decimals likeuatom), use the x/precisebank module to track fractional balances at the EVM level while maintaining the native denomination for Cosmos transactions.
The precisebank module wraps the standard bank module and stores fractional balances separately. For example, if someone transfers 0.5 × 10^-6 tokens (less than 1 uatom) via an EVM transaction, precisebank tracks this fractional amount even though the base denomination can’t represent it.
Decimal Configuration Summary
| Token Type | Configuration | Module Required |
|---|---|---|
| 18-decimal native token | Standard setup | None |
| Non-18-decimal token | ExtendedDenomOptions + precisebank | x/precisebank |
3) Upgrade Handler Implementation
After configuring address derivation and gas token decimals, implement an upgrade handler to add the EVM module to your running chain.Refer to the upgrade handlers documentation for more details on implementing and testing upgrade handlers.
4) Testing and Validation
Before proposing the upgrade on mainnet, thoroughly test on a testnet or local network.Pre-Upgrade Checklist
- [] Coin type set to 60
- [] EthSecp256k1 added to keyring and signing options
- [] Gas token decimal configuration determined (18-decimal native or
x/precisebank) - [] Upgrade handler implemented and tested
Post-Upgrade Validation
After the upgrade executes:-
Verify address derivation:
-
Test EVM transactions:
This confirms:
- EVM transactions are processed correctly
- Gas is calculated in wei (18 decimals)
- Ethereum tooling (Forge) works seamlessly with your chain
-
Check module parameters:
Key Considerations
Chain Halt Risk
Account Migration
Existing accounts on your chain will continue to work after adding the EVM module. However:- Legacy accounts using
secp256k1keys can still interact with Cosmos SDK modules - New EVM-compatible accounts should be created with
eth_secp256k1keys
If Step 1 (address derivation setup) was skipped, users importing their mnemonic into an Ethereum wallet will see a completely different address than their Cosmos account, with no visible balances or state. This is why proper address derivation must be configured before adding the EVM module.
Existing Balances
Token balances are preserved during the upgrade:- For 18-decimal tokens: No migration needed, just ensure bank metadata is set properly.
- For non-18-decimal tokens: Existing balances remain unchanged in the Cosmos SDK, but EVM interactions will use the precisebank wrapper for fractional precision