Keplr, Explained: “Coin Type 118”

Team Chainapsis
Chainapsis
Published in
6 min readDec 16, 2021

Introducing a new blog series expounding on IBC and how we’re shaping it as a community

Introduction

It’s exciting to be a part of a community that grows exponentially, and when it comes to building the world’s leading IBC wallet, nothing is more important than making sure we’re inclusive to all the great projects that users love and support.

In efforts to keep the community informed, we’re launching the Keplr, Explained blog series to break down some of the intricacies of the IBC development process that cause things to take time, resources, and/or a lot more collaboration than you’d expect. We invite the community to learn more about the technology behind these great projects with us.

In today’s post, we’ll cover BIP44 coin types, why it matters in the interchain universe, how it affects interchain UX, and what the implications are for now and down the road.

From Mnemonic Phrase to Address: Why ‘Coin Types’ Matter 📝

Crypto addresses are always derived deterministically. In simple terms, determinism means that as long as all the variables are the same, the same mnemonic will always generate the same address.

For example, if you used the exact same mnemonics but a different address was generated, there were variables that were different from how the old address was initially generated.

Most blockchains follow the BIP44 standard, which defines a ‘coin type’ as one of the variables. Cosmos addresses are also generated using this same BIP44 standard for address derivation.

Satoshi Labs’ SLIP-44 registry, which lists the coin types for various blockchains, is the current industry standard for assigning coin types. For example, Bitcoin (BTC) is coin type 0 and Atom (ATOM) is coin type 118. A big source of confusion around address derivation has been around the coin type in the interchain.

While there are multiple reasons for coin types to exist, two main reasons are:

  • To prevent a ‘replay attack,’ where a signed transaction submitted on one chain is submitted to another blockchain that treats it as a valid transaction.
  • To prevent privacy issues where knowing someone’s Bitcoin address allows you to also know their Litecoin address.

By designating one coin type per blockchain, and using that number as a variable in the process of generating the address, the same mnemonic will create the same address on the per-blockchain (which affects the signed transaction), but not across different blockchains. (It’s technically a ‘public key’ not an ‘address’ but we’ll skip over that detail for simplicity sake.)

Another important part to note is that the SLIP-44 registry is enforced by social consensus.

The Thing about Social Consensus 🤝🏼

Social consensus is one of the most challenging yet crucial mechanisms in crypto. As a tool, standardization goes a long way in simplifying our chaotic, decentralized crypto ecosystem.

Similar to wearing socks and sandals, there’s no direct penalty if you don’t follow social norms, but chances are there are lots of things to gain by following it. But if you have a really good reason (like this, I guess 🙄), social consensus is just that–a social norm people accept for its convenience of having a standard.

Just as acceptance of social consensus is opt-in, so is the enforcement of social consensus. In crypto, it appears that wallets are the primary ‘enforcement agency’ of address derivation paths.

For example, Ledger, the producer of the world’s most popular hardware wallet, enforces the BIP44 coin type by making sure the blockchain’s Ledger app has a designated coin type. You can’t launch a Ledger app that supports both Cosmos Hub’s 118’ coin type and Terra’s 330’ coin type–even though it could be possible from a purely technical point of view.

To note, currently, Keplr only supports the Cosmos Ledger app (coin type 118), but various coin types for mnemonics are stored locally on the user’s devices.

Here Comes the Interchain ⛓️

Cosmos is built around the ethos of ‘sovereign, interoperable, application-specific blockchains.’

I’d like to emphasize two words: sovereign and application-specific. Because these are the two characteristics that make the coin type issue more complex in Cosmos compared to other traditional single-chain ecosystems.

Where there’s a clear distinction between a smart-contract application vs. base-layer protocol in ecosystems such as Ethereum and Solana, the distinction between the two are not so cut-and-dry in Cosmos.

This is even more problematic because the BIP44 standard was created at a time where cross-chain interactions didn’t exist (note: 1 BTC was $400 at the time).

Today’s interchain looks more like a forest, where the flora of its ecosystem are intertwined with each other, rather than the potted plant garden we expected. Interactions across blockchains, and therefore, coin types, are now common.

So, How Does Keplr Deal with Coin Types? 🧐

If Keplr was to deal with just one blockchain ecosystem, considering coin types wouldn’t be such a big deal. However, when considering IBC and interoperability, coin types can get tricky.

Some blockchains within the Cosmos ecosystem choose to identify with its own coin type–which is completely okay! It’s just that the user and the wallet need to know what this all means.

Currently, Keplr derives all addresses via directly creating/importing a mnemonic phrase in the defined SLIP44 coin type (i.e. Cosmos Hub 118, Terra 330, Starname 234, etc).

However, as Keplr only supports the Cosmos Ledger app, addresses imported via Ledger are always derived using the Cosmos Hub’s 118. As long as Ledger mnemonic phrases are not imported directly into Keplr, and vice versa, this isn’t a major issue–and please don’t do this as this is extremely bad security practice.

We currently do not have a plan to support other Ledger apps (for more context, check out my talk at Cosmoverse 2021). We believe that in most cases, there are enough commonalities across Cosmos SDK chains where a separate Ledger app is not a necessity.

Furthermore, considering Ledger Nano S (the most affordable instant security upgrade any user can get) can only fit about 3 Ledger apps, interchain UX will become unsustainable if each Cosmos chain required its own Ledger app in the world of hundreds of blockchains.

Coin Types in the Future 🔮

Applying standardization will always be complex when considering the sovereignty of Cosmos — it’s a balancing act between providing the best UX and being as interoperable as possible. Like any standard, everything has its pros and cons, and the sovereignty that Cosmos guarantees means each chain gets to choose how they want to go about their coin types depending on their preference.

Standardization in blockchain is a long winded process involving multiple stakeholders with both technical and UX implications. While Keplr recommends chains to use the 118’ coin type, the question on how that should be enforced is one where there is no right answer to.

We’re seeing IBC grow at an exponential rate and these types of considerations will only become more critical over time. What standards should be applied in IBC? Who should set them and who should enforce them? While we build, the Chainapsis team runs into these considerations increasingly often. If there is one clear answer amongst these questions, it’s that expecting the average user to understand these nuances is unrealistic. The builders should standardize it for the users.

As we continue to mature together as a community, we encourage you to learn a little more about the technologies behind the projects you enjoy and to consider these implications as well. More than likely the IBC ecosystem will be pretty different in just 5 years — the decisions we make today will shape how we get there.

Keplr, Explained is a blog series published by the Chainapsis team with aim to equip the Cosmos community with more understanding about IBC technology, its development, and the teams behind them.

Any questions or comments? Reach us at Keplr Help Desk.

--

--