Warping Ethermint through the Stargate

Warping Ethermint through the Stargate

Authored by Timothy Hao Chi Ho

Commencing.

What is Stargate?

With the much anticipated upgrade to the Cosmos Software Development Kit (SDK) v0.40.0 aka "Stargate", the Cosmos Network will finally realize the original vision of an "Internet of Blockchains". The arrival of the first version of the Inter-Blockchain Communication (IBC) Protocol will enable applications from different blockchains within the Cosmos ecosystem to interact with each other. Additionally, with the eventual release of the fully featured version of IBC, bridges and peg zones between sovereign blockchains (even those not backstopped by Tendermint consensus) can finally be built, and true interoperability for Cosmos and beyond - akin to the TCP/IP layer of the internet - can be achieved.

As much attention as IBC (rightfully) deserves, Stargate comes with additional benefits for the Cosmos ecosystem, including:

  • Better performance with migration to Protocol Buffers ("Protobuf") serialization library

  • Faster node syncing through State Sync

  • And a chain upgrade module that will allow validators to coordinate a chain software upgrade that's faster and fully automated

Warp Phase: Ethermint

Since Stargate touches almost every aspect of the Ethermint codebase, our team became one of the first in the Cosmos ecosystem to begin work for supporting the release. With many new features being implemented that include state and API breaking changes, we had to be meticulous in priming the network for the upgrade.

We can start with IBC - out of the box, Ethermint will support fungible token transfers between zones within the Cosmos ecosystem. As Stargate matures and the Cosmos team adds the ability to include non-fungible token transfers as well as other packet types, we will also gradually phase in support for those types of messages along IBC channels. Ethan Buchman - co-founder of Cosmos and CEO of Informal Systems - wrote a great tweet storm explaining how IBC works in more detail here.

Outside of IBC, we can say with confidence that the Ethereum Virtual Machine (EVM) is one of the most complex applications/modules to migrate to Stargate, let alone to build as a standalone SDK module!

A lot of work has gone into creating feature parity with Ethereum that is compatible with the new update, including key generation and account management. Compatibility with Ethereum tooling, both before and after Stargate, has been one of the trickier things to implement, as the way accounts and keys are handled in Cosmos vs. Ethereum are markedly different. For most Cosmos apps, migration to Stargate would have been simple because most modules don't use custom key algorithms - they use Tendermint's native ed25519 keys. However, Ethermint uses custom secp256k1 keys from the go-ethereum library, so we had to migrate that logic for the new Stargate keyring interface.

The other big piece to reworking Ethermint was adding support for protobuf. All Cosmos zones - including Ethermint - are required to upgrade the Tendermint consensus module to v0.34 in order to be compatible with the Stargate upgrade. Tess Rinearson, VPE at Interchain GmbH, discusses this upgrade in detail with her article Tendermint 0.34, Protocol Buffers, and You. As the title of Tess' article implies, the upgrade primarily concerns migration of the protocol's serialization library for encoding messages from Amino to protobuf. The promise of protobuf includes improvements to stability, maintainability, performance, and interoperability!

To facilitate this migration, we had to refactor a lot of the Ethermint codebase. New .proto and configuration files have had to be written to define data types and how they get encoded. Although this work was not difficult, it required carefully combing through the code to ensure all types were appropriately migrated.

Additionally, new gRPC services have been introduced for querying as part of the migration, and as a result we are deprecating the REST endpoints. Both REST and gRPC are architectural formats for delivering API's. Although REST provides human readable formats, it carries a larger, more inefficient payload than gRPC, which is utilized in protobuf. However, by implementing gRPC, we still allow the software to be able to accept JSON RPC requests. This is a slight backend change to the handling of the remote procedural call (RPC) request, but is nevertheless an important one for implementing protobuf encoding. It delivers the overall performance enhancements writ large!

We have also been intending to remove the need for multiple messages to process an Ethermint transaction, which caused issues with encoding and decoding. Pre-Stargate, Ethermint supported two different message types for different purposes - one, for signed Ethereum transactions; and two, for unsigned call transactions. Post-Stargate, we have consolidated this to a single message type that includes both transactions. Since we had to refactor our codebase for Stargate anyway, this was a moment in time where it made sense to simplify messaging within the Ethermint interface.

The crux of all this work, at the end of the day, will be hidden underneath layers of code. Ethermint end users won't be able to discern any difference with the exception of drastic improvements in performance thanks to protobuf encoding. For Ethermint developers and node operators, it also means faster node syncing thanks to State Sync, and painless software upgrades thanks to the new chain upgrade module that comes with Stargate! And with the addition of IBC, Ethereum devs and end users will be able to benefit from interoperability within the Cosmos ecosystem.

Next on the roadmap for Ethermint

Once the dust settles on the Stargate upgrade and Ethermint emerges from the warp phase in stronger condition, we will move forward with our incentivized testnet "Game of Ethermint", which is the next big deliverable from our second grant awarded via the Interchain Foundation.

Preparing for this deliverable will require a series of smaller steps, beginning with benchmarking Ethermint vs. Geth again to analyze performance pre-and-post Stargate. Thereafter, we will optimize the platform based on the results of the tests. A critical next step before we can move onto the full incentivized testnet is finalizing the tokenomics of Ethermint. Once we confirm those details, we will be sure to share this with the community. Finally, we can then move onto Game of Ethermint, with the expected completion of these milestones to be done by the end of Q1, 2021.

Upon completion of the incentivized testnet, we will launch Ethermint as a fully productionized Cosmos Zone. This will be a monumental milestone. Ethereum developers and code can be deployed onto Ethermint, and interchain access will be opened up across the entire breadth of the Cosmos and Ethereum ecosystem.


Acknowledgements

Thank you to: Lerna Jabourian, Colin Schwarz, Elizabeth Binks, Daniel Choi, Federico Kunze Küllmer, Stu Peters, Amer Ameen, Freddy Li, Greg Markou, and Aidan Hyman. Your contributions were invaluable to the making of this article.

Get Involved

If you are interested in getting involved and contributing to the project, check out our Github. If you are already building or intend to start building your project on Ethermint, become a validator, or collaborate with the project in any other way, please get in contact with one of our Ethermint team members on Chainsafe's [Discord](https://discord.gg/kbby5K4), Cosmos's Discord under #Ethermint channel or email info@chainsafe.io. We would love to know more about you, your team and your project!

For more details on Ethermint, the testnet and how to join, please head to our documentation site.

Learn more about ChainSafe by visiting our website, through our Medium, via Twitter, or by visiting the ChainSafe GitHub.