Shuttle: Connecting Wallets to the Cosmos

Delphi Labs
4 min readNov 17, 2022

--

Introduction

As the Cosmoverse expands, so does the number of wallets and app chains in the ecosystem. With no standard for wallet interfaces, integrating specific wallets and app chains into a Dapp’s frontend is time-consuming and laborious.

Shuttle package allows you to connect any combination of Cosmos wallets and app chains to your Dapp’s frontend with just a few lines of code. Simple to integrate, the package abstracts away the logic of connecting to a particular wallet or app chain, and makes adding or removing support for various chains painless.

Initially developed by Delphi Labs, Shuttle is open-source software designed to turn wallet connections into a plug-and-play Lego brick for Cosmos Dapps.

Key Links:

Wallets as a Dapp Primitive

When working with Dapps, we are primarily working with wallets. At the protocol level, anyone can query or execute messages to an app chain or smart contract directly. But the core feature that separates a Dapp from the protocol is the wallet functionality that sits on top. For example, in a typical Dapp, the first thing a user is expected to do is to connect a wallet.

Currently, if a Cosmos Dapp wants to integrate multiple wallets, for example Keplr and TerraStation, the frontend will need to contain duplicate code. More specifically, for each contract message that a user can execute, at least two corresponding broadcast and signing messages will be needed. For example, when a user is connecting a wallet, the Dapp will need to contain separate logic to handle requests for each of the two potential wallets.

The more wallets a Dapp wants to support to grow its user base, the more logic the Dapp will need for each contract call. As a result, the most popular choice with support for the most chains tends to get selected — MetaMask for Ethereum, Keplr for Cosmos — and entire frontend Dapps get built using these tools.

Once a Dapp chooses to route their application logic through a specific wallet, like Keplr or TerraStation (or even MetaMask in Ethereum), they are committed to a specific package, tooling, and implementation. Usually, if a Dapp is simply using Keplr and only interacting with Keplr connected chains, this may not seem like a huge problem. However, entire Dapps are predicated on the tooling of third-party projects and are currently not built in a wallet-agnostic manner. This can can make it harder for some Dapps to reach all their potential users. For example, if anything were to go wrong with Keplr, Cosmos Dapps that rely exclusively on Keplr would be impacted. This has also led to some stifling of growth and innovation in the wallet sector as entire applications become locked into established packages.

Another example is TerraStation. Arguably, Terra had one of the most active developer communities with thriving smart contract applications in the Cosmos ecosystem. After the collapse, many projects opted to deploy their contracts on separate CosmWasm chains. While their contracts remained largely unchanged, the tooling used by their Dapps is entirely different and has required a complete re-piping of their wallet integration logic from TerraStation to Keplr. This not only costs developer resources, but it doesn’t produce a wallet-agnostic solution that prevents the problem in the first place.

So what would it look like to build wallet-agnostic tooling? And what are some potential upsides?

Enter the Shuttle package.

Instead of locking your Dapp into a specific wallet package, Shuttle takes a top-down approach and abstracts away the logic of connecting to a particular wallet or app chain. For example, when a user connects their wallet with Shuttle, they can choose a specific wallet and chain to connect to. In the background, the Dapp will only need to handle a single request (regardless of the number of wallets or app chains a Dapp supports). Users can choose their wallets and chains (i.e. Keplr + Mars Hub or Terrastation + Terra), and Shuttle will create the necessary routing. Adding or removing support for various chains becomes simple to integrate, leaving the Dapp logic agnostic itself. Not only does this drastically reduce the need for redundant code, but it builds more robust systems that are not susceptible to third-party failures.

A Community Project

Shuttle is an open-sourced package to be developed by the Cosmos community under the GPL v3 license. This ensures everyone can benefit from new contributions. For example, a specific project team may not have time to support an expanding array of wallets and chains. If they’re connected to the Shuttle package, though, they can benefit from the efforts of other devs. If a second Dapp integrates a new wallet or chain into the package, both Dapps will now have access to the new wallet or chain. The original Dapp didn’t perform any new work, but their Dapp can now support a new wallet or chain, and new users can now connect. In virtue of sharing an open-sourced package, the original Dapp benefits from the contributions of the community.

Future Steps

Shuttle in its current version should be regarded as an alpha release. As a community project, plenty of work is still left to be done. Most notably:

  • WalletConnect integration
  • Additional wallet providers
  • Additional chain information for the docs
  • Support for Vuejs / Svelte
  • Add real test coverage

Want to learn more about Shuttle? Start your exploration now: https://shuttle.delphilabs.io/

DISCLAIMER

Shuttle is an experimental technology. This article does not constitute investment advice.

--

--

Delphi Labs

The next evolution of incubation leveraging our hivemind of expertise at @delphi_digital