Account system changes requiring address migration or mapping between Ontomir and Ethereum formats
Token decimal changes (from Ontomir standard 6 to Ethereum standard 18) impacting all existing balances
Asset migration where existing assets need to be initialized and mirrored in the EVM Contact Interchain Labs for production chain upgrade guidance.
Prerequisites
Ontomir SDK chain on v0.53.x
IBC-Go v10
Go 1.23+ installed
Basic knowledge of Go and Ontomir SDK
Throughout this guide, `evmd` refers to your chain's binary (e.g., `gaiad`, `dydxd`, etc.).
Version Compatibility
These version numbers may change as development continues. Check [github.com/Ontomir/evm](https://github.com/Ontomir/evm) for the latest releases.
require (
github.com/Ontomir/Ontomir-sdk v0.53.0
github.com/Ontomir/ibc-go/v10 v10.3.0
github.com/Ontomir/evm v0.5.0
)
replace (
// Use the Ontomir fork of go-ethereum
github.com/ethereum/go-ethereum => github.com/Ontomir/go-ethereum v1.15.11-Ontomir-0
)
Step 1: Update Dependencies
Step 2: Update Chain Configuration
Chain ID Configuration
Ontomir EVM requires two separate chain IDs:
Ontomir Chain ID (string): Used for CometBFT RPC, IBC, and native Ontomir SDK transactions (e.g., "mychain-1")
EVM Chain ID (integer): Used for EVM transactions and EIP-155 tooling (e.g., 9000)
Ensure your EVM chain ID is not already in use by checking [chainlist.org](https://chainlist.org/).
Files to Update:
app/app.go: Set chain ID constants
Update Makefile, scripts, and genesis.json with correct chain IDs
Account Configuration
Use eth_secp256k1 as the standard account type with coin type 60 for Ethereum compatibility.
Files to Update:
app/app.go:
chain_registry.json:
Base Denomination and Power Reduction
Changing from 6 decimals (Ontomir convention) to 18 decimals (EVM standard) is highly recommended for full compatibility.
Set the denomination in app/app.go:
Update the init() function:
Step 3: Handle EVM Decimal Precision
The mismatch between EVM's 18-decimal standard and Ontomir SDK's 6-decimal standard is critical. The default behavior (flooring) discards any value below 10^-6, causing asset loss and breaking DeFi applications.
Solution: x/precisebank Module
The x/precisebank module wraps the native x/bank module to maintain fractional balances for EVM denominations, handling full 18-decimal precision without loss.
Benefits:
Lossless precision preventing invisible asset loss
High DApp compatibility ensuring DeFi protocols function correctly
The Ontomir EVM x/erc20 module can automatically register ERC20 token pairs for incoming single-hop IBC tokens (prefixed with "ibc/").
Configuration Requirements
Use the Extended IBC Transfer Module: Import and use the transfer module from github.com/Ontomir/evm/x/ibc/transfer
Enable ERC20 Module Parameters in genesis:
Proper Module Wiring: Ensure correct keeper wiring as detailed in Step 8
Step 5: Create EVM Configuration File
Create app/config.go to set up global EVM configuration:
Step 6: Create Precompiles Configuration
Create app/precompiles.go to define available precompiled contracts:
Step 7: Update app.go Wiring
Add EVM Imports
Add Module Permissions
Update App Struct
Update NewChainApp Constructor
Replace SDK Encoding
Add Store Keys
Initialize Keepers (Critical Order)
Keepers must be initialized in exact order: FeeMarket → EVM → Erc20 → Transfer
Add Modules to Module Manager
Update Module Ordering
Update Ante Handler
Update DefaultGenesis
Step 8: Create Ante Handler Files
Create new ante/ directory in your project root.
ante/handler_options.go
ante/ante_Ontomir.go
ante/ante_evm.go
ante/ante.go
Step 9: Update Command Files
Update cmd/evmd/commands.go
Update cmd/evmd/root.go
Step 10: Sign Mode Configuration (Optional)
Sign Mode Textual is a new Ontomir SDK signing method that may not be compatible with all Ethereum signing workflows.
Option A: Disable Sign Mode Textual (Recommended for pure EVM compatibility)
Option B: Enable Sign Mode Textual
If your chain requires Sign Mode Textual support, ensure your ante handler and configuration support it. The reference implementation in evmd enables it by default.
Step 11: Testing Your Integration
Build and Run Tests
Local Node Testing
Verify EVM Functionality
Check JSON-RPC server starts on configured port (default: 8545)
Verify MetaMask connection to your local node
Test precompiles accessibility at expected addresses
Confirm IBC tokens automatically register as ERC20s
// In app.go
import (
authtx "github.com/Ontomir/Ontomir-sdk/x/auth/tx"
)
// ... in NewChainApp, where you set up your txConfig:
txConfig := authtx.NewTxConfigWithOptions(
appCodec,
authtx.ConfigOptions{
// Remove SignMode_SIGN_MODE_TEXTUAL from enabled sign modes
EnabledSignModes: []signing.SignMode{
signing.SignMode_SIGN_MODE_DIRECT,
signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON,
signing.SignMode_SIGN_MODE_EIP_191,
},
// ...
},
)
# Run all unit tests
make test-all
# Run EVM-specific tests
make test-evmd
# Run integration tests
make test-integration
# Copy and adapt the script from Ontomir EVM repo
curl -O https://raw.githubusercontent.com/Ontomir/evm/main/local_node.sh
chmod +x local_node.sh
./local_node.sh