Skip to main content
New to predeployed contracts? Start here:Individual Contract Documentation:

Getting Started

There are several methods to deploy preinstalled contracts on a Cosmos EVM chain:

1. Genesis Configuration

The most straightforward method for new chains or testnets. Contracts are deployed when the chain is first initialized.
If using the reference evmd application, your chain automatically includes default preinstalls, however they will not be active by default.

Local Development

local_node.sh does not populate preinstalls. The evmd init command generates a genesis.json with an empty preinstalls array, and the script’s jq customizations only patch other parameters. To enable preinstalls locally, manually add a jq command in your local_node.sh (after evmd init) to populate app_state.evm.preinstalls with the desired entries before starting the node.

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 cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn 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:
  1. 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)
  2. Code Validation
    • Must be valid EVM bytecode (hex encoded)
    • Cannot have empty code hash
    • Must pass bytecode verification
  3. 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

  1. Local Testing: Deploy on local node first
  2. Testnet Validation: Test governance proposal process
  3. Integration Testing: Verify interactions with other contracts
  4. Gas Analysis: Monitor gas consumption patterns
  5. 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

  1. Start with Defaults: Use evmtypes.DefaultPreinstalls unless you have specific requirements
  2. Test Thoroughly: Validate on testnet before mainnet deployment
  3. Document Changes: Clearly communicate any non-standard deployments to developers
  4. 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

Critical - Safe Factory Bytecode ErrorThe Safe Singleton Factory bytecode in DefaultPreinstalls (x/vm/types/preinstall.go:30-32) is identical to the Create2 factory bytecode, which is incorrect and will not function for deploying Safe wallets.Verification:
Before deploying to production:
  1. Get the correct Safe Singleton Factory bytecode from the official repository
  2. Update your genesis preinstalls configuration with the correct bytecode
  3. Test thoroughly on a testnet
  4. See the Safe Factory documentation for more details
Temporary workaround: If you need Safe functionality immediately, manually update the bytecode in your genesis.json or use a governance proposal to deploy the correct contract.

Adding Custom Preinstalls

To add custom contracts beyond the defaults:

Troubleshooting

Common Issues

Debugging Steps

  1. Check chain genesis configuration
  2. Verify proposal passed and executed
  3. Query contract code directly
  4. Test with simple contract interaction
  5. Review chain logs for errors

Quick Reference

Default Preinstalls

| Contract | Address | Bytecode Field | Status | |-|||—| | Create2 | 0x4e59b44847b379578588920ca78fbf26c0b4956c | preinstall.Code | ✓ Verified | | Multicall3 | 0xcA11bde05977b3631167028862bE2a173976CA11 | preinstall.Code | ✓ Verified | | Permit2 | 0x000000000022D473030F116dDEE9F6B43aC78BA3 | preinstall.Code | ✓ Verified | | Safe Factory | 0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7 | preinstall.Code | ⚠️ Bytecode Issue | | EIP-2935 | 0x0000F90827F1C53a10cb7A02335B175320002935 | params.HistoryStorageCode | ✓ System Contract | Source: x/vm/types/preinstall.go:13-39

Genesis Configuration Paths

Further Resources

Official Specifications

Contract Documentation

Cosmos EVM Resources