White Star Capital Digital Assets Fund: A Deep Dive into Sei Network
Sei is a Layer 1 optimised for decentralised exchanges. We took a look into what this means, and how its order-matching mechanism means it attracts liquidity- the key to winning in the DEX space.
TLDR (do not worry if this doesn’t mean anything to you yet, I will take you through the concepts- just refer back to this as you read through):
Sei is a Layer 1 optimised for decentralised exchanges. Their chain’s design means their order batching, pricing and execution speed 1) incentivise liquidity provisioning from high-frequency traders whilst preventing negative externalities like frontrunning, and 2) prevent inter-block Miner Extractable Value (MEV) by limiting the ability to do sandwich attacks, whilst allowing the chain to accrue meaningful value through a Flashbots-style auction for intra-block MEV.
I’m back with another Layer 1. It’s like Sui, but it took the bold step of switching out one of the vowels. It’s also a great case study for how transaction ordering and processing an be optimised for De-Fi, so I think worth a deeper dive.
Search up Sei and you’ll hear it’s trying to be ‘use-case specific’, meaning it is an orderbook chain positioned as the best of general purpose Layer 1s like Ethereum and app-specific chains like dYdX. That’s great and all- but what does that actually mean? What’s different about their on-chain orderbook that makes it a superior experience for users? And what’s with all these acronyms?
First things first- what is Sei?
If crypto is to live out its potential, it has to support decentralised finance. After seemingly exponential innovation in the space over the last year, two broad categories of decentralised exchanges have emerged: decentralised limit order books (like dYdX), where buy and sell orders are aggregated and matched off chain and settled on chain; and swap exchanges (like Uniswap) where prices are set by a deterministic automated market making rule. They both have their shortcomings, but decentralised exchanges are the backbone of DeFi. And yet, so far, DEX to CEX spot trading volume has never actually surpassed 30%.
Fundamentally, for a decentralised (or centralised, for that matter) exchange to work, it needs liquidity. To achieve this, it has to have the right financial incentives enabled by and embedded into the technology. Getting that right is no easy feat.
In the case of AMMs, liquidity providers derive revenue from collecting trading fees (a fixed percent of all swap volume). But prices of course fluctuate, leaving them to suffer from impermanent loss when the pool rebalances in the ‘wrong’ direction relative to price moves. To incentivise risking the impermanent loss, AMMs offer unsustainably high APYs. The effects of this played a role in the cataclysmic collapse seen earlier this year after the inflationary tokenomics of AMMs like Anchor incentivised fickle liquidity providers who were only in it to make a quick APY buck. The associated UST/LUNA death spiral which I explained at length here showed how the initial acquisition is only one stage in the relationship with the user. Protocols would do better to consider the long-term incentives that better maintain healthy growth and revenue trajectories. And in fact, analyses of liquidity positions have shown that most trading fees rewarded to LP token holders are still outweighed by impermanent loss, but that’s a discussion for another day (have a read of this though if you’re interested).
Sei is bringing on-chain orderbooks back in vogue. On-chain orderbooks are difficult to build compared to relatively simple smart contracts behind AMMs, and unlike off-chain orderbooks, recording not only every executed transaction but every order results in congestion, slower transactions, and higher fees. Sei, a permissioned Layer 1 blockchain optimised for DeFi, has tried to solve exactly that. It is tailored mainly for exchanges, and although it told me they had interest from AMMs and NFT marketplaces too, its built in central limit order book (CLOB) has made it primed for orderbook DEXs. Unlike order-book DEXs that are built on generic purpose blockchains (e.g. Serum and Solana), building an orderbook Layer 1 from scratch allows it to adapt the consensus mechanism and order sequencing and processing to optimise for trading. This may not sound overly interesting, but it actually enables a whole range of possibilities to solve with the necessary nuance the delicate issues of HFTs and MEV.
Part 1: How is their blockchain optimised for market makers?
As explained, orderbooks — both centralised and decentralised — need liquidity. Most of this liquidity comes from high frequency traders (HFTs) in the form of market makers. HFTs use complex algorithms to analyse large amounts of data about multiple markets, and execute a large volume of orders in a matter of seconds. This will typically take the form of taking advantage of discrepancies in price to earn profits from arbitrage or bid-ask spreads. Fast execution is key to making a profit; milliseconds can make the difference. HFTs therefore invest in advanced technologies such as microwave towers and FPGAs to engage in nanosecond speed competition.
It’s difficult to know the precise proportion but I’d estimate the ratio of HFTs to organic traders to be 25:1. It can be as high as 80–90% of volume in some markets. In addition to providing liquidity for retail traders, by filling discrepancies and forcing prices to converge HFTs help to balance and stabilise markets. A successful orderbook chain therefore needs to cater to these market makers.
But HFTs endogenously perform two functions, and they are indifferent between the two so long as they make profit. One — the provision of liquidity — is useful, but the second — stale order picking — is rent-seeking and harms end users. I’ll explain, but TLDR: Sei’s order processing mechanism manages to incentivise the former while eliminating the latter.
Incentivising Liquidity Provision
Centralised exchanges use Continuous Double Action (CDA) which means orders are processed once they reach the exchange in sequential order. This requires very high throughput, which most Layer 1s are incapable of providing.
❗ Most blockchains use sequential execution, meaning thousands of nodes continuously update a single ledger containing a chronology of every transaction ever executed. Because each one is added one at a time, it’s necessary to wait for each new transaction to be verified, limiting throughput and causing the high gas fees we all know and love, especially as network usage spikes.
Sequential execution unnecessarily restricts throughput on these chains- most transactions are independent. And as exchange demand scales, high latency can also become an issue, so affecting the speed with which orders are finalised.
I explained parallel processing and how Sui and Aptos use it here. Sei also uses parallelism to cater for DeFi use-cases by increasing the throughput by enabling order matching for different markets (trading pairs) to run simultaneously.
It also uses optimistic block processing to decrease block latency.
❗ In Tendermint Core, when a block is proposed to validators, they prevote and precommit to the blocks they want to go execute. After the precommit message is sent, validators then go through each transaction in the block and execute state changes.
This unnecessarily increases latency when there is a lot of data to process — most proposed blocks are accepted.
Since validators have received all transactions from the block at the prevote step, Sei optimistically processes the state changes and applies them to a temporary candidate state which is then accepted if the proposed block ends up accepted as expected. If it is not- it is simply discarded.
This, combined with other innovations, Sei has managed to massively enhance throughput and reduce latency, which in turn encourages liquidity provision from HFTs who seek out opportunities from these two features.
2. Disincentivising wider spreads
In a continuous time limit-order book, there is a race to respond to any publicly and symmetrically observable news event.
❗ Suppose I am an HFT and I have a resting order above the current market price. If an event happens that causes the price of the asset to increase significantly above that price, my order becomes ‘stale’. I, a single, lonely HFT will try and cancel my order, but many other HFTs will race to pick off my quote (i.e. buy it up and sell it at the new higher price). Because the processing is continuous, I will inevitably lose against the many others. Now, obviously, I don’t expect you to feel sorry for me. But next time, I just won’t put my resting orders so close to the current price. This means wider bid-ask spreads, which ultimately harms you, the humble retail trader.
Sei’s orderbook uses Frequent Batch Auctions (FBA) to batch and accept orders over a discrete period of time (the auction interval). Injective, another CLOB DEX, uses a similar model. The clearing price depends on where the quantity of crossing orders is highest, and the midpoint price is used if the bids and asks cross with the same quantity. Orders are not published to the orderbook until after the batch auction has been executed, eliminating front-running opportunities.
Batching reduces the value of a tiny speed advantage- if the batch interval is one second, a one millisecond speed advantage is only 1/1000th as useful. Instead of competing on buying up microwave towers (wtf are they anyway), HFTs compete on price. For example, if the Fed announces a policy change at 2:00:00:00pm, in a continuous market competition manifests in a race to react because someone is always first. In a batched market, competition simply drives the price to its new correct level for 2:00:01:00pm.
All of the above means Sei has optimised its order processing for deep liquidity provision on its CLOB. The very fact that it is a central on-chain orderbook (i.e. all resting orders and all executed orders are recorded on chain) also means that every dApp building on it, from live sports betting to complex options and futures exchanges, can share liquidity with one another. This has the potential to become a thriving ecosystem where smaller DEXs and newer tokens actually stand a chance.
Part 2: How is its order processing optimised for MEV?
Maximal Extractable Value, MEV, was a hot topic last year. So that we’re all on the same page, some definitions:
MEV refers to the multi-billion dollar market for transaction inclusion, prioritisation, reordering and bundling. HFTs do their best to be fast, but they can also bribe miners to be ordered ahead of other transactions within the block. Miners, as economically rational actors, pick the transactions with the highest gas price and order them accordingly in the block they are producing.
A key example of MEV in action is frontrunning. Frontrunning is when Transaction A is broadcasted with a higher gas price than an already pending Transaction B so that A gets mined before B.
Sandwich attacks are when a a victim trades an asset, but a bot purchases the asset before the trade is executed, resulting in a raised price for the victim trader. The bot then dumps the asset, reaping the profits.
MEV is not necessarily entirely bad. Many DeFi projects rely on economically rational actors to seek and fix economic inefficiencies like DEX arbitrage to make their protocols and dApps robust. Sandwich trading, however, results in an unequivocally worse experience for users, who face increased slippage and worse execution on their trades. MEV extraction is also becoming increasingly centralised by being limited to permissioned dark transaction pools that have access to significant hashrate, or through unilateral off-chain deals between large traders and miners. This goes against the core principles of blockchain- permissionlessness and decentralisation. And at the broader network layer, generalised frontrunners and gas-price auctions often result in network congestion and high gas prices for everyone else trying to run regular transactions.
Now, as you might have guessed, FBA partially solves for MEV given that there is no difference in price at the block level. This is genuinely exciting and innovative and solves a lot of the aforementioned associated issues.
But as Sei’s founder, Jayendra Jog, has explained, even though order has stopped mattering within a block, MEV can still have deleterious effects between blocks. If MEV available in one block exceeds the standard block reward, validators are incentivised to reorganise blocks causing consensus instability, or exclude other people’s profitable transactions from a block and including their own transactions instead.
The reason I find Sei interesting is that again it has publicly addressed the issue with adequate nuance and balance. Not only have they conceded that they cannot ‘solve’ for MEV, they have considered how they might take advantage of it for the benefit of users and investors. If some MEV is inevitable, then why not at least make it a more democratised and transparent process, and redirect the revenue flows to better places?
Most chains rely on transaction fees and most DEXs rely on trading fees. But as we’ve seen in the rise of consumer trading apps like Robinhood, these fees will eventually converge to zero. And so a chain with sub-penny transaction fees for organic users has no path to meaningful value accrual for tokenholders. This is why Solana, despite its incredible technology, is working with an extremely broken value accrual model as the fees are so cheap. Solana executes around 33m transactions per day, yet only makes 188.37 SOL in fees (about $6k).
Sei plans to use a Flashbots style auction where searchers can privately submit transactions to a block builder, who then runs a first price sealed bid auction to select the winning transaction. The block builder then submits bundles of transactions to the block proposer, who receives the tip for including the bundle at the start of the block. Everyone ends up better off, as more opportunities become more well-known and more searchers compete for the same opportunity, so the price of the bribe converges to the price of the opportunity and validators/delegators capture more of the total MEV revenue than the sandwich attackers. This is a better, more sustainable way of being rewarded for helping to secure the chain than transaction fees. Sei has also suggested plans for the block proposer to share the tip it receives with the users that have delegated to the block proposers, accruing more value for the chain.
I’m surprised at how interesting this is. The uniqueness of Sei comes down to how it orders and processes transactions to optimise for liquidity and fees. That’s not as sexy as discussing the liberation or democratisation of consumer finance — but that’s actually what the implications are. What’s sexier than fundamental technological innovation?
The thing is, for a decentralised exchange to work, it needs people to buy assets, and it needs people to sell assets. To attract liquidity, it needs revenue. To generate revenue, it needs liquidity. And here we find the dilemma facing all DEXs and the crux of why I think on-chain orderbooks like Sei have the potential to really crack this. Building its own CLOB means it can optimise the way transactions are processed and ordered through mechanisms like FBAs to get the narrowest spreads and maximal liquidity from HFTs and eliminate inter-block MEV and capture intra-block MEV as revenue for the chain. Hopefully that sentence means something to you now…
If you’re building on Sei, or are even building your own DEX or CLOB- we’d love to hear from you at White Star Capital. Please get in touch at email@example.com.
Sources and Materials on all the above can be found in a list at the end of the original publication here.