Frictionless trading experience on Perpetual Protocol — Case Study

Aditya Khanduri
Nov 2, 2020 · 4 min read

Perpetual Protocol is a decentralized perpetual contract protocol utilizing virtual automated market makers (vAMMs) to create markets with no makers while still guaranteeing on-chain liquidity. They have integrated with Biconomy to provide a seamless trading experience to their users on the platform.

Now, even users with little trading and staking experience can easily capitalise on an asset’s price movements. This ease of use will help attract more users to the platform. The aim is that if you have a long/short derivative strategy in mind, you should be able to easily and quickly take advantage of it through the protocol.

This integration will also help traders save a ton of money in gas fees on transactions!

Image for post
Image for post

The Problem

It was gas-intensive to trade on Perpetual Protocol. After analyzing the data from their first trading competition on the Ropsten testnet, they found out that the average gas used per trade is 581,773.8579, meaning that it will cost users around 0.0465 ETH (18 USD) to open or close a position when the gas price is 80 gwei.

Image for post
Image for post
The gas used per trade on Perpetual Protocol (2020/9

To reduce the gas fee incurred in each trade, perp decided to postpone their mainnet release and migrate the smart contracts to the xDai Chain. However, this decision created another problem from a users’ perspective, as to directly interact with the smart contracts on xDai users need to manually change the settings on MetaMask, which creates an entry barrier even for those who are already familiar with Defi applications. Thus, reduced gas fees would come at the cost of increased user friction.

The Solution

To get out of this conundrum, the team behind Perpetual Protocol decided to allow users to submit their orders through meta transactions on the Ethereum mainnet (without ever changing any settings on MetaMask). Once the meta transactions relayers receive the orders, the relayer will forward the orders to xDai Chain on behalf of the users, and the smart contracts on xDai will execute the order.

Image for post
Image for post
Above image is slightly complex but in simple terms what this means is: (End-user) submits the order details -> (Platform) forwards the order details to xDai Chain (on behalf of the end-users), and you’re done!

Biconomy provided plug & play relayer infrastructure to speed up development

Instead of building their meta transaction relayer from scratch, they choose to use Biconomy’s meta transaction relayer infrastructure to speed up the development process.

We’d like to point out that even though Biconomy runs the relayer, Perpetual Protocol cannot forge any fraudulent transaction because every meta transaction needs to be signed by traders’ wallets before submitting, or it will fail during the execution. And if the users don’t want their transactions to go through the relayer, they can interact with the smart contracts on xDai directly after changing the settings on MetaMask.

Benefits of integrating with Biconomy

There are several advantages for both end-users and Perpetual Protocol by using meta transactions with Biconomy:

Advantages for users:

Advantages for Perpetual Protocol:

Thus, if you are a decentralized application, you should explore meta-transactions to reduce user friction. And the best way to leverage that is through Biconomy. Get in touch to discuss how we can do it for your project!

Biconomy

Simplifying Web 3 Experiences

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store