What Are Predeployed Contracts?
Predeployed contracts (also called preinstalls) are regular EVM smart contracts with their bytecode deployed at predetermined addresses, either at chain genesis or through governance mechanisms. Unlike precompiles which are native Go implementations built into the chain binary, predeployed contracts:- Contain actual EVM bytecode that can be executed by the EVM
- Consume gas like any regular smart contract
- Can be verified on block explorers
- Are immutable once deployed (no upgrades possible)
Why Use Predeployed Contracts?
Predeployed contracts represent a fundamental pattern in EVM-based chains that provides several key advantages:Standardization
By deploying essential contracts at known addresses, chains ensure compatibility with existing Ethereum tooling and libraries that expect these contracts at specific locations.Developer Experience
Developers don’t need to deploy their own versions of common utilities, saving deployment costs and reducing complexity.Cross-chain Consistency
Using the same addresses across different chains enables easier multi-chain development and deployment strategies.Ecosystem Alignment
Many tools, wallets, and dApps in the Ethereum ecosystem expect certain contracts (like Multicall3) at specific addresses.Comparison with Precompiles
Understanding the distinction between predeployed contracts and precompiles is crucial for choosing the right approach for your implementation:Aspect | Predeployed Contracts | Precompiles |
---|---|---|
Implementation | EVM bytecode stored on-chain | Native Go code in chain binary |
Gas Costs | Standard EVM gas pricing | Custom, typically lower gas costs |
Deployment | Must be explicitly deployed | Always available when enabled |
Upgradeability | Immutable once deployed | Can be modified via chain upgrades |
Verification | Verifiable on block explorers | Source not visible on-chain |
Address Range | Any valid address | Special range (0x1-0x9FF) |
Storage | Uses regular contract storage | Can access native Cosmos state |
When to Choose Predeployed Contracts
Use predeployed contracts when:- You need standard Ethereum contracts at expected addresses
- Full EVM compatibility is required
- Contract source verification is important
- The functionality doesn’t require native chain integration
- You need optimized gas costs for frequently used operations
- Direct access to Cosmos SDK state is required
- The functionality requires native chain features
- Upgradeability through chain upgrades is needed
Configuration
Genesis Configuration
Predeployed contracts are configured during chain genesis through thepreinstalls
parameter in the VM module. This defines which contracts are deployed at specific addresses during network initialization.
The default preinstalls are defined in the codebase at
x/vm/types/preinstall.go:13-39
. For complete guidance on customizing preinstalls, see:- Building Your Chain Guide - Quick start configuration
- Predeployed Contracts Integration - Detailed implementation guide
- Chain Customization Checklist - Step-by-step setup
Common Examples
The Cosmos EVM includes several default predeployed contracts (defined inevmtypes.DefaultPreinstalls
):
- Create2 (
0x4e59b44847b379578588920ca78fbf26c0b4956c
): Deterministic contract deployment - Documentation - Multicall3 (
0xcA11bde05977b3631167028862bE2a173976CA11
): Batch multiple calls in one transaction - Documentation - Permit2 (
0x000000000022D473030F116dDEE9F6B43aC78BA3
): Universal token approval system - Documentation - Safe Factory (
0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7
): Deploy Safe multisig wallets - Documentation - EIP-2935 (
0x0b
): Historical block hash storage (system contract)
Related Concepts
- Precompiles - Native chain implementations exposed as smart contracts
- VM Module - Core EVM module configuration including preinstalls
- Building Your Chain - Complete guide to chain setup
Implementation Guides
- Predeployed Contracts Integration - Detailed technical guide for deploying and managing preinstalled contracts
- Chain Customization Checklist - Step-by-step setup checklist
- Individual Contract Documentation - Usage examples and integration patterns for each contract