Available Precompiles
Precompile | Address | Purpose | Reference |
---|---|---|---|
Bank | 0x0000000000000000000000000000000000000804 | ERC20-style access to native Cosmos SDK tokens | Details |
Bech32 | 0x0000000000000000000000000000000000000400 | Address format conversion between Ethereum hex and Cosmos bech32 | Details |
Staking | 0x0000000000000000000000000000000000000800 | Validator operations, delegation, and staking rewards | Details |
Distribution | 0x0000000000000000000000000000000000000801 | Staking rewards and community pool management | Details |
ERC20 | Dynamic per token | Standard ERC20 functionality for native Cosmos tokens | Details |
Governance | 0x0000000000000000000000000000000000000805 | On-chain governance proposals and voting | Details |
ICS20 | 0x0000000000000000000000000000000000000802 | Cross-chain token transfers via IBC | Details |
WERC20 | Dynamic per token | Wrapped native token functionality | Details |
Slashing | 0x0000000000000000000000000000000000000806 | Validator slashing and jail management | Details |
P256 | 0x0000000000000000000000000000000000000100 | P-256 elliptic curve cryptographic operations | Details |
Configuration
Precompiled contracts provide direct, gas-efficient access to native Cosmos SDK functionality from within the EVM. Build powerful hybrid applications that leverage the best of both worlds. This page provides an overview of the available precompiled contracts, each with detailed documentation on its usage, Solidity interface, and ABI.Critical: Understanding Token Decimals in PrecompilesAll Cosmos EVM precompile contracts use the native chain’s decimal precision, not Ethereum’s standard 18 decimals (wei).Why this matters:
- Cosmos chains typically use 6 decimals, while Ethereum uses 18
- Passing values while assuming conventional Ethereum exponents could cause significant miscalculations
- Example: On a 6-decimal chain, passing
1000000000000000000
(1 token in wei) will be interpreted as 1 trillion tokens
- Check your chain’s native token decimal precision
- Convert amounts to match the native token’s format
- Never assume 18-decimal precision
Genesis Configuration
Precompiles must be enabled in the genesis file to be available on the network. Theactive_static_precompiles
parameter controls which precompiles are activated at network launch.
For complete genesis configuration including EVM and fee market parameters, see the Node Configuration reference.
v0.5.0 Breaking Changes
Precompile Constructor Interface ChangesAll precompile constructors in v0.5.0 now require keeper interfaces instead of concrete keeper implementations. This improves decoupling and testability but requires updates to custom precompile implementations.
Interface Requirements
Before (v0.4.x):evmd/precompiles.go:122
Required Interfaces
The following keeper interfaces are defined inprecompiles/common/interfaces.go
:
BankKeeper
: Account balances, token transfers, metadataStakingKeeper
: Validator operations, delegations, bond denomDistributionKeeper
: Reward withdrawals and distributionSlashingKeeper
: Validator slashing informationTransferKeeper
: IBC transfer operationsChannelKeeper
: IBC channel and connection queriesERC20Keeper
: Token pair mappings and conversions
Migration Example
Custom Precompile Migration:Integration Guide
Activation
Precompiles must be explicitly activated via theactive_static_precompiles
parameter: