Elevate Your Rollup Security: Tackle MEV Risks in Custom Layer2 Chains
Tags: rollups
Published: 2024-02-06 08:29:37

<p>The concept of decentralization that established a financial system which is worth roughly $2 Trillion in just over a decade sounds simply majestic. However, the rate of adoption has triggered the need for alternate scaling solutions to help match the demand. That’s how layer2s like <a href="https://www.zeeve.io/rollups/">rollups</a> came into the picture.&nbsp;</p>
<p>But, in doing so, the ecosystem has been exposed to an erstwhile risk termed MEV attacks, which are compromising the ethos of decentralization yet again. In this article, we will dive deep to understand what MEV is and what the way out is to deal with the same for Layer2s.&nbsp;</p>
<p>This is quite important to discuss as the risk of MEV extraction is higher in layer2s compared to what it is in L1s.&nbsp;</p>
<figure class="wp-block-image aligncenter size-large"><a href="https://www.zeeve.io/rollups/"><img src="https://www.zeeve.io/wp-content/uploads/2024/01/Give-your-rollups-more-power-with-trusted-3rd-party-integrations.-1024x130.jpg" alt="" class="wp-image-58651"/></a></figure>
<h2 id="h-what-is-mev">What is MEV?</h2>
<p>In its erstwhile pristine form, MEV stood as Miner Extractable Value, where the miners would request transaction fees and block rewards as their motivation to mine the blocks. However, over time, the concepts were rescripted in a manner that compromised decentralization principles of transparency, privacy, and trustlessness when miners/<a href="https://www.zeeve.io/validator-nodes/">validators</a> (In <a href="https://www.zeeve.io/blog/a-complete-guide-on-proof-of-stake-pos-in-cryptocurrency/">PoS</a>) started to arbitrarily reorder transactions by resequencing them in a manner that could trigger front-running and back-running, which caused serious harm to the users.&nbsp;</p>
<p>Hence creating negative sentiments around MEV even though blockchains shifted from PoW to <a href="https://www.zeeve.io/blog/a-complete-guide-on-proof-of-stake-pos-in-cryptocurrency/">PoS</a>. But can’t we not just do away with the MEV? Why embrace it if it is evil?&nbsp;</p>
<h2 id="h-why-does-mev-matter">Why Does MEV Matter?&nbsp;</h2>
<p>Because MEV is a necessary evil that cannot be ignored. Why? Despite many MEV attacks like <a href="https://www.coindesk.com/business/2023/04/03/ethereum-mev-bot-gets-attacked-for-20m-as-validator-strikes-back/">this one</a> that happened in 2023, which had cost users a loss of $20 million, &nbsp;it is turning out into a necessary evil because a permissionless blockchain to prevent spamming on its network which might significantly increase the network activity and prohibit transactions, MEVs play a key role.&nbsp; Without an MEV, we might see the problem of Priority Gas Auction.&nbsp;</p>
<p>Yuga Labs OtherDeed’s Land Sale is a perfect example to quote here.&nbsp; In the absence of a&nbsp; specific sale format, the users had inundated the network with spammy transactions requesting inclusion for a gas fee of 2 <a href="https://www.zeeve.io/blockchain-protocols/deploy-ethereum-blockchain/">ETH</a>; however, all those transactions failed eventually, which significantly impacted the UX on the <a href="https://www.zeeve.io/blockchain-protocols/deploy-ethereum-blockchain/">Ethereum blockchain</a>.&nbsp; MEV averts this but it creates more problems than it solves in a <a href="https://www.zeeve.io/rollups/">rollup environment</a>. How?</p>
<h2 id="h-how-roll-up-are-struggling-under-the-mev-attacks">How Roll-up Are Struggling under the MEV Attacks?</h2>
<p>In the <a href="https://www.zeeve.io/rollups/">rollup</a> environment, the core objective of the ecosystem is to provide near-infinite scalability to the network. However, to do that, they have to settle for a single operator/sequencer, which should ideally arrange all the transactions as they occur. However, instead of that, what the Bots do is sniff out the possibility of a profit since they can easily see the content of the transaction, whether it is a buy or a sell. Now, what the bot would do is place a transaction immediately before or after the transaction to extract maximum value.&nbsp;</p>
<p>For example, if there’s a huge purchase of an asset x for example which will increase the price. The bot would place a transaction immediately before that transaction to maximize bulk purchases and sell the token thereafter. So, a transaction is placed before the victim transaction and after the victim transaction. In this way, the user might lose a lot of money and opportunity if the <a href="https://www.zeeve.io/rollups/">rollup</a> continues to do that. We have already seen such happenings where the users have lost over<a href="https://cointelegraph.com/news/sandwich-trading-bots-lose-bread-and-butter-in-25m-exploit" rel="nofollow"> $25 M</a> in funds due to the sandwich attack.&nbsp;</p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6gmnqwhk6ih4krbtxfsr.png)
<p>What if the roll-up environment wishes to avert the same through a FIFO approach? It will be a two-edged sword for the <a href="https://www.zeeve.io/rollups/">rollup ecosystem</a> because while using the FIFO method, the rollup must include all transactions as they occur. Now, the drawback of this approach is that ideally, it is not necessary that all the transactions that are ordered in a sequence would help extract maximum value. So, it might be the case that the rollups blockspace might remain underutilized while it has to process the transaction. In this way, it will make the efforts of sequencing disincentivizing. The need of the hour, as a result of <a href="https://www.zeeve.io/rollups/">rollups</a> is to devise a solution that safeguards the interest of the chain along with the users.&nbsp;</p>
<h2 id="h-how-can-rollups-deal-with-the-mev-problem">How Can Rollups Deal with The MEV Problem?</h2>
<h3 id="h-decentralising-the-sequencers">Decentralising the Sequencers:</h3>
<p>Through decentralized sequencers, it is possible to arrange transactions, restoring trust and transparency based on consensus instead of centralized sequencers dominating the array of arrangements of the transactions. Along with this, <a href="https://www.zeeve.io/blog/banking-the-unbanked-defi-promoting-financial-inclusion/">decentralized</a> sequencers also protect the rollup environment against single point of failures and malicious intrusions which protects the network against the MEV attacks.&nbsp;</p>
<p>As you can see from the above image, decentralized sequencers impart a trustless environment, immutability, censorship resistance, resistance to a single point of failure, and reduced intermediaries, which establishes a very high trust element but ideally achieves the same. They also expose one key point of failure, which is high latency and increasing cost because consensus from multiple nodes participating in the auction to finalize an order might slow down the process and compromise the scalability. Plus, a decentralized sequencer might not be necessary for all applications.&nbsp;</p>
<h3 id="h-using-some-anti-mev-tools">Using some anti-MEV tools</h3>
<p>There are many tools that can help you deal with MEV attacks, like TX Relay APIs and RFQs, but what Shutter is doing is something that one should look forward to. Let’s see how Shutter is helping deal with the MEV attacks on <a href="https://www.zeeve.io/rollups/">rollups</a> without using any decentralized sequencer sets.&nbsp;&nbsp;</p>
<h3 id="h-what-shutter-is-doing-in-this-regard">What Shutter is Doing In This Regard?&nbsp;</h3>
<p>Shutter Network is all set to provide MEV protection to all the <a href="https://www.zeeve.io/rollups/">rollups</a> on the <a href="https://www.zeeve.io/blockchain-protocols/deploy-ethereum-blockchain/">Ethereum chain</a> through its Distributed Key Generation (DKG) scheme in its rollup sequencer mechanism. With this upgrade, all the information passed to the sequencers through the mempool by the searchers is encrypted through Dark Forest until it passes the sequencer step. The Dark Forest will run all the transactions in the order of the encryption-proof keys in the following manner.&nbsp;</p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/be6n3x7afjg6ao7i8geu.png)
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Source: Shutter Network</p>
<p>Now, these encrypted keys will be shared with the Keypers responsible for assessing the authenticity of the order of the transactions. If they find that any transaction is off-track or not in order, they will run the proofs and match the same with the Merkle Hash and followed by that, it will be added to the block. Now, the <a href="https://www.zeeve.io/rollups/">rollup environment</a> will check the batches and match the same with the DKG or Distributed Key Generation Protocol, and if they are in order, it will trigger the state change on the rollup. Now, if some of the rollups, if they are using a different sequencer set, they will have to decentralize their sequencer sets using the Shutter DKG else they will have to compromise on latency because shutterized <a href="https://www.zeeve.io/rollups/">rollups</a> give the privilege of using a centralized rollup solution without compromising on security and privacy.&nbsp;</p>
<h2 id="h-zeeve-raas-offers-ready-made-integrations-to-add-custom-functionality-in-your-layer2-rollups">Zeeve RaaS offers ready-made integrations to add custom functionality in your layer2 rollups</h2>
<p>Want to integrate tools like Shutter Network with your <a href="https://www.zeeve.io/appchains/optimistic-rollups/">Optimistic</a> or <a href="https://www.zeeve.io/appchains/polygon-zkrollups/">ZK Rollups chain</a>? <a href="https://www.zeeve.io/">Zeeve</a> integration partners let you do that. Instead of building naked <a href="https://www.zeeve.io/rollups/">rollups</a>, you can augment your rollup capabilities with easily pluggable components like Alt data availability layers, shared sequencers, decentralized oracles, account abstraction SDKs, indexers, and many more <a href="https://www.zeeve.io/integrations/">additional integrations</a>. You can choose to build with any rollups framework using Zeeve <a href="https://www.zeeve.io/rollups/">Rollups-as-a-Service</a>, including <a href="https://www.zeeve.io/appchains/polygon-zkrollups/">Polygon CDK</a>, <a href="https://www.zeeve.io/appchains/zksync-hyperchains-zkrollups/">zkStack</a> from zkSync, <a href="https://www.zeeve.io/appchains/arbitrum-orbit-rollups/">Arbitrum Orbit</a>, or <a href="https://www.zeeve.io/appchains/optimistic-rollups/">OP Stack</a>, and choose your other modular components.&nbsp; <a href="https://www.zeeve.io/">Zeeve</a> also offers a 1-click sandbox and fully managed deployments for <a href="https://www.zeeve.io/rollups/">rollups</a> and <a href="https://www.zeeve.io/appchains/">appchains</a>.&nbsp;<br>Have further questions? Not quite sure what infrastructure might suit your needs? <a href="https://www.zeeve.io/talk-to-an-expert/">Reach out to us</a>. Our experts can help you decide based on your needs.</p>