How UniDex is able to deliver a lower transaction costs

Lets go over how UniDex is able to source liquidity from Uniswap and many others, yet still trade with a lower fee compared to Uniswap. For a TLDR you can scroll to the bottom.

Gas consumption

If you’re relatively new to the scene this can help understand actual gas costs and what things like metamask show you in order to keep you safe.

By default UniDex passes 20% more gas limit than normal to prevent failed transactions on the places we aggregate from. Now what does this exactly mean? We’re going to be using metamask as the example here because most users are using the metamask wallet for their daily activity.

Gas Limit refers to how much gas in total can be spent on a transaction.
Gas Price refers to the amount of gwei ( measurable unit of ETH think of pennies to dollar but if pennies was even smaller )

So how does this translate to the transaction? Lets dive into some screenshots.

here is a transaction for buying UNIDX on UniDex which appears to have a $70 gas fee.

and here is the same transaction on Uniswap with a $63 gas fee which is lower at first glance than UniDex.

But I thought UniDex saves on gas fees while interacting on Uniswap? Lets take a note of 2 things here. For starters the gas price is normalized at 205 so thats checked off however, the gas limit is quite different. Remember the gas limit is how much gas is allowed to be spent and the gas price is how much gwei were spending per unit of gas.

Metamask gives the gas fee assuming that 100% of the gas will be spent according to the limit.

This is that same Uniswap transaction we built before but now we use the same gas limit as the transaction on UniDex. Now it returns an equal value compared to UniDex. Again, because metamask is showing the raw value assuming 100% of the gaslimit will be spent, we’re returned the a value that may not actually be fully utilized.

The Savings

Now that we went over some terms and how gas costs on metamask can be deceptive without context. Lets show how were actually saving in this example. Both transactions have the same gas limit however UniDex will actually use less gas.

Gas limit can be used to cap how much you want to use on a contract, however not all that gas can/will be spent. Let us compare how much actual gas is used on this transaction.

This is a comparison of the actual TX done. One was directly from Uniswap and the other was through UniDex pathing through 0x as the aggregator we aggregate from.

But notice despite having the same gas limit and gas price, Uniswap will consume more gas to complete the transaction by a margin of 4%.

This is because the Uniswap router contract will consume more gas compared to UniDex and its sources we aggregate from. Uniswap uses 109,620 gas while UniDex will route using 105,378 gas in total. Even though we had a higher initial gas limit and metamask said we would be paying a higher fee than Uniswap, or gas consumption was lower with the the same gas price resulting in lower fees paid.

Summary — Key Points
1. Metamask will assume 100% of gas will be spent determined by the gas limit. Thus shows a higher price of transacting on UniDex compared to uniswap.

2. Gas consumption compared to uniswap is lower resulting in lower fee’s of about 4–5% using the same gas price ( gwei ).

3. UniDex will pass 20% more default gas limit to prevent failed transactions or “out of gas” errors however consumption will still be lower than Uniswap.

Discord permanent invite link —
Twitter —
Telegram group —
Telegram ann channel —
Website -
Trading Platform —
Trading Platform BSC —
Business inquiries —

The ultimate DeFi trading terminal that combines the best from the industry all in 1 site. By traders, for traders, and with traders.

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