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!

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.

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.

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:

  • Better user experience: there is no need to switch network to xDai on MetaMask. This will remove most complexities that scare away a lot of new users.
  • Save on ridiculously costly gas fees: Savings of costly gas cost required for smart contract transactions — the gas fee is paid by Perpetual Protocol
  • Smooth transactions: Users can experience smooth transactions at all times even if the ETH network gets more congested than the rush hour traffic in New York.

Advantages for Perpetual Protocol:

  • Shorter development time: It helped speed up the development process. Building a scalable meta transaction relayer from scratch would have been extremely time-consuming. With Biconomy, it was a much simpler plug & play process that saved months of development time.
  • Ensure happy users: Just like any other project, Perpetual Protocol strives to achieve high customer satisfaction. The Biconomy integration will improve their user’s experience, which will help them ensure happy traders and stakers.
  • Optimise gas fees costs: As Perpetual Protocol will pay the gas fees for their users, it is an ‘acquisition cost’ for them. Biconomy helps to minimise these gas fees by leveraging analytics and gas saving techniques.

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