Shutterized Gnosis Chain by Jannik Luhn (Shutter Network)
Nethermind · 7 Dec 2023 · 15:11
Jannik Luhn of Shutter Network explains how an encrypted mempool can protect Gnosis Chain users from front running. Transactions are encrypted before they reach the mempool and decrypted by a threshold committee of nodes only when it is time to execute them, so block proposers cannot see or react to what a transaction does. Luhn covers the trust assumptions behind the committee, why this beats a two-step key reveal for users, and an encrypting RPC server wallets can use before apps integrate the feature. A collaboration between Gnosis, Shutter and Nethermind, presented at Nethermind Summit Istanbul, it also strengthens censorship resistance.
Speakers
Topics
From Nethermind; community: Nethermind.
Transcript
[Applause] thank you you also have a very nice logo maybe you can later so um yeah I'm going to talk about CH Clos chain uh which is a project that I work on um where we're trying to make no chain um a little bit more secure and user friendly um this is actually a collaborative effort between um nor chain of course sh Network which is where I'm from and the ne M team which is um maintaining the main client of no chain so they have to implement a lot of that stuff that I'm going to talk about um uh yeah maybe as an intro a little
bit of about no chain if you if you're not familiar with it it's an ethereum um like chain it uses kind of the same protocol also supports the same clients just a different um uh configuration parameters but it means it's maximally compatible to ethereum it's basically the same thing um just as a different state of course um different from ethereum it's much deeper to use typical transaction costs are less than 0.01 cents um and it's also a little bit faster so the block time is 5 Seconds instead of 12 on ethereum um this does not come at a great cost of decentralization um no chain is um very decentralized um has
about 2,000 notes typically uh in um 7 different countries which is like one metric you can use to measure decentralization um and maybe in the future it could um act as kind of a test bet for um um for future changes to changes to ethereum so um since it is very similar technologically um and also value LED with ethereum um it's um it's it's very much possible that um changes that are going to be rolled out on ether will be kind of implemented first on no chain um because it comes with lots with like less risk basically because there's much less at stake yeah and yeah from personal experience I can say it's a
very nice place to uh to be um I do a lot of site projects sometimes and um deploying them on those CH always very easy and fun all right so the problem that we're trying to solve is called front running the main problem um if you don't know how it works um I can give you an example say there's Alice um and she wants to buy something on on a exchange something you Ty do on blockchains U um what you have to do is you have to make this um um transaction that you're going to send public in the men pool um and it will only be included later which means like lots of people will see it on the way into a block including the block
proposal and other people who who see this transaction can now react on that transaction and um send transactions depending on on that for example Bob could um try to send a transaction the same transaction buying the same token um on the same exchange before Ellis and then selling a token selling the token after Ellis um why would Bob want to do this usually because Lis buying the the token means that the price will go up and um by buying for and selling afterwards Bob can make risk-free profit so that's very nice for Bob but it's very bad for Ellis because Ellis gets a wor price basically it's a value transfer from Ellis to ball we don't
don't really want this um yeah it's kind of a general problem lots of block chains have this and I would say it's actually one of the most significant limitations that blockchains today still have and it's one problem that we're trying to solve here uh how do we do this using an inced man pool so same thing say that Ellis wants to buy something on the exchange um now she will encrypt that um her transaction um now in principle Bob can still will still see this transaction and Bob will be able to another transaction front and after but since Bob doesn't know if if Ellis is buying a token on which exchange she's buying it or or she's selling it or if she's if
it's just a value transfer um Bob can't effectively um can't extract any Val value from that which means if um attack is not possible anymore and it's kind of a nice side effect this always incre a sensorship resistance because if you for example if the block proposer tries to sensor Ellis or sensor a certain um application on the Chain um he will not be able to do this um if he doesn't know what what the transaction does now if it's the transaction is encrypted in the chain it's not very helpful at some point we have to decrypt it in order to execute it um and there's multiple ways what we could do this kind of the most natural would be to ask is to send a incription key later
um to do this unfortunately that would be like that would be very simple to implement but kind of annoying to to use for because she would in order to um do one thing buy something she would have to send two transactions or two messages to the chain um with like a time delay in between um so if she would go offline in the meantime um um like this would fail and it's in generally not a very nice user experience and the other problem is that um um Ellis would could decide later depending on what's what happened in the chain if she wants to um send this transaction at all or not so she in a way she could should she could cancel a transaction she wanted to do earlier and
this would break like many applications so we can't really do that instead what we're proposing here with sha and what we providing to this project is um a threshold committee so what's that it's basically a set of notes in the network um that um yeah whose job it is to collectively produce um these first an encryption key that would be public that anyone can use the encrypt transaction and then under request by the protocol uh when it's time to decrypt this um committee will also produce the um corresponding decryption Keys um this there an honesty assumption so um we need to trust that this
committee does not produce uh Keys too early because then they will be able to front run um and we also need to trust that they actually produce them um um eventually because otherwise the protocol would kind of fault and would be unable to decrypt the transactions um so and the number of notes of that committee so we don't have to trust every individual we only have to trust them collectively usually like two3 of them which is uh yeah like a parameter we can choose um and how to how do we make sure that this uh set is actually trusted we have a dow that kind of hand selects them so this Dow um the job of the Dow is to make sure that they come from like a diverse background from different um
regions different jurisdiction um and that just different entities are together so that they're not just so that there's not one entity that can take over the whole set all right that was kind of the theory how it works in in theory uh now the question is how do we actually implement this in the context of no ch um and first to um to start off um kind of the guiding principle that we had when we kind of designed the the protocol um was to minimize risks and minimize complexity and also minimize the ux impact so there no CH is already real life we don't want to break it of course um and we want to kind of roll it out um as slowly as possible or not as
slowly but as safely as possible without breaking things that already exist including breaking the kind of ux um flow that users already have this means for the first version that we actually preferring having trust assumptions over uh protocol changes which means we don't have to uh for the the network as a whole in the first version but um the once we have this implemented then from there we can go iteratively uh step by step improve it um go from um yeah reduce the trust assumption and um um yeah but at the cost of actually changing the rules of the protocol and um requiring a for if the community wants this of
course all right so this is kind of the um um kind of a sequence diagram how um how the flow would work we have the keepers here um they start by producing this master encryption key that I mentioned we call it the Eon key and they have to send it somehow to the users they need to have this key for that we use this uh kind of a key broadcast contract so it's a normal contract deployed on nor chain that the keeper sent this key to then the users can fetch it from the contract use it to an their transactions and send it to another contract called the sequencer contract the sequencer contract now the job of that contract is to um yeah include those transactions um filter
them potentially like um according to whatever rules this contract wants to implement for based on uh the fee that they pay and another job of that contract is also to order them uh um in the first version simplest version probably also ideal version is just fast comp stuff now um the keyers will watch this sequencer contract and once um the time comes to to dgroup these transactions they will produce the corresponding decription keys they will then send it to Via PP Network to the proposer the proposer job is to build a block so they will take the decryption Keys um check the decrypted the encrypted transactions
um and decou them and put them in the block and yeah that's basically how the protocol works as you can see uh like this is mostly added components um the um only um uh component that doesn't exist yet is um the proposer and we can see uh that already exists is the proposer um we can see that we add like additional duties that this proposal now has but in the spirit of these guiding principles that I mentioned earlier um not breaking things not requiring a hot fog um we make this these additional duties opt in so we will have a a registery contract where proposers can opt in if they want to support this
effort they can um register and um say I will yeah do this job and let everyone else know that they do this job and then they yeah um fulfill these um um duties hopefully but at the moment we don't really have um there's no um uh no enforcement of of these duties we just that's the trust assumption that I mentioned we trust that they actually do this if they don't um um I mean the project doesn't work anymore but at least the the chain continues um working um one thing to not here this is uh these trust assumptions are like uh
yeah basically what I said like it's not like we um adding trust assumptions to this existing protocol it's just trust assumptions for this added functionality in the worst case we fall back to existing um yeah to the existing protocol in the future we will make this um hopefully more um um yeah we will enforce this more strongly um in the first place we will will make participation mandatory so all validators will have to participate then we will um at some point slash them if they produce blocks that do not fulfill these rules so if they uh decide to produce a block uh but don't include the encrypt the transactions for example or front run their transactions in in this encrypted
part then we will slash them forther so that they lose some money um and as a last step but this would now require an actual H fog we will make these blocks actually invalid so this is something we can check that the order of transactions in the sequencer contract matches the contract the transactions in the block if that doesn't match then the networ will just reject the block and ignore it so it will basically be impossible to not follow this rule anymore and that's basically then the ideal and strongest enforcement of these rules um user experience that's another thing we want to keep as simple as possible um nor transactions nothing changes users will still be able to send
um PL Tex transactions as they do now but if they want to use this additional feature of using encrypted transactions that would be front TR proted and more sensor resistant they um start off by traing and signing transactions as normal but now they will catch this um Eon key from the broadcast contract and use it to en cryptal transaction and then wrap it in another transaction that sends it to the sequencer contract these last two steps will likely be done by the D front and whatever they use of course user will not go to Ether scan and copy and paste the key it will be done by some script in the background um of the application that they use um if the de does not um integrate this functionality yet but users still
want to use it we will provide what we call the encrypting IPC server which is just a normal Json RPC server that users can configure in their wallet um and then uh this IPC server whenever you send a transaction top will perform these last two steps for the user this means you have to trust them to not front you front run you but at least you don't have to trust anyone else to to not do this so it's kind of a stepping stone that makes transitioning to this very easy without anyone else um um in particular the DB um requiring to to participate there yeah that's basically all I have to summarize um shter no chain kind of
this collaborative effort between three teams that nosis um shter and netherite to make NOS chain more secure and uh and user friendly because front running will not be possible and also more sensorship resistant and yeah um you can check out the spec um there have two versions of the spec one high level one low level the high level also includes like a discussion of different failure scenarios which might be interesting to read and yeah you can also follow us on Twitter if you're still using that [Applause] thanks
Related talks
- Combating Frontrunning and Malicious MEV Using Threshold Cryptography
- Shutter - Preventing Frontrunning Using Threshold Encryption - Jannik Luhn
- Encrypt the Mempool!
- DAPPCON 2024: Gnosis Chain - From Dencun To Pectra Via Shutter - Phillippe Schommers
- On Valitraitors and Relayviors: Censorship On Ethereum
- Gnosis Workshop
- Encrypting the mempool - Luis Bezzenberger (Shutter Network)
- Social Slashing by Eric Wall | Devcon Bogotá
- How a below average programmer found his way into searching
