crypblizz

Posted on Aug 04, 2022Read on Mirror.xyz

Understanding WalletConnect

Mobile Curiosity

Spent two years building web 2.0 mobile apps and was recently wondering why web3 wallet adoption is not higher. Desktop wallets (i.e. Metamask and Phantom) are a great introduction to the blockchain. However, it is inevitable that mobile wallets will have to be more popularized.

Rainbow, Zerion, Trust Wallet, and other wallets are paving the way for mobile-first wallet interactions. But under the surface, they are all powered by WalletConnect so I decided to dive deeper.

What is WalletConnect?

WalletConnect is an open-source protocol that connects various wallets and decentralized applications (dApps). By scanning a QR code or clicking a deep link, WalletConnect establishes a secure and encrypted connection. This is done without sharing your private key. Since 2018, over 170 wallets have been integrated with them, and is the common standard for wallet connection.

Previous to WalletConnect, developers were writing separate authorization code for wallet connections. So having a unified protocol that is open-sourced allows users to connect to web3 is a win.

How it all works?

Note: This information pertains to v1, as is susceptible to change in their new v2 version. See Docs.

Currently, the WalletConnect protocol has references implementations for (written in TypeScript):

  1. Client
  2. Bridge Server
  3. Push Server

Establishing Connection

To establish a connection between the dApp and Wallet, the client and bridge servers interface together. The push server is an optional service for push notification subscriptions.

Source (Wallet Connect Docs)

The above diagram from their docs illustrates this process by:

  1. The dApp wants to connect and posts a SessionRequest → Bridge Server.
  2. dApp uses the WalletConnect Standard URI format (EIP-1328) for an encrypted payload → Bridge Server.
  3. Wallet read the URI through QR Code / deep linking and decrypts the connection request payload → Bridge Server
  4. Bridge Server → Wallet displays to request details to the user. Either approved or rejected. If rejected, an error message is thrown.
  5. If approved, the dApp will receive the information regarding chainId and account.

Interfacing with other JSON-RPC Calls

Once the wallet and dApp are authenticated, the Bridge Server allows any JSON-RPC call requests. The push server for notifications can also be utilized here.

Source (Wallet Connect Docs)

Libraries / Implementations

WalletConnect has various client SDK for Swift, Kotlin, and Javascript/Typescript.

WalletConnect Infrastructure / Importance

After examining how WalletConnect is the middleware for web3 wallets and dApps, I started to realize its importance. If the App Store or Google Playstore is not going to support native wev3 products, the best gateway is WalletConnect.

They are the “narrow waist” for the web3 Ecosystem. As outlined by Nichanan Kesonpat in “WalletConnect: The Narrow Waist Protocol Between Wallets & Dapps”, they are akin to the TCP/IP of the web3 era. They are agnostic to chains, wallets, and dApps which is what TCP allowed for the Internet era.

Source Nichanan Kesonpat (1kx)

Current Github

Looking at their current Github also helped to provide a snapshot of what is being built:

  • WalletConnectKotlinV2
  • WalletConnectSwiftV2
  • Walletconnect-monorepo
  • Gotrue
  • Kotlin-walletconnect-lib
  • Walletconnect-utils
  • Web3modal
  • WalletConnectUnity
  • WalletConnectSwift

This assumes that V2 is of high priority whilst maintaining existing libraries /tools such as Web3Modal and Gotrue are being worked on.

V2

At the end of last year, Walletconnect V2 features were announced and it is being released in Q3 2022. As detailed in the official article, V2 introduces:

  • Chain agnostic interface
  • Multi-chain support
  • Pairing and session separation
  • JSON-RPC permissions
  • Improved session management
  • Decentralized message relaying

With V2, they have acknowledged that the world is multi-chain (i.e. Cosmos, Solana, and Polkadot). Users from various ecosystems will be able to access dApps. Additionally, they have improved the login-session pattern and are working on decentralized chat. It will be interesting to see if web3 chat takes off.

Future of WalletConnect

It was interesting to dive deeper into a core infrastructure protocol. With V2, it will be great to see more multi-chain wallets and dApps, and web3 messaging.


Resources

Other Companies / Mainly wallets talking about WC


My Twitter