Advancing base layer neutrality: The Launch of Shutter's Encrypted Mempool on Gnosis Chain

ETHCC 7 · 11 Jul 2024 · 18:35

Frederik Luehrs, a contributor to Shutter Network, presents an encrypted mempool on Gnosis Chain and announces it live on mainnet. He explains malicious MEV, such as front running and sandwich attacks, with a rock-paper-scissors analogy, and censorship as two problems caused by public pending transactions, saying even the Ethereum Foundation lost money to front running. The design works off protocol, without a hard fork, and aims for low risk and little UX impact. He covers uses like private voting and shielded gaming, and next steps including wallet integrations and staking for keepers and validators. He says an encrypted RPC is available to try.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

Test test. Public blockchains stand for censorship resistance, openness, permissionlessness. It's a credible neutral system where people have the choice whom to interact with or whom to trust. It's here to break up power structures of large-scale corporations which exist in the internet today. Allowing anyone to build on this neutral platform without permission. I believe that these are the reasons why you are here in this room, why you came to ECC, and why we are building together in the space.

Hi, I'm Fred. I'm contributing to the Shutter Network. And Shutter Network is a diverse community which aims to enhance the core values of public blockchains, which I just mentioned. Today I'm going to talk to you about encrypted manpools on Gnosis Chain and why you should care. Other participants.

And that's actually nothing new. Have you ever wondered why the architecture of Amsterdam is like are these narrow, very tall buildings? The reason for it is that in the 1600s, the property tax was based on the width of the house fronts. And people quickly realized they can maximize their own profit, they can maximize their own advantage and maximize the living space and paying less taxes. Something which the lawmakers didn't intend. So coming back to public blockchains, I think it is debatable, there are a lot of design flaws or not, but I'd like to talk to you about two specific topics which are here for a couple of years, which is malicious MEV and censorship resistance.

So just for the ones who don't know, malicious MEV is caused by front running or sandwich attacks. And let me give you a quick example, which we used this week to explain to explain it. Imagine we are playing rock, paper, scissors, and uh you have to commit to either rock, paper, or scissors at the same time. So one, two, three. If one would have the advantage to see the other's hand, to see the commitment, and then act based on that, nobody would play this game. This is a fucking stupid game.

But that's exactly what's happening in public mempools today. You send your transaction to the public mempool and you are committed to this transaction. But the validator or the one who's proposing the block or building the block can actually order the transactions and only commit to the order later. So this is what we call information asymmetry. Other actors in the system have more information than you have when you send it, when you send your transaction. So, like most famous example, let's think about a swap. You want to swap some tokens and send it to the mempool.

You are willing to pay a price, and basically anyone, but at the end of the day, the block proposer will be consume this information and can give you the worst price you are willing to accept, for sure, 100% of the time. So you will always lose and he will make profit out of you. These things get even more complex, and um uh so this is like a um huge complex uh sandwich attack where even the Ethereum Foundation lost a solid 9k to uh front to front running, so it's not only like um the small guy where it's happening too. The other problem uh which I want to talk to you about is censorship resistance, and that's kind of like an invisible problem because you never need it until you actually do, right?

So and um the the cause of the problem is actually the same. Transactions become public before they are actually included in the block. So validators or block builders can choose not to include your transaction. Maybe they get included eventually, maybe never, but it will definitely suffer the UX vastly. And as we have seen two years ago, with the OFAC sanctions, when regulatory pressure increases, the problem gets even worse. So, what are alternatives?

Um, these problems are not nothing new. So there has been a rise of uh so-called private RPCs in the past months and years. So, what are private RPCs? Private RPCs are actually mostly today centralized entity where you send your transaction to, you're not sending it to the public mempool, and then you simply trust the centralized entity that's not gonna exploit your transaction and will somehow magically include it into the block and treat your transaction well. That might work now.

Does it work forever? We don't know. And another problem arises with that. Instead of having a global view on all of the transactions, we are creating private order flow. So just recently, MetaMask introduced this feature called smart contract uh smart transactions, which is basically not sending your transaction to the mempool, but sending it to builders directly. So if you are a dab or a wallet which has a large set of transactions, you have actually an advantage and uh have something very valuable for builders because they get a better view of the state. So builders might actually be incentivized to pay MetaMask or whoever is create collecting the order flow to get the order flow to build better blocks.

So that's a centralizing risk, but it also creates um conflict of interest uh at the at the central points where the order flow is collected. So no wonder that the EU recently banned payment for order flow in traditional financial markets. So, what would be another alternative way? Some what something would really works. So, something, imagine where we would have like an end to end-to-end encryption where you can safely commit to your transaction, and then it only gets revealed after it traveled into the block, and the block and the validator committed to the block as well. So on the way, you couldn't see what's uh the transaction doing, so no one would have an advantage, and we create information symmetry again.

In the end, it would get revealed at the same time, but all of the parties are committed. So that's what we have been building in the last months. Um we call it an encrypted mempool. And here we again have the example of the transaction, so nobody can see it, and uh therefore the protection you are protected against front running and censorship resistance. Uh censorship, sorry. So we've been building this at Shutter Network, and Shutter Network is an open source technology and a social movement. And we promote base layer neutrality, information symmetry, and accessibility to everybody in public blockchains.

And we currently do it with a technology which is like a commit and reveal scheme, um which exactly enables what we just discussed with transactions, but it also has a lot of many other applications where we could use it. Think about private voting, where you want to commit to your vote and then only reveal it to the public after the uh vote has ended. Or also shielded gaming, think about the um rock, paper, scissors example. You want to commit in gaming to your next move, but you don't want your opponents to see it until it gets revealed at the same time. So, and how it works in how it works in practice?

Um, I will explain it to you at the implementation, which we have been building in the recent months. Um, and that is an encrypted mempool on Gnosis Chain. So, first of all, um, Gnosis chain is a running system in production and uh creates a lot of value to the users. So we had some design principles when building the first iteration. So we want to minimize risks. So just if for whatever reason shutter would break and not work anymore, we don't want the whole chain to go down. We want to um uh because it creates a lot of value for the Gnosis chain users, obviously.

Um we want to have a little UX impact. So users should be very it should be very easy for users to just try it out. It shouldn't be like a very high barrier for them. Obviously, we want security, but we we do it like in a progressive iterable steps so that we make the first footstep and then continue from there. So now imagine the user has encrypted his transaction, and we don't want to actually do a hard fork. So um that's what I forget to set.

So uh the the block in itself, the Ethereum protocol, doesn't know about encrypted transactions. So we have to somehow kind of make it work off protocol. Um so how does the decryption happen? So the decryption um should happen at a point where front running is not possible anymore. So we need to know the pre state, and we have that between the blocks. So whenever a block is published, um the decryption keys can be safely released. And then we just need to make sure that in the next block, the decrypted transactions are included at the very top of the block in the pre-given order. So then there is no reordering possible and no front running possible.

However, who's the next question is who's actually holding the decryption key? Because we don't want the user to hold the decryption key. And we don't want to hold the let the validator have the decryption key either, because then it wouldn't make sense at all. However, why don't we want that the user has a decryption key? Because that would vastly decrease the UX. The user would have to send two messages and would have to stay online and just send it in the right moment. And it also gives him the power to simply not release the decryption key and have the free option. So if he doesn't like the outcome of the transaction, he would just not release it.

And that's also not what we want. We want the user to be committed, right? So our solution to that is a threshold committee. We call this committee keepers, and that's a decentralized set, and only the decentralized, like only the keepers in collaboration can reconstruct the decryption key. We use threshold encryption for that, and rely on we rely on an honest majority assumption, like modern blockchains do. So when keepers meet the first time before they get active, they create together in a DKG process the public key and broadcast it in a contract. So users can pick it up from there.

One slight additional note to that is that users we use identity-based encryption, so users will derive their own encryption key, and then later the keepers will create the decryption key only for that particular transaction. That just makes the system more efficient. So what on the other side, we have the validators, and we want the validators to be committed to follow the rules as I explained it before. So to put the transactions on top of the block. So since it's not part of the protocol now, um, validators have to add in uh opt in and commit to these uh additional duties.

So that's actually the commitment phase in this um step basically. So how does the whole transaction flow look? Like how does the transaction get from the user safely into the block? So users encrypt um their transactions locally and submit them into a special contract, which is called the sequencer contract. The sequencer intuitively orders them by first come first serve. So the order is already committed before the actual uh data get decrypted. So keepers and proposers observe these transactions, and whenever a proposer is up to um propose a next slot, uh the keepers will release the decryption keys for the validator, and the validator will fetch the transactions, put them at the top of the block, and publish the block.

Yeah, and I'm super excited to have the honor to announce that the encrypted mempool powered by Shutter is live on Gnosis Chain Mainnet. So from today on you can use an encrypted mempool and enjoy safer trading. I have to disclaim here that we are doing a continuous release, and it might be a little bit bumpy in the next days, but we are going to increase uh the um the UX step by step every day. So keep please keep posted.

Um so sometimes one thing what could happen is that it has slightly longer inclusion times, just if you have problems. Um this work wouldn't have been possible without our partners, which were we were working closely together in the recent month. So uh for on the one side, Gnosis chain, which really pushes for base layer neutrality and building a chain that matters for its users and providing core values for its users. On the other side, Nethermind, which did a tremendous job on integrating the encrypted mempool into their client.

So a huge shout out to our partners and our collaboration for the better. So now you as a user, you might ask, how can I use it? So it's live. Um but it might be um uh we have for convenience reasons um built an encrypting RPC server. So it is trusted, but it is easy to try it out. So it is as easy actually as just changing your RPC, and then you will the RPC will encrypt the transaction for you and um send it into the shutter system, and from there it makes its way.

Uh you can also use it locally. Um we have a demo app for that as well, and in the future we will improve on that, but uh from now on, um, that's uh the way to go where you can try it out. And as the next steps, as I mentioned, we are like progressing the security iteratively over the next days, weeks and months, and we are doing that on all sides on all fronts. So for the users, as I mentioned, you will be able to uh encrypt your transactions locally by wallet integrations and dab integrations. Keepers and validators will get a uh staking mechanism behind it to enhance economic security and uh prevent misbehavior by the parties.

Uh, we have also some uh amazing um cryptography research going on how to cryptography prove uh that keepers are colluding, um, which I cannot explain because I'm not smart enough. Yeah, so um just to the very end, a couple of calls to actions. If you're not a user on Gnosis Chain yet, I encourage I highly encourage you to try it out. Um switch over, it's a super nice user experience. It's a decentralized validator set, I think the second largest after Ethereum and uh cheap to use. So uh go over and try Gnosis Chain and try our RPC.

If you are a Gnosis validator, please stay tuned for onboarding into the shutter system. We would love to uh have you there, and we will keep you posted in the next days and weeks as we are rolling out. And if you are a DAP or a chain and you want to protect your users like Gnosis Chain does, then let's get in touch. I leave it with that. Enjoy safe trading on Gnosis Chain. Okay, we have time for one question, so please raise your hand. Can you just uh give a brief give a brief explanation on how to do um uh shuttered trade or uh say a shielded trade?

A shielded trade. Yeah, it's it's uh super simple actually. So um right now we have the encrypted RPC um live, so you can uh just uh use the encrypted RPC. It will all be seen on our blog posts and in the Gnosis documentation. Uh you can find it there. And then just use the dab and use uh the decks or whatever you want to do um like you would do normally and it happens automatically. One more okay that's it. Can we please give one more applause from Freddy?

Thank you.

Related talks