When starting out on Degens, a common point of confusion is the concept of “gas”. Since space in each block of the Ethereum blockchain is a limited resource, transactions must pay a certain amount of ETH as a gas fee in order for them to be processed.

But what happens when somebody sends DAI tokens to a new user who has no ETH? Unfortunately this user is unable to use these tokens on most dApps because they are required to create transactions, and this requires ETH to pay for the transaction’s gas usage.

Meta-transactions

Some dApps, such as Degens, allow other parties to process transactions on behalf of users. Instead of having to create regular transactions, users are requested to sign messages, which doesn’t require any gas. As long as the contracts understand these signed messages, other parties can create the actual transactions that will be sent to the blockchain.

The common name for a message of this type is a meta-transaction. You may have already used this feature on Degens. You can simply press the “Make” button on your betslip instead of “Take”, and then you are prompted to sign a message:

Click “Make” to bet without paying gas

Approvals

The above works nicely if you have a balance in DAI and have approved the contract to access this balance. That’s the catch though! In order to approve the contract, you need to create an ethereum transaction, which requires ETH.

Permit

Thankfully the folks at MakerDAO realized that this step is a big speed bump in terms of user on-boarding, and have added meta-transaction support to the DAI contract in the form of a new function called permit (see the code here). This new feature allows the approval process to be done by a separate party, same as our bet on the Rams above — no ETH needed!

WARNING: When you approve a contract, either by sending a transaction or using the new permit meta-transaction method, you are allowing that contract total access to your DAI funds. You should always make sure that any contract you approve is verified on etherscan and has been audited by a reputable auditing organization. For Degens, you can see our contract on etherscan, and read our Quantstamp audit results.

A new user’s approving experience is really simple. All they need to do is click the unlock button in the Account drop-down, and sign the Permit message in the Metamask pop-up:

Approve the Degens contract — no ETH needed!

Simplifed betting flow

Users who have 0 ETH can’t click the Take button because this will try to create a new transaction. So in this case we just show a single “Bet” button to avoid confusion:

Simplified betting flow: No Make/Take, just Bet

For users who do have ETH, what is the difference between making and taking?

Make/Bet: This creates a new order and is the easiest way to get started. You don’t need to pay any gas fees, but you also don’t have control over how quickly your bets will be confirmed. You always receive exactly the odds you specify in the odds input.

This creates a new order and is the easiest way to get started. You don’t need to pay any gas fees, but you also don’t have control over how quickly your bets will be confirmed. You always receive exactly the odds you specify in the odds input. Take: This creates a new transaction and is for more advanced users. Although you will have to pay gas fees, you can control how quickly your transaction is mined by increasing the gas price, and you may receive slightly better odds.

Meta-transaction (“make”) bets work almost exactly the same as “take” bets. While you are waiting for a bet to be confirmed, “make” bets will appear in the Orders tab, and “take” bets will appear in pending section of the Transactions tab. After a bet is confirmed, there is no difference at all — a position is a position.

What does it look like?

One of our core principles in Degens is transparency. In the activity screen you can see exactly who is betting on what, with who, and (if applicable) who fulfilled the meta-transaction. For example, here is a bet on the Recent Activity screen (click on the volumes at the top of the website):

Recent Activity (click on the volume numbers at the top of degens.com)

The dark green guy on the left of the hand-shake is somebody who made a “make” bet.

The bet was matched between orders previously created by redman and the purple guy.

The light green “runner” is the address who submitted the meta-transaction to the blockchain (and may earn an arbitrage profit for doing so).

You can click on any of the icons to visit the etherscan page for that address.

Use permit in your own dApps!

Because we think many other dApps would benefit from implementing similar functionality, we have pushed the javascript code that implements the permit feature to our github repository. Come on our telegram and let us know if it was useful to you, or if you need extra integration help!