Make the Connection Simpler:
The Way to Optimize Mobile DEX and Wallets

Hamber
11 min readOct 30, 2023

--

Introduction

The Rise of DApp on Mobile Devices

With the increasing processing power and popularity of mobile devices, mobile platforms have gradually become the primary digital interaction platform for users.

  • The Close Relationship Between Web3 and DApp: Web3 is the main tool for interacting with blockchains, especially Ethereum. With the continuous improvement of the Web3 library, developers can develop DApp on mobile devices more conveniently.
  • Advances in Encryption Libraries: Encryption libraries provide critical security for DApp, ensuring the confidentiality and integrity of transactions and communications.
  • Standardization of Wallet Connection Protocols: With the introduction of the WalletConnect V2 protocol, DApps can more easily connect and interact with a variety of wallets.
  • Synergistic Effects of Infrastructure: The maturity of the Web3 library, encryption libraries, and wallet connection protocols is not isolated. The synergy between them has created a healthy and stable ecosystem for mobile DApps, making development and use more convenient.
  • Cross-platform Challenges: Although the infrastructure is relatively mature, there are still unique challenges such as screen size differences and operating system variations, which pose new requirements for the design and implementation of DApps.

The Importance and Challenges of Wallet Connection

Security and Trust

  • Established Wallets: For many users, mature and widely accepted wallets like MetaMask offer a higher level of security. This trust is based on long-term market validation and positive feedback from the community.
  • Comparative Risks: In-house developed wallets might face issues like insufficient security reviews, potential vulnerabilities, or lack of community trust, all of which could raise concerns among users.

Autonomy and Choice

  • Diverse Wallet Choices: DApp allows users to connect to different wallets, giving them the choice to select a suitable wallet based on their needs and preferences.
  • Emphasizing User Centrality: Users are no longer confined to a single wallet or platform, ensuring their central position within the entire ecosystem.

Connection as the Crucial First Step

  • Gateway to DApp: In the process of users accessing a DApp, the wallet connection plays a pivotal role. Only after a successful connection can users further explore and interact.
  • Setting the Tone: A smooth and straightforward connection process sets the tone for the entire user experience, while a cumbersome or complex process could lead to user drop-off.

Existing Challenges

  • Unstable Connection: At times, due to network or other reasons, the wallet connection might experience interruptions or instability.
  • Version Incompatibility: There might be compatibility issues between different versions of wallets and DApps, resulting in failed connections or use.
  • Insufficient User Education: Even though blockchain technology is gradually gaining attention, many users still know very little about how to connect and use wallets.

Analysis of the Wallet Connection Experience with Major DEX on Mobile

From DApp to DEX

Why Focus on DEX Connection Experience?

From our earlier discussion, we already delved into the importance and challenges of mobile DApp infrastructure and wallet connection.

But, some might ask, why are we specifically looking at DEX connection experience next?

The answer is simple: DEX is one of the most typical applications of mobile DApp currently.

Unlike traditional DApps, DEX not only requires users to connect their wallets but often demands transaction signature confirmations, making its user experience more intricate and challenging.

Thus, by analyzing the mobile DEX wallet connection experience, we can grasp real-world DApp scenarios and provide valuable insights for other DApp applications.

dYdX

Before we dive into various mobile DEX wallet connection experiences, we must mention dYdX.

In June 2022, dYdX announced its v4 would introduce its independent blockchain based on Cosmos SDK and Tendermint PoS.

Their motivation was the speed of Ethereum L2 and other centralized problems.

The team believes this move will enhance performance and achieve full decentralization by year-end.

As the leading brand for order-book perpetual contract DEX, dYdX’s influence is significant.

However, why aren’t we focusing on dYdX for this comparison?

The answer again is simple: dYdX’s mobile application currently only supports iOS, without an Android version.

For users wanting to experience dYdX on Android, this is undoubtedly a letdown.

Intriguingly, even though dYdX openly states on their official website they are hiring senior Android engineers, offering a hefty salary range from $175K to $270K, the Android version hasn’t seen its launch yet.

ApolloX

ApolloX offers users two trading modes:

  • ApolloX V1 order book perpetual contract, offering lower fees and an experience akin to centralized exchanges.
  • ApolloX V2 on-chain perpetual contract, giving users self-custody and increased transparency.

Binance Labs funded ApolloX’s seed round, receiving support from industry players like Kronos Research, Lingfeng Capital, and SafePal.

With this investment, ApolloX plans to expand its product line and shift towards DAO governance.

However, there’s a primary issue for Android users with ApolloX.

When implementing the wc protocol, they simplified the deeplink, using wc:// for system jumps, causing every application responding to that URL scheme, even their own app, to be activated.

This might lead to some wallets not being able to connect, yet they’d still appear in the selection list, causing user confusion and inconvenience.

ApeX

ApeX Pro isn’t just a non-custodial trading platform; it offers its meta-community unlimited cross-margin perpetual contracts via a new social trading framework.

The platform promises speed, efficiency, security, and transparency for traders’ assets.

By integrating StarkWare’s second-layer scalability engine StarkEx and Validium, ApeX Pro offers cross-margin perpetual contracts with multi-chain support, low fees, deep liquidity, and maximum security.

Both dYdX and ApeX’s underlying technical strategies have their reasons and strategic considerations.

dYdX’s decisions reflect its ambitions for expansion and full decentralization, whereas ApeX chose to optimize within the existing tech framework to ensure user experience reliability and stability.

The more successful strategy will depend on market reactions, actual technical performance, and how each team tackles challenges.

Regarding the wallet connection experience, ApeX has indeed made significant strides.

It offers users more than ten specified wallets and regularly adds support for new ones.

This implies extensive testing before launching each new wallet.

Notably, with ApeX, there aren’t system call issues, resulting in a smooth, uninterrupted experience for users.

MUFEX

MUFEX is positioned as a decentralized perpetual exchange deployed across multiple chains.

It combines the strengths of CEX and DEX while attempting to alleviate their drawbacks.

MUFEX tries to offer a trust level and user experience higher than traditional CEX.

Its decentralized nature enhances security and transparency while retaining professional trading features and tools, making it a unique platform.

During my MUFEX wallet connection test, I noticed it prominently featured MetaMask and WalletConnect as connection options.

The WalletConnect experience was similar to ApolloX.

However, unfortunately, at the time of writing, I couldn’t successfully connect my wallet to MUFEX.

Overall Wallet Connection Process

In the next part, we will turn to a core topic, that is, “the overall process of wallet connection.”

Recalling the few DEXs we discussed earlier, the connectivity and interoperability of the wallet are crucial for user experience.

Here, we will delve deep into each link of wallet connection.

For mobile devices, there are two protocols for wallet connection.

One is a proprietary wallet protocol, such as the SDK provided by Coinbase Wallet, which DApps can call upon integration.

The other is WalletConnect V2.

We can view supported DApps and wallets and their corresponding store download links at https://walletconnect.com/explorer.

Choosing a Wallet and Chain

Our wallet process will revolve around the WalletConnect V2 protocol.

WalletConnect establishes a connection between DApps and wallets.

This connection has two core elements: the wallet and the chain.

For UI interactions, both options need to be chosen by the user.

So, should users choose a wallet or a chain first?

Considering user behavior and psychological expectations, in most cases, users tend to first choose a wallet they’re familiar or frequently use, and then select the chain they want to operate on.

This process design is based on the following reasons:

  1. Familiarity: Users typically have deep trust and familiarity with the wallets they frequently use. Choosing the wallet first can reduce user hesitation and confusion, making them feel more comfortable and confident during the connection.
  2. Simplified Decision-making: Once a specific wallet is selected, the app can provide users with available chain options based on that wallet’s characteristics and limitations, thereby reducing their choice dilemma.
  3. User Experience: Users choosing the wallet first ensures a consistent and smooth experience throughout the connection process, reducing interruptions and unnecessary backtracking.

Why must users choose a chain?

Because, on mobile terminals, wallets are categorized as single-chain wallets and multi-chain wallets.

MetaMask is a single-chain wallet.

Most wallets don’t support chain switching; MetaMask only recently began to.

This involves the implementation of EIP-3326’s wallet_switchEthereumChain.

Different chains’ interaction behaviors correspond directly to on-chain data.

If the wrong chain is chosen, the connection must be severed and re-established.

The chain corresponding to the wallet connection scenarios (onboarding, deposit, swap, etc.) should be chosen by the user upfront.

The DApp can offer a default chain, which users can then switch.

Connecting to WalletConnect Relayer

After users have chosen their wallet and chain, the next step is to connect to WalletConnect’s Relayer service.

This is a crucial interaction step because it ensures communication between the DApp and the user’s wallet.

Some users with weaker network connections might find this step problematic, as WalletConnect might be inaccessible in some regions.

  • Network Issue Feedback: If the DApp detects a timeout or failure in connection, it should provide clear feedback to users, possibly due to network issues.
  • Provide Solutions: Besides informing users of potential issues, it should also offer possible solutions, such as switching to a different network or using a VPN.
  • Clear Status Indicators: Show a clear loading indicator to users while waiting for a connection, letting them know what operation is happening in the background. If possible, also provide an estimated waiting time.
  • Alternative Options: Consider offering other wallet connection methods or services for users who cannot access WalletConnect.

Ensure Wallet Installation and Smooth Transition

Check Wallet Installation Before users choose to connect with a specific wallet, the DApp should first check if that wallet is already installed on their device.

This can be achieved by attempting to open the wallet’s deeplink.

The DApp needs to retrieve this mobile deeplink from WalletConnect’s API.

If it can’t be opened, it’s likely that the user hasn’t installed that wallet yet.

Guide User to Install the Wallet If the user hasn’t installed the chosen wallet, the DApp can provide the official download link or redirect them to the app store, enabling a quick and easy installation.

Carry Session Information for Redirection

When transitioning to the wallet app, the DApp needs to ensure that it carries the Session information established earlier with WalletConnect.

This way, when the wallet app opens, it can recognize and continue the operation initiated earlier in the DApp.

Wallet-side Operation Process

Initialization and Potential Issues

When a DApp launches the wallet application through a deeplink, the wallet usually takes some time to complete initialization.

However, there’s a chance that the wallet may not pop up the expected connection window.

At the same time, the DApp might time out due to the prolonged wait, resulting in a connection failure.

Optimizing the Connection Experience

To reduce the possibility of failure and increase the likelihood of a successful connection, the recommended approach is:

  • First, guide users to open the wallet.
  • Once the wallet has started and completed initialization, let the users return to the DApp to complete the connection process.

Special Handling for Android Devices

For Android devices, some phones might restrict network activities of background apps.

Therefore, when users are operating within the wallet application, it’s recommended they don’t linger for too long.

Spending too much time might cause the connection between the DApp and WalletConnect to break, leading to a session state reset.

To avoid this, users can opt to lock the DApp in the background, ensuring its continuous operation.

Returning to the DApp Process

Some wallet applications can automatically return to the DApp after completing operations, while others might not.

To ensure users know how to return to the DApp, it’s best to provide clear guidance and expectations before redirecting them to the wallet.

This way, regardless of whether it redirects automatically, users will know what to do next.

Explanation of Interaction Types

Basic Connection

The preliminary purpose of the wallet connection is to establish communication between the DApp and the wallet.

This process is implemented through the WalletConnect protocol.

Once completed, the DApp will be able to access the wallet’s address and its blockchain network (chain).

Some simple DApps can conclude operations after this step.

Signature Explanation

  • personal_sign: This signature allows users to sign the given information using their private key. It is often used as a method of identity verification, proving that the sender of the message holds the corresponding private key. For example, in some decentralized applications, users may be required to sign to prove their identity to perform certain operations or access specific information. This signing process does not involve any transactions, so no gas fee is required.
  • signTransaction: This is to sign a transaction, allowing it to be broadcast and executed on the blockchain. Since it involves actual blockchain transactions, users need to pay the corresponding gas fee, which is used to process and verify the transaction.

Operation Tips

Signing operations are vital because they involve user authorization.

Especially signTransaction, as it concerns actual financial transactions and fees. Therefore, when requesting users to perform these operations, clear hints and explanations must be provided.

Users need to be clearly informed that personal_sign does not incur any fees, but signTransaction will incur gas fees.

All these hints and explanations should be given upfront.

Especially when it comes to money and assets, users should be fully notified and warned before performing any actions.

Wallet Version Compatibility and Safe Download Practices

As products iterate, both DApps and wallets frequently release new versions.

These updates might introduce new features, improve performance, or fix known issues and vulnerabilities.

Therefore, using the latest versions of apps and wallets is crucial, ensuring not only the best user experience but also the security of their transactions and funds.

Importance of Using the Latest Version

  1. Performance and Features: The latest versions of DApps and wallets usually have better performance and new features, providing a smoother and more efficient user experience.
  2. Security Updates: With the discovery of potential security threats and vulnerabilities, development teams will release security patches regularly. Using older versions might put your funds and data at risk.
  3. Compatibility: The latest versions of DApps might not be fully compatible with older versions of wallets, and vice versa. Ensuring both are updated can reduce potential issues.

Safe Download Practices

It’s strongly recommended that users download DApps and wallets from official, trustworthy sources.

  1. AppStore and Google Play: Both app stores have strict app review processes to ensure the apps you download are safe and malware-free.
  2. Official Download Links: If users choose to download APK or applications directly from a website, make sure it’s from the DApp or wallet’s official site.
  3. Avoid Unofficial Channels: Never download any DApps and wallets from third-party app stores, links, or email attachments. These sources might contain malware or counterfeit apps that could lead to financial loss or data breaches.

Summary and Outlook

During our exploration, we gained a deep understanding of the significance of the connection between DEX (Decentralized Exchange) and wallets, and how to provide users with the best experience.

Through an analysis of major DEX mobile platforms, we observed the current practices in the market and how they pave the way for the future of decentralized trading.

The wallet connection process, in particular, plays a pivotal role in the entire decentralized trading experience.

From simple connections to complex signatures, every step involves user funds and data security.

Additionally, we discussed how to safely download and update DApps and wallets and why this step is so important for users.

But this is just the beginning.

With the advancement of technology and the continuous growth of decentralized finance, we can anticipate more innovations and improvements in the future.

For instance, we might witness more user-friendly interfaces, more efficient trading methods, and even safer and transparent protocols and standards.

For DApp and wallet developers, staying current and continuously enhancing the user experience will be their core tasks.

For users, understanding best practices, staying vigilant, and always focusing on security will be key to safeguarding their funds and data.

All in all, the future of decentralized trading is full of possibilities.

We hope that through continuous learning, exploration, and innovation, we can bring a brighter future to this field.

--

--

Hamber

Flutter & Dart GDE | Web3 Advocate | Doting Daddy of a Cute 6-year-old Daughter