Cosmos EVM 为 Cosmos SDK 链提供完整的以太坊兼容性。现有合约、工具和工作流都可直接运行,无需修改:你可以部署 Solidity 合约、连接 MetaMask,并继续使用你已经熟悉的库与框架。

Solidity 智能合约

Cosmos EVM 的智能合约开发流程与以太坊完全一致。能在以太坊上运行的合约,无需修改代码即可在 Cosmos EVM 上运行。相同的工具、相同的 Solidity、相同的模式。

开发

使用 Hardhat、Foundry 或 Remix 编写 Solidity,无需任何自定义配置。只需将你的工具指向链的 JSON-RPC 端点和 chain ID,即可开始。支持工具的完整列表请参见工具概览,合约部署的分步演练请参见快速开始指南。

部署

将标准以太坊工具指向你的链 RPC 端点,即可使用标准以太坊工具部署。部署交易会通过 JSON-RPC 或 Cosmos gRPC 接口进入,并由 EVM 模块处理。部署完成后,合约字节码会存储在链状态中,并可像其他链一样通过其以太坊地址调用。

升级

Cosmos EVM 支持所有标准 EVM 升级模式:
  • 代理模式(EIP-1967、Transparent Proxy、UUPS):将调用委托给实现合约。升级时只需替换代理中的实现地址,无需变更代理的存储或地址。
  • Diamond 模式(EIP-2535):将模块化合约拆分为多个可独立新增、替换或移除的“facet”。Diamond 会将调用路由到对应 facet,从而在无需重新部署整个合约的情况下实现细粒度升级。
任何在以太坊上可用的升级架构,在 Cosmos EVM 上同样可用。

支持的标准

Cosmos EVM 支持截至 Prague 硬分叉的所有标准 EVM opcode、EIP 和 ERC 代币接口。

EIP

以下是部分值得关注的已支持 EIP;完整列表要长得多。
EIP名称用途
EIP-155重放保护在签名中加入 Chain ID,防止跨链重放攻击
EIP-712类型化结构化数据签名可对结构化数据、可读消息和自定义 Cosmos 交易进行签名
EIP-1559动态费用基础费 + 小费模型;基础费不会被销毁,而是分配给验证者
EIP-2535Diamond 标准面向可升级合约的代理模式,支持多个实现 facet
EIP-2935历史区块哈希BLOCKHASH opcode 可访问最多 8192 个历史区块哈希(可配置)
EIP-4337账户抽象智能合约钱包可支付手续费、批量处理交易并使用自定义认证方案
EIP-7702为 EOA 设置代码可临时为 EOA 分配合约代码,以支持赞助交易和复杂认证

ERC

任何可在 EVM 上运行的 ERC 标准都兼容 Cosmos EVM。最常用的包括:
  • ERC-20 - 同质化代币: 用于货币类表示的标准接口,包含转账、授权和额度机制。
  • ERC-721 - 非同质化代币: 用于唯一资产标识、数字证书或所有权证明记录的标准。
  • ERC-1155 - 多代币标准: 在单个合约中同时支持同质化与非同质化资产,可实现批量操作并降低复杂资产系统的部署成本。

Opcode

Cosmos EVM 支持截至 Prague 硬分叉的所有 EVM opcode。完整参考请参见 evm.codes。 以下内容不支持:
  • EIP-4844 - 携带 Blob 的交易: Blob 数据及 L2 专用功能。
  • EIP-4399 - PREVRANDAO: 以 PREVRANDAO 替代 DIFFICULTY opcode 的变更。

工具

任何能够连接标准以太坊 JSON-RPC 端点的工具,都可以在 Cosmos EVM 上直接使用,无需自定义配置。
工具类别
Hardhat, Foundry, Remix合约开发
OpenZeppelin Contracts智能合约库
Forge, Hardhat测试与模糊测试
MetaMask, WalletConnect, Rabby钱包
ethers.js, viem, web3.js, wagmiJavaScript 库
Blockscout区块浏览器

JSON-RPC

JSON-RPC 接口实现了完整的以太坊规范。将任何标准工具指向你的链 RPC 端点即可工作。

以太坊 RPC 兼容性

大多数标准以太坊 JSON-RPC 方法都已支持,其中部分方法会返回占位值以保持兼容性。点击查看完整参考。
所有标准交易、查询和订阅方法都按预期工作,包括 eth_sendRawTransaction、eth_call、eth_estimateGas、事件日志与过滤器、WebSocket 订阅,以及用于追踪的 debug 命名空间。 有几点需要了解:
  • eth_gasPrice 返回 0,建议改用 EIP-1559 费用字段
  • 与挖矿相关的方法不适用(共识由 CometBFT 处理)
  • txpool 方法要求启用实验性 mempool

超越以太坊

Cosmos EVM 在完整以太坊兼容性之上增加了更多能力。这些能力都不会改变现有合约或工具的行为方式。
领域以太坊Cosmos EVM
出块时间约 12 秒1-2 秒
终局性12+ 个区块(约 3 分钟)1 个区块(约 2 秒)
重组可能发生不会发生
跨链桥接协议原生 IBC
费用分配基础费销毁分配给验证者

终局性

Cosmos EVM 交易通过 CometBFT 共识在一个区块后(约 2 秒)即具备终局性,无需等待确认,也不存在重组。任意区块要被提交,都需要验证者集合中超过 2/3 的质押权重达成一致。

Gas 与费用

Cosmos EVM 使用 EIP-1559 动态费用。与以太坊不同,基础费不会被销毁,而是分配给验证者和委托人。基础费也可以通过 NoBaseFee 参数完全禁用,同时还可以配置全链最小 gas price 下限。

地址系统

每个账户都有两种表示形式,它们引用的是同一把底层密钥:
Ethereum: 0x742d35cc6644c068532fddb11B4C36A58D6D3eAb
Cosmos:   cosmos1wskntvnryr5qxpe4tv5k64rhc6kx6ma4dxjmav

Chain ID

Cosmos EVM 使用两个彼此独立的 chain ID:Cosmos Chain ID(字符串,例如 cosmosevm-1)和 EVM Chain ID(整数,例如 9000)。它们分别配置,不同于早期 Ethermint 中两者格式耦合的方式。

预编译合约

预编译概览

内置 Cosmos 预编译及其地址的完整列表。

添加自定义预编译

为你的链启用内置预编译,或添加你自己的预编译。
所有标准以太坊密码学预编译(ecrecover、sha256 等)也同样受支持;完整参考请访问 evm.codes/precompiled。

预部署合约

Cosmos EVM 会在链状态中预置标准 EVM 基础设施合约,并使用其规范地址,包括 Create2、Multicall3、Permit2、Safe Singleton Factory,以及 EIP-2935 区块哈希存储。任何依赖这些知名地址上合约的工具都可直接运行,无需额外设置。

预部署合约

了解哪些合约会被预装,以及如何在创世时预装合约。

关键预编译地址

功能地址
质押0x0000000000000000000000000000000000000800
分发0x0000000000000000000000000000000000000801
IBC 转账0x0000000000000000000000000000000000000802
银行0x0000000000000000000000000000000000000804
治理0x0000000000000000000000000000000000000805

性能

Cosmos EVM 对 gas 估算做了优化:普通 ETH 转账会直接返回 21000 而无需模拟,复杂交易则会利用初次执行结果收紧二分搜索边界,从而显著提升整体 eth_estimateGas 性能。 Cosmos EVM 的 mempool 遵循标准以太坊行为(按 gas price + nonce 排序,每个区块允许同一账户多笔交易)。池限制、超时和优先级函数都可按链配置。可选的实验性 mempool 还支持 nonce gap 处理和自动交易提升。

资源

快速开始

端到端部署一条链以及你的第一个合约。

工具与资源

支持的工具、库和框架完整列表。

预编译概览

内置 Cosmos 预编译及其地址。

预部署合约

创世时可用的标准 EVM 合约。

Cosmos EVM provides full Ethereum compatibility for Cosmos SDK chains. Existing contracts, tools, and workflows run without modification: deploy Solidity contracts, connect MetaMask, and use the same libraries and frameworks you already know.

Solidity Smart Contracts

The Cosmos EVM smart contract development flow is identical to the flow on Ethereum. Contracts that work on Ethereum work on Cosmos EVM without code changes. The same tools, the same Solidity, the same patterns.

Development

Write Solidity using Hardhat, Foundry, or Remix with no custom configuration needed. Point your tooling at your chain’s JSON-RPC endpoint and chain ID and you’re set. See the tooling overview for a full list of supported tools, and the quick-start guide for a step-by-step contract deployment walkthrough.

Deployment

Deploy using standard Ethereum tools by pointing them at your chain’s RPC endpoint. Deployment transactions go through the JSON-RPC or Cosmos gRPC interface and are processed by the EVM module. Once deployed, contract bytecode is stored in chain state and callable at its Ethereum address like any other chain.

Upgrading

Cosmos EVM supports all standard EVM upgrade patterns:
  • Proxy patterns (EIP-1967, Transparent Proxy, UUPS): Delegate calls to an implementation contract. Upgrading means swapping the implementation address in the proxy without touching the proxy’s storage or address.
  • Diamond pattern (EIP-2535): Modular contracts split into “facets” that can be added, replaced, or removed independently. The diamond routes calls to the appropriate facet, enabling granular upgrades without redeploying the whole contract.
Any upgrade architecture that works on Ethereum works on Cosmos EVM.

Supported Standards

Cosmos EVM supports all standard EVM opcodes, EIPs, and ERC token interfaces up to the Prague hard fork.

EIPs

The following are notable supported EIPs; the full list is much longer.
EIPNamePurpose
EIP-155Replay ProtectionChain ID in signatures prevents cross-chain replay attacks
EIP-712Typed Structured Data SigningSign structured data, human-readable messages, and custom Cosmos transactions
EIP-1559Dynamic FeesBase fee + priority fee model; base fee is distributed to validators rather than burned
EIP-2535Diamond StandardProxy pattern for upgradeable contracts with multiple implementation facets
EIP-2935Historical Block HashesBLOCKHASH opcode provides access to up to 8192 previous block hashes (configurable)
EIP-4337Account AbstractionSmart contract wallets can pay fees, batch transactions, and use custom auth schemes
EIP-7702Set Code for EOATemporarily assigns contract code to an EOA for sponsored transactions and complex auth

ERCs

Any ERC standard that runs on the EVM is compatible with Cosmos EVM. The most commonly used are:
  • ERC-20 — Fungible Tokens: Standard interface for currency representations with transfer, approval, and allowance mechanisms.
  • ERC-721 — Non-Fungible Tokens: Standard for unique asset identifiers, digital certificates, or proof of ownership records.
  • ERC-1155 — Multi-Token Standard: Supports both fungible and non-fungible assets in a single contract, enabling batch operations and reduced deployment costs for complex asset systems.

Opcodes

Cosmos EVM supports all EVM opcodes up to the Prague hard fork. For the full reference, see evm.codes. The following are not supported:
  • EIP-4844 — Blob-Carrying Transactions: Blob data and L2-specific functionality.
  • EIP-4399 — PREVRANDAO: The replacement of the DIFFICULTY opcode with PREVRANDAO.

Tooling

Any tool that connects to a standard Ethereum JSON-RPC endpoint works with Cosmos EVM without custom configuration.
ToolCategory
Hardhat, Foundry, RemixContract development
OpenZeppelin ContractsSmart contract libraries
Forge, HardhatTesting & fuzzing
MetaMask, WalletConnect, RabbyWallets
ethers.js, viem, web3.js, wagmiJavaScript libraries
BlockscoutBlock explorer

JSON-RPC

The JSON-RPC interface implements the full Ethereum spec. Point any standard tool at your chain’s RPC endpoint and it works.

Ethereum RPC Compatibility

Most standard Ethereum JSON-RPC methods are supported, with some returning stub values for compatibility. Click to view the complete reference.
All standard transaction, query, and subscription methods work as expected — eth_sendRawTransaction, eth_call, eth_estimateGas, event logs and filters, WebSocket subscriptions, and the debug namespace for tracing. A few things to know:
  • eth_gasPrice returns 0 — use EIP-1559 fee fields instead
  • Mining-related methods don’t apply (consensus is handled by CometBFT)
  • txpool methods require the experimental mempool to be enabled

Beyond Ethereum

Cosmos EVM adds capabilities on top of full Ethereum compatibility. None of these change how existing contracts or tooling behave.
AreaEthereumCosmos EVM
Block time~12 seconds1–2 seconds
Finality12+ blocks (~3 min)1 block (~2 seconds)
ReorganizationsPossibleNot possible
Cross-chainBridge protocolsNative IBC
Fee distributionBase fee burnedDistributed to validators

Finality

Cosmos EVM transactions are final after one block (~2 seconds) via CometBFT consensus—no waiting for confirmations, no reorganizations possible. The validator set requires 2/3+ stake agreement for any block to be committed.

Gas & fees

Cosmos EVM uses EIP-1559 dynamic fees. Unlike Ethereum, the base fee is distributed to validators and delegators rather than burned. The base fee can also be disabled entirely via the NoBaseFee parameter, and a chain-wide minimum gas price floor is configurable.

Address system

Every account has two representations that reference the same underlying key:
Ethereum: 0x742d35cc6644c068532fddb11B4C36A58D6D3eAb
Cosmos:   cosmos1wskntvnryr5qxpe4tv5k64rhc6kx6ma4dxjmav

Chain IDs

Cosmos EVM uses two independent chain IDs: a Cosmos Chain ID (string, e.g. cosmosevm-1) and an EVM Chain ID (integer, e.g. 9000). These are configured separately, unlike legacy Ethermint where the format was coupled.

Precompiled Contracts

Precompile Overview

Full list of built-in Cosmos precompiles and their addresses.

Add a Custom Precompile

Enable built-in precompiles or add your own to your chain.
All standard Ethereum cryptographic precompiles (ecrecover, sha256, etc.) are also supported; visit evm.codes/precompiled for the full reference.

Predeployed Contracts

Cosmos EVM ships with standard EVM infrastructure contracts already in chain state at their canonical addresses — Create2, Multicall3, Permit2, Safe Singleton Factory, and EIP-2935 block hash storage. Any tooling that depends on these contracts at their well-known addresses works without extra setup.

Predeployed Contracts

Learn which contracts are preinstalled and how to preinstall contracts at genesis.

Key Precompile Addresses

FunctionAddress
Staking0x0000000000000000000000000000000000000800
Distribution0x0000000000000000000000000000000000000801
IBC Transfer0x0000000000000000000000000000000000000802
Bank0x0000000000000000000000000000000000000804
Governance0x0000000000000000000000000000000000000805

Performance

Cosmos EVM gas estimation is optimized: plain ETH transfers return 21000 immediately without simulation, and complex transactions use initial execution results to tighten the binary search bounds, making eth_estimateGas significantly faster across the board. The Cosmos EVM mempool follows standard Ethereum behavior (gas price + nonce ordering, multiple transactions per account per block). Pool limits, timeouts, and priority functions are configurable per chain. An optional experimental mempool adds nonce gap handling and automatic transaction promotion.

Resources

Quick Start

Deploy a chain and your first contract end-to-end.

Tooling & Resources

Full list of supported tools, libraries, and frameworks.

Precompile Overview

Built-in Cosmos precompiles and their addresses.

Predeployed Contracts

Standard EVM contracts available at genesis.