Introducing The Gasless Wallet for MCD Dai

Nour Haridy
Dec 5, 2019 · 6 min read

Have you ever sent Dai to a new address, gone to use it, only to realize that you’ve got no ETH in the address and you must go acquire some in order to do anything with that Dai?

Thanks to the upgrades with Much Cooler Dai (MCD), you can now send Dai without any ETH!

Gasless by Mosendo is a non-custodial web wallet for Dai where transaction fees are paid in Dai itself instead of Ether. It leverages a new feature in the MCD Dai token that allows for cheaper, simpler and safer native meta-transactions compared to Smart Wallet meta-transactions.

In order to use the Gasless wallet, all you need is an existing wallet with some Dai and either the Metamask extension on your browser or a browser with a Web3 provider enabled such as Trust Wallet or Status.im.

The source code for the app and smart contracts is open source and available on Github. We’re looking forward to the community to lead the project’s development, so PRs and issues are welcome!

Additionally, we’ve built an open relayer API for developers to build their own products that leverage Dai native meta-transactions. We hope that our API empowers dApp developers to offer better UX to their users while avoiding building their own entire relayer infrastructure from scratch. Detailed Relayer API documentation will be published soon! (Email tom@mosendo.com if you are interested in early access.)

Gasless vs Smart Wallets

Smart Wallets such as Metacash and Argent already allow for Dai Meta-transactions with fees either completely subsidized by the product company or paid by the user in Dai instead of Ether.

Thanks to the new MCD Dai native meta-transactions design built by the Maker team, the Gasless wallet comes with a number of improvements over existing smart wallets:

Singleton contract

By design, existing smart wallets deploy a new smart contract to the chain for every user. This not only contributes to a storage bloat of the Ethereum blockchain, but also adds additional transaction cost. For example, on the Metacash wallet, users are required to pay an additional transaction fee with their first Dai transfer in order to cover the contract deployment cost for their wallet. Other wallets such as Argent subsidize this fee for their users while scaling becomes incredibly expensive.

Because Gasless is NOT a smart wallet, it is able to use a singleton contract design where only one contract acts as a meta-transaction hub for all users. This greatly reduces the cost of meta-transactions compared to any smart wallet on the market.

Compatibility with other wallets & dApps

One problem with smart wallets is that they are inherently incompatible not only with traditional Ethereum wallets, but even with each other. When using a new smart wallet, a user is required to send their existing balance to his smart wallet contract which costs Ether fees. This creates a barrier of entry for a number of new users of meta-transactions.

On the other hand, Gasless is able to send existing Dai balances gaslessly without any wallet migration. In fact, you are able to send Dai with the Gasless wallet (e.g. using Metamask) while the rest of your balance stays accessible by other wallets and dApps that are using the same key.

Improved Safety

By design, smart wallets force you to make big technical risk assumptions when using them. At their core, smart wallets are smart contracts that take exclusive ownership of your entire funds but only take orders from you. In the past, smart contract wallets such as the Parity Multisig have failed due to a bug burning hundreds of millions of dollars of user funds (in only one instance).

Gasless does NOT take exclusive ownership of your funds. Instead, the Gasless contract is granted an ERC20 token allowance, and just like other dApps, if it fails or becomes compromised, the allowance is reversible directly by you.

Straightforward Upgradability & Extensibility

Smart wallets can be difficult to upgrade or extend their features. Most current smart wallets would require you to send your funds away from the current smart wallet when migrating to a new version.

On the other hand, because Gasless is able to share access to your funds with other contracts, it can be upgraded or extended to add more features by signing a simple signed message. This also means that newer versions of Gasless or even alternative products can add new features without forcing you to opt-out of previous versions or move your funds.

Nour explains how it works

How it works

In Sai (Dai v1), the only way for a user to grant a contract allowance over his funds was by manually calling the ERC20 approve() function on the Dai token contract, and not via meta-transactions. This function call required the user to pay fees in ETH.

In the new MCD Dai token, a new contract function was introduced by Maker under the name of “permit”. This function allows the user to make an allowance to any address via a meta-transaction (signed message) instead of a manual transaction. The gas fees for this transaction can be subsidized by a relayer.

MCD permit()

At the core of the Gasless wallet is a single smart contract that acts as a meta-transaction hub for all users. Just like any other meta-transaction architecture, along with the contract is a relayer API hosted by Mosendo that receives signed meta-transactions from users and relays them to the contract.

But in order for this contract to be able to access user funds, the user first signs a meta-transaction that we relay to the Dai contract via the permit function. The Gasless contract is then able to use the ERC20 “transferFrom” function to send Dai on behalf of the user.

The Gasless contract regulates the relationship between the Mosendo relayer and the user while ensuring that the relayer is trustless by only accepting meta-transactions that are authenticated by the user via signed messages. In exchange for its service, the relayer is also paid a Dai fee by the user in order to cover the transaction gas cost and running cost of the relayer infrastructure.

Gasless transaction from tomhoward.eth txn

Give feedback!

Check out the code, report bugs, provide product feedback, or submit a PR, by joining us on Github!

Gasless Github

Whats next?

Gasless has been opened to the community to contribute improvements! Next up we are researching how we might donate Gasless to a DAO to be the maintainer of the project.

UPDATE: You can now use the Gasless relayer with a simple npm package https://github.com/mosendo/gasless.js

We’re Hiring!

Mosendo is looking for product folks to join us on the mission of bringing open money to the world.

Mosendo is built using Ethereum tech that didn’t exist 6 months ago, from state channels built on the Counterfactual standard released in summer 2019, to smart contract wallets, and the latest MCD Dai features.

If working on the bleeding edge excites you, please get in touch: AngelList Jobs or email tom@mosendo.com with your github.

Mosendo

Borderless access to money and wealth, with decentralized personal finance tools. Mosendo.com — Send money to anyone, anywhere. You won’t even know it is cryptocurrency!

Nour Haridy

Written by

Blockchain Architect at Mosendo.com — send money to anyone, anywhere ⬙ Backed by $DAI, borderless, censorship resistant, stable, cryptocurrency

Mosendo

Borderless access to money and wealth, with decentralized personal finance tools. Mosendo.com — Send money to anyone, anywhere. You won’t even know it is cryptocurrency!

More From Medium

More on Makerdao from Mosendo

More on Ethereum from Mosendo

More on Makerdao from Mosendo

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade