We've covered several Layer 2 sidechains before:


But this time we will do into the exciting new world of Cosmos. Many of the most interesting projects are currently building in the ecosystem and you can expect a lot to happen here in the near future. One of those is Evmos which is more than just a layer 2.

Cosmos Meme

What is the Evmos?

Historical context: The launch plans and Ethermint/Tharsis names below describe 2021. Evmos now identifies itself as a Cosmos SDK EVM chain using CometBFT. Use the maintained project repository and endpoint registry for current development.

Evmos is a Proof-of-Stake blockchain which will be fully compatible and interoperable with Ethereum. At its core, it's an open-source library called Ethermint and maintained by Tharsis which anyone can use to enable EVM compatibility within a Cosmos chain. Evmos will be it's own Cosmos chain meant as the first of many EVM-compatible chains running in the Cosmos ecosystem.


You can send regular Ethereum transactions to the Evmos Chain. It has implemented a fully functioning EVM on top of the Cosmos SDK. 

The Cosmos-SDK is an open-source framework for building public Proof-of-Stake as well as permissioned Proof-Of-Authority blockchains. With the Cosmos SDK one can easily create custom blockchains from scratch that can natively interoperate with each other. In fact many projects like we at Injective Protocol are utilizing the power of this SDK already.

The SDK is envisioned as an npm-like framework to build secure blockchain applications on top of Tendermint which is the Cosmos POS consensus algorithm with instant finality fast throughput. SDK-based blockchains are built out of composable modules, most of which are open source and readily available for any developers to use. Anyone can create a module for the Cosmos-SDK, and integrating already-built modules is as simple as importing them into your blockchain application.

This is exactly what Ethermint is enabling. A module which anyone can integrate in their Cosmos chain to enable EVM compatibility. All code for Evmos can be found here and Ethermint here. The testnet for Evmos went live just recently.

Why choose Evmos?

Historical context: IBC support does not make every Ethereum and Cosmos application automatically interoperable. The relevant chain modules, channels, token representations and application-level messaging must support the intended interaction.

  • High throughput via Tendermint Core

  • Instant finality

  • Decentralization through DAO governance

  • Fully EVM compatible

  • Scalability and connectivity for the Inter Blockchain Communication Protocol (IBC), this means your Dapp will be able to communicate with any Cosmos chain with enabled IBC!

  • Fairer to users with transactions being included on a first in first out (FIFO) fashion

  • Evmos supports all Ethereum Signers up to the latest go-ethereum version (London, Berlin, EIP155, Homestead and Frontier).

How Ethermint enabled the EVM

The early testnet used the Photon name. Current Evmos code defines EVMOS for mainnet and tEVMOS for testnet, both with 18 decimal places. Keep that distinction when reading the launch-era screenshots, and obtain network settings from the official endpoint registry.

The whole Cosmos world is exciting, but we are not on cosmosdeveloper.com, so let's get to the Ethereum part.

How to deploy to Evmos

Deploying to the Evmos Chain is straight-forward. If you're using Truffle, simply add the Evmos Chain network configuration like this:

javascript
// Legacy Truffle configuration. HDWalletProvider and mnemonic are defined by the surrounding project.
module.exports = {
  networks: {
    evmos_testnet: {
      provider: () => new HDWalletProvider(mnemonic, "https://evmos-testnet.lava.build"),
      network_id: 9000,
    },
  },
};

You'll also need funds in the chain of course. For the testnet you can use the faucet here. At the time of this writing this faucet is not working and only the faucet in the Evmos Discord channel is working.

To get your correctly formatted Ethereum address for the faucet, install evmosd: (requires Go 1.17+)

Terminal / configuration
# Historical 2021 CLI source installation; not a current version pin.
# For a new installation, use the maintained evmos/evmos release and its prerequisites.
$ git clone https://github.com/tharsis/evmos.git
$ cd evmos
$ make install

Now you can run evmosd and pass your Ethereum address to it:

Terminal / configuration
evmosd debug addr 0x14574A6DFF2DDF9E07828B4345D3040919AF5652
  Address: [20 87 74 109 255 45 223 158 7 130 139 67 69 211 4 9 25 175 86 82]
  Address (hex): 14574A6DFF2DDF9E07828B4345D3040919AF5652
  Bech32 Acc: evmos1z3t55m0l9h0eupuz3dp5t5cypyv674jj7mz2jw
  Bech32 Val: evmosvaloper1z3t55m0l9h0eupuz3dp5t5cypyv674jjn4d6nn

The 'Bech32 Acc' result will be what you need for the faucet.

How to onboard users to your Evmos Dapp

1. Choice of wallet

These days you have much more than just MetaMask as possible wallets to support available. Take a look at Yearn Finance for example. They are supporting 11 different wallets alone at the time of this writing.

Wallet Options
MetaMask confirmation to add Binance Smart Chain, showing chain ID 56 and a warning to verify the network details.

2. MetaMask example live in action

MetaMask can request a custom network through its wallet API. The screenshot below is a historical Binance Smart Chain prompt, reused as a generic illustration. It does not show Evmos settings, and PancakeSwap is not an example of adding Evmos. Use the Evmos values below and confirm them against the official endpoint registry.

3. How to add Evmos automatically for users

Request network addition with wallet_addEthereumChain, then request switching separately if required. A wallet may reject either request, and adding a network alone does not make it active.

javascript
// Evmos Testnet: chain ID 9000 (decimal).
// Documented testnet metadata; confirm current endpoint availability before use. Mainnet is a different chain, ID 9001.
const params = [
  {
    "chainId": "0x2328",
    "chainName": "Evmos Testnet",
    "rpcUrls": [
      "https://evmos-testnet.lava.build"
    ],
    "nativeCurrency": {
      "name": "tEVMOS",
      "symbol": "tEVMOS",
      "decimals": 18
    }
  }
];

try {
  await ethereum.request({ method: "wallet_addEthereumChain", params });
  // Adding a network does not guarantee that it is selected.
  await ethereum.request({
    method: "wallet_switchEthereumChain",
    params: [{ chainId: params[0].chainId }],
  });
} catch (error) {
  // The wallet may reject either request; keep the UI on its actual chain.
  console.error("Network request was not completed", error);
}

How to transfer tokens from other chains to Evmos?

This is currently not yet possible for the testnet, but will be enabled later through two separate mechanisms:

Gravity Bridge

The Gravity bridge is a project enabling ERC-20 transfers from Ethereum to Cosmos and vice-versa.

IBC

IBC is an interoperability protocol for communicating arbitrary data between arbitrary state machines like Cosmos SDK blockchains.

Evmos is an EVM-compatible Cosmos chain with its own consensus. It can connect ecosystems through bridges and IBC integrations, but that does not make it an Ethereum rollup or let it inherit Ethereum’s security merely by being connected. Use the maintained Evmos architecture reference when evaluating the network for an application.