# Modular sequencing | Optimism Summit 🔴✨ The Future of Ethereum - Norswap Laurent

- Channel: [ETHGlobal](https://streameth.org/ethglobal)
- Date: 2022-10-09
- Duration: 33:07
- Topics: Science & Technology
- Watch: https://streameth.org/watch/yt-aKxS16TG2jk
- YouTube: https://www.youtube.com/watch?v=aKxS16TG2jk

## Description

Join Norswap Laurent of Optimism for a talk titled "Modular sequencing" - Part of our Optimism Summit 🔴✨ The Future of Ethereum.

ETHOnline is our biggest event of the year! Collaborate with thousands of developers and creatives from around the world and win over $300k+ in prizes! We're bringing in 30+ of the biggest teams in web3 to give you access like never before. Learn from ecosystem leaders and build your biggest ideas as the merge nears reality. The future of Ethereum is being written right now, and it's time to make your mark.

---------------------------------------------------
Follow us: https://twitter.com/ETHGlobal​
Check us out: https://ethglobal.co​m
Email us at: hello@ethglobal.com

#ethereum #web3 #blockchain

## Transcript

foreign [Applause] [Music] swap who's going to be talking about modular sequencing nor swap welcome happy to have you thanks for being here okay I'm going to be talking to you about modular sequencing so I want you to know that I did not come up with the title of the talk uh otherwise we have been transaction ordering is a social construct who watches a sequencer energy as everywhere wow that's a lot let's unpack that first of all none of this is future plans we haven't decided what we're going to do about this stuff these are just some thoughts and ideas to explore design space Okay so uh you know don't make investment decision or whatever based on this uh just don't do anything stupid really um so modular sequencing core talked about how the up stack is Mother and just like everything else sequencing is something you can change in the op stack okay so what's sequencing sequencing is picking which transaction to include in blocks and how they are ordered okay and also who sequences these transactions right um and so who gets to pick and what do they pick how do they choose so first we're going to be talking about who and today it's us it's up labs that runs the soul sequencer so we get to pick your transactions in practice we just pick them in the order you arrive first in first out it's very simple we haven't done another work on this yet uh what could go wrong uh no comments but you get some idea uh censorships all that bad stuff so what you want to do really is decentralize the sequencer which means having multiple sequencers that cooperate to come up with uh blocks okay and so what are our goals when we say sequence red centralization there are two goals really one is liveness such that if a sequencer were to go down uh the network the L2 chain keeps progressing anyway very important the other one is censorship resistance and that's like making sure that we oplabs cannot make your transaction be censored forever and that nobody can force us to do that either right the non-go of this is safety uh optimism is safe but the mechanism that we use to ensure safety is not this it's the fault proofs okay so even if there's a single sequencer then the the chain is safe nobody can steal your money but decentralization is important nonetheless uh for questions of censorship resistance in liveness so how do we decentralize um like if we're showing there's a short-term view in a long-term view there are things that are easy to do and things are harder but maybe more interesting and so at first the idea that we're playing with is to have a low number of permission sequencers and two of them run around Urban round robin so what that means is that there will be one sequencer it would take care of a certain number of Alto blocks like 10 or 100 we need to figure that out and see what's feasible and then it would be the turn of another sequencer would do the same okay and so if one sequencer is misbehaving or censoring or things like that he would only be able to do that for a certain number of blocks before another sequencer takes over and if we diversify the set of sequencer well enough we put them in different countries and we make sure that they have some vested interest not to misbehave so uh this should be like known entities they have some reputation or maybe they put a bond that the governance could take from them if they misbehave uh then we ensure that at least one of the sequencers is going to behave correctly and the chain will make progress and your transaction will be included so there's another model for this which is uh interesting it's called meva and meva stands for Mev auctions we'll talk about energy a whole lot in in the rest of this talk but maybe if you don't know what it is you can think of it as the Arbitrage profit right if some token is cheaper in uni Swap and it's expensive on velodrome while you buy it initial episode on third room you make money who gets to make that money well the first person that notices this and does it and who gets to decide who's first while the sequencer okay so sequencer is able to capture this profit if he's aware of them um and so yeah and so since there's a lot of money in this basically one way that you could say that the sequencer could that the sequencer could be decided among a set of sequencers the sequencer that bids the most uh gets to sequence the Box okay there are questions here right like we you don't want to make to make it so that the same sequencer wins every single auction so you still need some kind of mechanism to ensure that this does not degenerate in a really bad scenario but otherwise that's a pretty solid one to uh decentralize and also uh make sure we capture some some value through images and I'm going to come back to mvg later all right so another model that's interesting is that we could just go and say well optimism will behave like a small blockchain like Abduction that's not very decentralized like some of the blockchains in the cosmos ecosystem or even Solana um and then we'll run some consensus on all these sequencers and they will come up with a block and then that's the block that will propose to the L1 chain um yes let me see if I need to add something on that I think I've covered everything uh yeah and the thing that that this small blockchain is not very decentralized doesn't matter because like I said before the safety comes from the fault proof okay so even if you have a 51 attack it doesn't matter it's just a way to ensure that um again the network is live so even if notes go down it still works and nobody can censor because this mechanism is going to pick different uh people to propose the block each time and there are many existing consensus contents algorithm we could use for this we could even reuse the uh proof of stake algorithm from ethereum or we could use with something simpler like temperament uh the reason we don't need to reuse the algorithm from ethereum is that the ethereum profit stake algorithm is made for a huge number of validators right and we're only dealing with a a small number at least at first um so I've been saying yeah sequence circuit misbehave if they can they can do things they shouldn't do and so I want to like list the the ways in which sequencer could misbehave so a sequencer can lie and just uh include transactions that don't work um if they do that if they submit that transaction they just they will just be ignored basically uh other sequencer will just read them and say this is it doesn't work and so they'll be ignored the other role of a sequencer so one order of sequencers to pick the transaction and propose them the other role is to submit output routes okay output Roots is a commitment to the result of executing your transactions and if a sequencer submits bad output routes then the fault proof can prove that these are bad and the sequencer will be slashed and so it will lose the bond and deposit it so it's economically unsound to do this the other things that can go wrong uh the sequencer can go can go down meaning that you will not do his work or it's supposed to do you can censor and then it can misbehave it in terms of Mev and we'll see later what that means but say we decide that optimism we don't want uh sandwiching okay if you don't know what it is I will explain it later but or think front running if we decide that we don't want that but the sequencer does it anyway because technically he's able to then what we can do in those cases where a sequencer is done all the time is sandwiches when we said that we don't want that or sensors then governance can take some action and uh just you know ban the sequencer basically and that works if the set of sequencers permissioned right if we if you had to apply to become a sequencer and you have to be accepted then you can ban you and then you can reapply if it's permissionless we can't really ban you right you'll just go to another server get a new IP and then join again uh in that case it's necessary to have a bond that that governance can slash and basically take your money okay uh like you saw there's a lot of ideas on how we can do this but the point I want to make is that all these models are compatible with our current architecture we can just slot them in and so that's very exciting uh we have like a free reign to to come up with the best Solutions in the short term and then in the long term all right second topic on modular sequencing what technology sequencing well how do we pick the transactions and surprise this is a talk about Mev okay uh you might have heard about MVP you probably have but just in case what is MV is value that can in theory be extracted by the actor that's the port of ordering transaction so in Instagram proof of work there was the miners improve State it's divided and on layer 2 and optimism is the sequencer some people also call that maximal extractable values but whatever so how is energy extracted and this is a computer okay there we go um so how do you extract energy so there's a different kind of energies and we're going to review uh the different major cans in a bit that will make it like much clearer but uh let's take the example that was before of an Arbitrage if nobody knows that the Arbitrage exists you can just send that transaction do the Arbitrage boom you won except people might be watching the mempool if it's public they can see your trade they can see this is a profitable trade what if I do it before this guy or uh I put higher gas fees so I will be included first and so people can actually steal your transaction this is called front running so in general you will need to outbid other people so in ancient times of the actual blockchains people did exactly this they did something called price gas auction which means they uh put a really high gas price to be the first in the block and the miners will include them based on the gas price then came along a little company called flashbots and they released a software called mg Gap and they offered and if you get to all the big mining pools and basically how it works is uh if you are someone that wants to extract Mev an arbitrary and now we call them Searchers I mean researchers you will send your transaction to flashbots flashbots will relate them to the miners and miners will include them in their blogs based on how much you pay the miners a very important thing that flashbots does compared to Precious action is that it guarantees that if your transaction is included it will not revert which means that basically you can send a lot of money you'll basically check if you get the Arbitrage and if you get the Arbitrage you send a bunch of money to this to the to the sequencer or the miner Etc another thing that flash button enables is that it enables you to send not only transactions but also transaction bundles and so you can see a transaction in the mempool and you can put trades around so before and after that and that enables you to something called sandwiching and we'll see that in a second and uh people don't like that usually um this system has a flaw that is not often discussed is that all the the mining pools that run images they can see all the trades sent by The Searchers okay and so if they wanted to they could front run all the Searchers they could just steal their trades uh they don't do this because they know that if they do this they have a lot of reputation and then if they are found out they may they might be kicked out of flashbots which will end up costing them much more money than they can hope to make by uh by basically stealing a transaction but they could and this will be important later uh then we switch to proof of stake and in proof of stake uh flashbots are proposed a new system called Mev boost energy boost is something called a proposal Builder separation system or PBS and basically you get a an a new entity which is block Boulder that builds the block and then you got the uh block proposer and that's like a validator so if you're picked as a validator in ethereum proof of stake you can asked block Builders to to bid for the rights to pick the transactions in the block and then the black Builders will now act like the demanding pools in the previous model so they will probably run energy gap or something like that to get transaction from The Searchers so why did we change this model the reason is that after proof of stake no matter what people say um the validation on ethereum is much more decentralized there are a lot of small um sticking pools a lot of small stickers and we want them to be able to make money if they get to pick a block they should also get the energy money unfortunately you cannot trust everybody with the transactions right because anybody that can see the transaction from fresh blood from mvgaf they could steal these transactions and this is okay if you're relying on like six mining pools right it's a very limited set of people but if you have thousands or even tens of thousands of value there it becomes almost impossible to say who stole the transactions and so instead you will know centralizing the the trust into these block builders and all the valid errors can contract okay so now let's like what what's a movie uh let's hear a few flavors Arbitrage if there's a decentralized exchange where price is low you can buy there and you can sell it higher on error exchange very simple uh backgrounding simply means capturing some Financial opportunity right after the transaction that creates it right that's you want to be first basically and how to be uh the first is to be right after and so the biggest example of this is on lending markets they might be liquidations because the price has dropped the price of the collateral dropped and so these Landing platforms wants you to uh take over the collateral for a price in stable coins or something like that and you will sell it but they will leave you a margin which will be your profit and so people will compete to be the person that liquidates these loans so that's like a case of backgrounding uh simply for nfts uh get get if it's a you know completely open Mint uh the first people to Mint get the nft and so that's a race you want to be first to to mention the nft uh generalized from training with an example when we say that uh pools can still trade from our people so basically you'll look at the mempool you look at all the trades right and you'll you'll try to see well if I were to do the same transactions could I make money and if the answer is yes then you just do that you just do exactly the same transaction you will just bid uh more than the other guy and then you will take the profit so that's called generalized from training generalized because you're trying this strategy over every single transaction in the mempool um then we got sandwiching okay establishing scanner complex but it goes like this a user makes a big trade say on uni swap or something like that so say it wants to buy eth with usdc the the Meb Searcher says this uh salt sees this sorry and so what he's going to do is gonna do the same trade but before him so he's gonna buy if for your CC which pushes the price up then the user is going to make the trade he's gonna have a worse price and so that also pushes the price up right so if the initial price was X after the sandwiches buys its Express a and after the user buys it express a plus b and then the sandwicher turns around and sells what he bought in the first step okay and basically he's able to sell that at a higher price than he bought because the user pushed up the price and so basically is is making the price worse for the user and he's pocketing the difference and so that's that just makes life shitty for you if you're making a big trade and people don't like this a lot there's also something called Justin Time liquidity um I I'm not sure I'm going to have time to talk about that it's it's a little bit complex to to get into all the nuances uh but this slide is there and I will link the slides later and maybe with time and we'll come back to it um I think I'll leave it if there's some questions about it basically so maybe this big business um so this is a screenshot from the flashbot Explorer which I took in August I think so this is not entirely new but it gives you uh you know an order of magnitude on these things right like on a month 8.5 million on 20 in 24 hours about 6K and in total and not sure uh how long this Trucking has been going on but like 600 million so this is a massive money that's being made here it's also highly asymmetric right like some blocks will have like massive uh Meg and some blocks will have very little mov right like if you multiply 24 hours the 24 hours number by 30 you don't get the 8.5 million so it's very like asymmetrical um about 33 of this image is paid two miners so this is not a lot right you would expect uh people to know the opportunities and basically build a lot to the miners like up to 90 in practice we don't see this yet uh maybe we'll see that in due time uh there's been 18 transaction extracting more than one million it's interesting and the biggest one has actually occurred on L2 uh there there was uh some 5 million plus Arbitrage on arbitrum a while ago so uh you know mbv on L2 already exists even though uh there's no flashbots even though there's no auction there are there are arbitrages to be made and people will make them people will make the money so energy Goods it might be bad people are often say I mean he's bad that's a naive take um someone will profit from Arbitrage like I said if there's a discrepancy in price someone will pocket that profit and I think personally it might as well be the network that enables those things and it might go to public goods and to uh a whole lot of things are that benefit everybody basically instead of just benefiting uh some guy that runs a algorithmic trading or some kind of MVP software at home he's not really doing like average versioning is useful but there's no reason you should be paid a huge amount of money for it right foreign that does a sandwich um is not providing any value on the network it is possible so there's been a paper published that says in some cases it could be better with sandwiching than not I I really doubt it is relevant in practice but you could in theory you could construct these scenarios just I mentioned this just to be complete uh but you know my convictions 100 the word would be better off without sandwiches uh nobody likes front running just you know people if you you know smell an opportunity make a good trade someone sells from you it's kind of shitty and just in time liquidity um I didn't get into detail so basically it it this one is good for users but it's bad for liquidity provider and in turn that makes it bad for user in the long term so preventing energy is dumb right people say we should just prevent the movie you can prevent arbitragers basically uh one way that some people try to prevent Mev is through this thing called Fair ordering which is first in first out um and this is not fair at all because it privileges uh organization that can build our infrastructure to reduce latency of mov extraction and so you know what's fair in that right before you add at least a competition between guys uh it could be at home and you came up with the cleverest solution and now you've uh the same thing it's as flawed but also only Rich organizations can do it uh this isn't great and if you do this you still have a problem that people will try to start spamming to capture opportunities as this is not hypothetical it's happened on ethereum free flash but it's it's happening on Solana it's happening on binance Smart chain uh and probably an L2 to some extent though not quite as bad so how knowing all this like now we've had a big picture of me you know like it's it's it's not good it's not bad uh we need a solution for it how do we make sure that we capture all this money for the protocol for the public goods for the ecosystem and there are a few uh actually solutions for that so yeah the goals uh capture value for the protocol as I just said uh make the user experience good for users and so uh for me that means no front running and no sandwiching uh this sometimes something people uh argue with uh they're wrong you know like fight me uh maybe we'll get some some interesting questions around that but basically this this works pretty well and it is actually feasible to to achieve that and I'll talk briefly about how we can do that and then they centralize effectively so all the MFE solutions that we came up with must be compatible with sequence recenterization as we talked before it's extremely important to decentralize so how do we do it basically we want to run some options just like flashbots um one thing we could do is just run images and sequencers the thing is that with bedrock we'll have two second block time okay and so two seconds is not a lot of time and if you have to you know people need to send their transactions to Mr Gap into simulate the blocks you'd send that to the sequencer maybe the latency starts to add up and two seconds is a little bit too tight what you could do instead is do uh mbva so that's mfv auctions uh via something like energy booster energy boost basically does MFE auction actually and then you would um you would offer you would sell basically the rights to sequence more than one block you could sell right to sequence 10 blocks or 100 blocks or something like that um so that's uh for mechanism so making auctions make sure the protocol captures value and then we could also uh impose some rules on how muv can be captured and so the simple effective rule is no front running if you can't front run you can also count sandwich and you can sort of enforce that on the short term you can have uh governance oversight so basically we say to the sequencers guys it's not allowed to uh frontrun and if the uh violate this rule then we can we can slash them or we can bend them just like we discussed before this is not great right because we have to monitor uh what the sequencer are doing and uh make sure they don't do this and then we have to do a governance vote it's a lot of like drama and people need to vote Etc um like I'm I'm of the opinion that generic governance should be minimized whenever possible in this case it is indeed possible via Technical Solutions okay and these Technical Solutions basically uh work in two steps the first step is to remove the power of the sequencer to order transactions all together and there are basically two solutions that are being talked about in the space right now the first is a first Universal Oracle so chain link has a solution identical first sequencing Services again this has nothing to do with furnace blue and the other one's called threshold encryption and that's a solution that a company called shutter network is working on and there may be other people working on that uh yes there is another company uh whose name I forgot entropy maybe entropy but I'm not sure but in those cases basically you have a networker node that provides an ordering for the sequencer to respect right in the first in first out Oracle Hollow works is that all the nodes in that Network in the first sequencing Network they will recite or receive a bunch of transactions and they will say they will give their ordering a transactions and if a majority of them are honest then it's impossible to front run basically in a threshold encryption case you will send your transaction encrypted to nodes in the in the network and they will make an ordering of the encrypted transactions nobody knows what what's doing what the sequencer will sign on the ordering and then the network the shutter Network for instance will come together create a key to decrypt all this transactions then you you get them decrypted after rece said yes for sure I will use this ordering so that's how you take the power away from sequencer now you can't order anything and so as a user refuse that's the solution you know that you won't be FrontRunner Center Etc or anything like that the next step is to reintroduce some form of actions because we still want to capture energy and we still want um that value to go through protocol and to public goods how you do that is that you conduct two kinds of actions ideally at top of block auctions for things that should go at the top of the block so see uh say last block after the transaction will revealed you're like oh there's a massive Arbitrage now where you can bid to be on top of the next block and then some uh transaction also creates a massive mov just like uh let's say um Oracle updates and so this could be in a public pool and people could bid to back from them the reason why you could say well why don't we just put um Oracle updates encrypted and then we reveal them and then people will bet to be on top of the next block that doesn't quite work the reason why it doesn't quite work is that people will know the Oracle is coming and they will start spamming to be uh by luck after it right they'll just like spend a whole lot and then uh they will get they'll get to be in the same block uh after the encrypted Oracle update so you have to you have to do something special for them you have to allow background options basically and I think this is the end of okay in the DNA representation so some conclusion there the first coronation of the op stack they are flexible and you can easily change sequencing and we will indeed work on that in the future and the goals with uh change sequencing would be to decentralize for liveness for censorship resistance and to extra energy so that we accrue value to a protocol and the ecosystem and the public goods uh what are the best Solutions well that's still we're still thinking about that we're still talking to people in the industry uh if you are smart and you have some ideas there feel free to message me uh I love to talk about that stuff and there are short-term and long-term Solutions uh on short term we can use the governance as a crutch to sort of say hey guys behave or else but in the long run there are Technical Solutions that we can Implement that make sure that no matter what you can't misbehave all right I've been North swapped you can find me uh basically everywhere my handle is no shop including on Twitter and uh yeah if if people have questions I think we have a tiny bit of time hey another swap good to see you man hey there how's it going good yeah thanks for your talk um there were a couple questions so I'll just kind of ask them to you here directly yeah so yeah so first question here is just about kind of the fraud proofing and how that works is it you know somebody individually is submitting um that there's kind of a fraudulent thing that's happened and if that's the case then you know how would you go about preventing people from front running the the fraud proof basically and getting the reward for doing so oh that is that's such a good question I love it um yeah that's a difficult question I think like the the disappointing answer is that you would go through something like flashbots that has like sort of an uh a trust agreement not too frontrun uh because otherwise it's really difficult um I I thought I've thought about this a little bit like we're not quite there yet we still need to build actually like the the the technology of the fault proof fully and this economic part comes even after that um but I've started a little bit with like trying to compensate people that like contribute but it's really difficult because then you can just like sort of copy what other people are doing without doing your own work and you don't want that either so it's a real problem gotcha and then another question that came up uh was and I know we have one minute left which might not be enough time but uh you know you mentioned as one of the uh the ways to deal with a cat is here uh to deal with uh Mev is sort of you know threshold encryption is one of the kind of the ideas that uh that's been put out for for managing this can you maybe chat a little bit more about like the interaction of threshold encryption and Mev and kind of how that might be a way to mitigate it yeah so threshold encryption basically um alternative encryption I should first explain is you have like this private key and you split it between all the a bunch of people and in this case the nodes of a network but the public key is known to everybody and so as a user you encrypt your transaction with the public key and only when the node come together to create the private key can you decrypt the transactions and so it's a way to basically remove the the power of the sequencer to order a transaction because now you are ordering uh encrypted transactions you have no idea what's going on there and then the sequencer will commit itself to them and then later we can reveal and so it's a way to make sure basically you can't front run uh or or sealed opportunities or sandwich things like that and if you want to extract energy then you need to introduce auction but you can do that in a way that you can't uh do these bad things basically gotcha awesome okay cool well thank you so much for being here and uh running through your talk with us modular sequencing which was actually um just a secret Mev talk in Disguise um at almost all of them are uh but yeah thanks for being here North swap really appreciate you taking the time and uh if anybody else has any questions uh Feel Free as norsab mentioned to grab them out any platform at norswell cheers thanks a lot love that see you around
