此架构使用户既可执行 Cosmos 格式交易,也可执行 EVM 格式交易;使开发者能够通过 IBC 跨链扩展 EVM dApp;并支持来自多个独立来源的代币与资产。 Cosmos EVM 通过以下关键能力实现这些特性:
  • 利用 Cosmos SDK 实现的 模块 及其他机制。
  • 实现 CometBFT 的应用区块链接口(ABCI)来管理区块链。
  • 将 geth 作为库使用,以促进代码复用并提升可维护性。
  • 暴露完全兼容 Web3 的 JSON-RPC 层,用于与现有以太坊客户端和工具(MetaMask、Remix 等)交互。
这些特性使开发者能够复用现有以太坊生态中的工具和软件,无缝部署可与 Cosmos 生态系统 其他部分交互的智能合约。

Cosmos SDK​

Cosmos EVM 充分发挥了 Cosmos SDK 的可组合性与模块化能力。它包含 Cosmos SDK 的标准模块,并与 EVM 专用模块协同工作。你可以查看模块列表,了解各个模块分别负责的功能。

CometBFT 与 ABCI​

CometBFT 由两个核心技术组件构成:区块链共识引擎和通用应用接口。共识引擎确保所有机器都以相同顺序记录相同的交易。该应用接口称为应用区块链接口(ABCI),使交易能够使用任意编程语言进行处理。 CometBFT 已演进为一种通用型区块链共识引擎,可承载任意应用状态。由于它能够复制任意应用,因此可作为其他区块链共识引擎的即插即用替代方案。Cosmos EVM 就是一个示例:它作为 ABCI 应用,通过 CometBFT 的共识引擎替代了以太坊的权益证明共识。 另一个基于 CometBFT 构建的加密货币应用示例是 Cosmos Hub。CometBFT 通过在应用进程与共识进程之间提供简洁的 API(即 ABCI),简化了区块链设计。

EVM 兼容性​

Cosmos EVM 通过实现多个组件来提供 EVM 兼容性,这些组件共同支持全部 EVM 状态转换,同时确保与以太坊一致的开发者体验:
  • 将以太坊交易格式实现为 Cosmos SDK 的 Tx 与 Msg 接口
  • 为 Cosmos Keyring 支持以太坊的 secp256k1 曲线
  • 用于状态更新与查询的 StateDB 接口
  • 用于与 EVM 交互的 JSON-RPC 客户端
大多数组件都在 VM 模块 中实现。不过,为了实现无缝的开发者体验,仍有部分组件在模块之外实现。 若要进一步了解 Cosmos EVM 如何作为一条 Cosmos 链实现 EVM 兼容性,可继续阅读以下概念:

贡献​

你可以参考 Cosmos EVM 贡献指南,通过 GitHub issues 为 Cosmos EVM 开源代码库做出贡献。
This architecture enables users to perform both Cosmos and EVM formatted transactions, allows developers to scale EVM dApps cross-chain via IBC, and supports tokens and assets from multiple independent sources. Cosmos EVM enables these key features by:
  • Leveraging modules and other mechanisms implemented by the Cosmos SDK.
  • Implementing CometBFT’s Application Blockchain Interface (ABCI) to manage the blockchain.
  • Utilizing geth as a library to promote code reuse and improve maintainability.
  • Exposing a fully compatible Web3 JSON-RPC layer for interacting with existing Ethereum clients and tooling (MetaMask, Remix, etc.).
These features enable developers to leverage existing Ethereum ecosystem tooling and software to seamlessly deploy smart contracts that interact with the rest of the Cosmos ecosystem.

Cosmos SDK​

Cosmos EVM enables the full composability and modularity of the Cosmos SDK. It includes standard modules from the Cosmos SDK that work side by side with EVM-specific modules. Check out the list of modules to get an overview of what each module is responsible for.

CometBFT & ABCI​

CometBFT consists of two core technical components: a blockchain consensus engine and a generic application interface. The consensus engine ensures that the same transactions are recorded on every machine in the same order. The application interface, called the Application Blockchain Interface (ABCI), enables transactions to be processed in any programming language. CometBFT has evolved into a general-purpose blockchain consensus engine that can host arbitrary application states. Since it can replicate arbitrary applications, it can be used as a plug-and-play replacement for the consensus engines of other blockchains. Cosmos EVM is an example of an ABCI application replacing Ethereum’s Proof-of-Stake consensus via CometBFT’s consensus engine. Another example of a cryptocurrency application built on CometBFT is the Cosmos Hub. CometBFT simplifies blockchain design by offering a simple API (the ABCI) between the application process and consensus process.

EVM Compatibility​

Cosmos EVM enables EVM compatibility by implementing various components that together support all the EVM state transitions while ensuring the same developer experience as Ethereum:
  • Ethereum’s transaction format as a Cosmos SDK Tx and Msg interface
  • Ethereum’s secp256k1 curve for the Cosmos Keyring
  • StateDB interface for state updates and queries
  • JSON-RPC client for interacting with the EVM
Most components are implemented in the VM module. However, to achieve a seamless developer experience, some components are implemented outside of the module. To learn more about how Cosmos EVM achieves EVM compatibility as a Cosmos chain, explore the following concepts:

Contributing​

You can contribute to the Cosmos EVM open-source codebase through issues on GitHub using the Cosmos EVM Contributor Guideline.