Deploying and managing predeployed contracts on Ontomir EVM
For conceptual understanding of predeployed contracts and how they differ from precompiles, see the [Predeployed Contracts concept page](/docs/evm/next/documentation/concepts/predeployed-contracts).
Activation Methods
There are three primary methods to deploy preinstalled contracts on a Ontomir EVM chain:
1. Genesis Configuration
The most straightforward method for new chains or testnets. Contracts are deployed when the chain is first initialized.
Default Configuration
Using the evmd example application automatically includes default preinstalls:
The local_node.sh script automatically configures default preinstalls:
2. Governance Proposal
For chains already in production, use the MsgRegisterPreinstalls governance proposal:
Proposal Structure
The `authority` field must be set to the governance module account address, which is typically derived from the gov module name. This is usually something like `Ontomir10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn` for the standard gov module.
Submission Process
3. Chain Upgrade Handler
Include predeployed contracts as part of a coordinated chain upgrade:
Implementation Details
Validation Process
All preinstall deployments undergo strict validation:
Address Validation
Must be valid Ethereum address format (40 hex characters)
Cannot conflict with existing contracts
Should not overlap with precompile reserved addresses (typically 0x1-0x9FF)
Code Validation
Must be valid EVM bytecode (hex encoded)
Cannot have empty code hash
Must pass bytecode verification
Conflict Prevention
Checks for existing contracts at target address
Validates against account keeper for existing accounts
Ensures no code hash conflicts with different bytecode
Storage and State
Predeployed contracts are stored in the chain state like regular contracts:
Verification and Testing
Verify Deployment
After deployment, verify contracts are properly installed:
Testing Strategy
Local Testing: Deploy on local node first
Testnet Validation: Test governance proposal process
Integration Testing: Verify interactions with other contracts
Gas Analysis: Monitor gas consumption patterns
Security Audit: Review bytecode before mainnet deployment
Best Practices
Security Considerations
Bytecode Verification: Always verify that bytecode matches official releases
Address Selection: Ensure addresses don't conflict with future plans
Audit Requirements: Even well-known contracts should be reviewed
Immutability: Remember that predeployed contracts cannot be upgraded
Deployment Recommendations
Start with Defaults: Use evmtypes.DefaultPreinstalls unless you have specific requirements
Test Thoroughly: Validate on testnet before mainnet deployment
Document Changes: Clearly communicate any non-standard deployments to developers
Monitor Usage: Track contract interactions to understand adoption
Common Pitfalls to Avoid
Don't deploy to addresses that could conflict with precompiles (typically 0x1-0x9FF)
Don't assume contracts are deployed - always check first
Don't modify standard contract addresses without strong justification
Don't deploy untested or unaudited bytecode
Known Issues
The Safe Singleton Factory bytecode in the current DefaultPreinstalls may be incorrect (appears to be duplicate of Create2 bytecode). Verify the correct bytecode before deploying this contract in production.
Adding Custom Preinstalls
To add custom contracts beyond the defaults:
Troubleshooting
Common Issues
Issue
Cause
Solution
"preinstall already has an account in account keeper"