Gridex: An On-Chain Order Book Protocol
European Blockchain Convention·Mon, Oct 9, 2023, 12:00 AM
Listen to Ali Al-Ali's participation at the 2023 European Blockchain Convention. Ali Al-Ali is Technical Lead at Gridex, the first of it's kind order-book trading protocol on the Ethereum blockchain. GDX provides opensource, fully on-chain, order-book trading to DEXs, DeFi tools and wallets. The European Blockchain Convention is the most influential blockchain event in Europe. Follow us to find out more: Linkedin - https://www.linkedin.com/company/european-blockchain-convention/ Instagram - https://www.instagram.com/eblockchainconvention/ Twitter - https://twitter.com/EBlockchainCon
Transcript
foreign [Music] okay hi my name's Ali I'm the technical lead at gridx at based in London and I'm here to talk to you about an on-chain order book protocol which is what we believe will be the Catalyst for D5 Mass adoption no no okay that's too far okay we so we act we are oh my God okay sorry okay does this want to work okay technical pains okay here we go so gridx is the first ever fully on chain order book protocol on ethereum now to understand why that's such a big deal we need to look at the argument between using an order book and an amm for a DEX Okay so up until now okay fully on chain dexes like uni swap would use an amm model that's an automated Market maker while other dexes and caxes such as binance and dydx would use an order book model now we need to also we need to ask a question why is this the case surely if one of them is is better one of them has has an advantage in some way then um that surely must determine which one they use okay so the amm is more of an on-chain compromise okay it's a compromise to make the gas cost um effective now I would say so that the gas doesn't cost an arm and a leg but you can still get that um when volume is is high so I won't say that but this would really cost this wouldn't cost an arm and a leg this would probably cost your entire existence um so let's look how this this is the type of the exchange that we're familiar with okay so this is your your typical cats okay this is the the real life equivalent of this is something like the New York Stock Exchange okay this is what an amm looks like much simpler okay you've just got two tokens you pick which you know which way to swap it you connect your wallet you press Swap and boom you're away this is the real life well the real life equivalent of this would be um the money changer on the corner of the street okay you're just going I've got some pounds I want some euros they you know give you a rate and you you give them your pounds they give you euros okay so let's look at what do we need in a decks okay so at Red X we thought about this and we realized that there are basically two key components to create the Decks that D5 needs okay first of all it needs to be on chain second of all it should use order books so first of all let's let's discuss why does it need to be fully on chain okay first of all decentralization the only way that you're going to get a truly decentralized decks is if everything is on chain for everyone to VAR to verify okay second thing is is uptime so if you're fully on chain as long as the underlying blockchain is functioning your decks is functioning okay well say for example if you've got um you know or some sort of computation off chain like order books then um that's an essentialized facility let's say that that catches fire someone shuts it down whatever your your decks is now not operational okay so the other thing and this is more of a um a thing to do with the friction with with using um something that is not fully on chain is that you need to deposit or withdraw okay well with a fully Unchained decks like uni swap for example you just connect your wallet and you're Off to the Races okay listing on a fully on chain decks it's permissionless you want to create a pool create a pool on uni swap okay well on on other dexes you need to you know find some sort of con you know maybe email the the Creator you know coordinate with them to make a trading pair and the most important one is composability okay if all of your smart contracts are live on chain okay anyone can come along you know they they might have some you know great fantastic idea that you've never thought of they'll come along Implement your your smart contract well um compose on your build on your smart contracts and that's that's really what got D5 going you know using these different protocols like Lego bricks to make something great you can't do that with other dexes well you at least you need to cooperate with the with the owner okay they might give you an API that API needs to be be maintained if it doesn't if it isn't maintained you've got a problem so it's a lot more permission okay now let's look at so okay you can have we need a fully Unchained decks uni swap does that but uni swaps and amm so why do you insist on not having an amm well let's let's look at some of the amm pain points okay if you're a liquidity provider and you're providing liquidity to any volatile pair anything other than a stable coin pair you're going to be prone to impermanent loss okay you're always going to have high slippage because you're always going to be a taker The reason why you're always going to be a taker is because you've got limited trading functionality like I said it's a money changer all you can do is I you know I've got this currency I want to swap into that one so you can only have taker orders so you okay you might think okay why has no one implemented an on-chain order book the the answer to that is simply gas okay and we're gonna we're gonna see how um you know a traditional order book works and you would see that the the computation would be insane to have on chain so is there a way to reduce the gas consumption of an order book the answer is yes okay and grade X achieves this not only achieves it but we actually bring the gas cost down to the same levels if not lower than amms so that's quite a bold claim you might ask how do we do that so before we answer that let's look at how a normal order book works okay so say for example you go on the text like binance they use a central limit order book this relies on limit orders and a matching engine this matching engine basically you come in as a taker I want to make a market swap it matches you up with a maker someone who's put in a limit order and you know to execute the swap the problem with that is that it's very complex okay and involves a lot of resources a lot of computation and it's got a variable overhead okay because this needs to check every single maker for a match so the more maker orders that you've got the you know the more bloated the the whole system is so what do we do okay we've we've reimagined an order book we came up with the grid maker order book model this relies on maker orders and instead of a matching engine relies on our grid price linear movement algorithm okay what's the upshot of this it's much simpler involves very very minimal resources and key most the most key point is that it's a fixed overhead it doesn't matter if we've got one maker order a million 10 million the gas cost will be the same okay so how do we do this well the Crux of the grid maker order book model is that instead of you know say say I'm a maker instead of coming in and say I want to buy or sell at this price instead I'll come in and say I want to buy and sell within this narrow range okay in this range would really be narrow it'd be like 0.01 okay and we would allowed you to place orders of any size and in any price range with zero slippage so no slippage outside of that price range okay and we'll reward you with negative fees for essentially providing liquidity to the order book so how do we do this let's look at the a typical case of the gplm algorithm okay let's say we've got this range okay and let's assume that we've got the current price at a lower boundary maker orders are coming in these maker orders get bundled into a bundle which we'll call b0 okay now let's say a taker comes in okay and as long as that that taker's order is less than the total amount in that bundle what it will do is the taker will see this bundle as essentially just one maker order and every single maker order in that bundle will be filled proportionately okay once that's been tapped into any new maker orders that come in will be bundled into the next bundle which would be B1 and this would continue so long as the current price which increases linearly hence grid price linear movement um as as long as the current price is within that current range so once b0 is exhausted then you'll start tapping into B1 newmaker orders would be in B2 Etc add infinitum um once it once price leaves this range then the whole process would start over again with b0 so these are some of the grids that we would provide so you can either have uh um ranges with resolution of 0.01 or 0.3 percent Etc so let's look at okay how does this actually add up on chain so you can see that with a swap in one of our grids okay the the the gas cost is actually on par with the swap um in a uni swap V3 pool and placing a maker order is almost three times as cheap as adding liquidity and collecting a maker orders almost is about half as cheap as half as expensive as removing liquidity from uni swap so you can try us out we're on test net you can go to d5.xyz and this is what you would get this is the Decks that we need and this is the Decks that we now have but grid X is more than just an on-chain order book protocol so coming in q1 of 2024 gridx POS is going to be launching what is Grid xpos it's a cross chain order book protocol it's a layer zero blockchain supports all of your favorite layer ones and layer twos but most importantly supports Bitcoin so for the first time since Satoshi wrote his Bitcoin white paper you would be able to natively trade Bitcoin native Bitcoin no Bridges or any trust required so the gridx protocol though will be deployed on ethereum maina and all your favorite layer twos um in just a few weeks and you can visit grid gdx.
org to find out more thank you [Applause]
Automatic transcript — names and jargon may be misspelled.