Faster, cheaper and safer Dapp access

A new, open sourced component to Wallet Connect

Tagged

Matthew Wright

Oct 3, 2024

Quick summary

šŸ› ļø Just a heads up that this post is mainly aimed at Dapp & Wallet developers

At EthCC 2020 we introduced our new method for making Dapps faster, cheaper and safer to access from mobile wallets.

Weā€™ve done this with Wallet Connect, the standard for securely connecting mobile wallets to desktop Dapps.

Hereā€™s how, why it matters, and what you can do as a Dapp or Wallet developer to speed its adoption. You can also see the full talk here.

Weā€™ve open sourced our work as we want everyone to be able to easily access Dapps. For Dapp developers itā€™s just four new lines of code.

Quick background on Argent

For those new to Argent, the picture below is a quick overview. Weā€™re a smart contract wallet with the ease of use and security of a bank ā€” without the bank.

We also make it radically easier to access Dapps.

Argent provides the best features of a bank without the custody

The Argent foundation from which you can explore the world of Dapps

Using Wallet Connect today

Argent ā€“ the safest way to use WalletConnect

Argentā€™s first integration with Wallet Connect ā€” note that ā€˜Pre-authoriseā€™ and ā€˜Call Contractā€™ are separate steps, something we later solved, as detailed in this post

Argent first integrated Wallet Connect a few months ago. This meant you could use your mobile Argent wallet to access a desktop Dapp like Pool Together.

Importantly, we designed our integration differently to the traditional Wallet Connect approach. Why?

1. You should only approve what you want to spend

Most Dapps ask you to authorize them to potentially take a nearly unlimited amount of tokens (10āµā° actually) from your wallet. Argent only prompts you to approve the amount you want to spend.

2. You should be protected by your daily limit

With Argent, when you authorize a Dapp to interact with your wallet youā€™re protected by your daily transfer limit. This means thereā€™s no risk of anyone draining your wallet. You can go over your daily limit with the help of your Guardians (friends or hardware wallets you trust).

3. You should be able to easily revoke a Dappā€™s access to a token

Changed your mind about a Dapp? Revoke their access with a tap.

We felt our integration was as smooth as any involving a blockchain but we werenā€™t fully satisfied.

The problem was having to approve an ERC20 before a contract call. In Pool Together, for example, this meant having to make two transactions to buy some tickets. And having to wait for the first transaction to be mined.

The result could be a little cumbersome, wasnā€™t the best use of gas and time, and left room for further minimising the risks of super high ERC20 approvals.

We pushed ourselves to find a better way.

How can we do better?

Fortunately we can harness the power of smart contract wallets as they can bundle lots of transactions into one. This significantly simplifies the experience.

How have we done this?

  • We have added a new approveAndCall() method to the wallet
  • This orchestrates the approval of the exact amount of token required THEN executes the contract call.

All in one atomic transaction!

The result is a faster, cheaper and safer Dapp experience, as the video below showsā€¦

The new and improved Dapp experience

Hereā€™s how it works for Dapps

Weā€™ve tried to make things easier for Dapp developers by creating a small NPM library: @argent/smartwallet-utils.

Itā€™s only four new lines of code. The library also solves the problem Dapp developers have with smart contract wallet signatures.

ERC-20 ApproveAndCall method for Argent and Dapps, EIP1271

Hereā€™s Julien explaining it in more detail at ETHCC.

Weā€™d love other smart-contract based wallets to add their config

Weā€™ve open sourced this work. To increase adoption our library defines a simple interface to represent a wallet. Other smart contract wallet providers can simply add their implementation of that interface in the library to enable its features. It can be enabled in 50 lines of Javascript.

ERC-20 ApproveAndCall config for smart contract wallets

Next steps for Dapp Developers

[Easier], better, faster, stronger ā€” Ethereum 2020

ā€