Sharding the Future: Redefining App Design with ZK Chains
ETHCC 7 · 10 Jul 2024 · 21:43
Daniel Lumi, senior product manager for ZK Stack at Matter Labs, argues that ZK chains can scale horizontally without losing trust. He reviews why monolithic chains, bridges and Ethereum's rollup-centric approach fall short, then describes the ZKsync Elastic Chain, with ZK Router, ZK Gateway and native smart accounts. He says zero-knowledge proofs, not shared sequencers, make trustless interoperability possible. Examples include sharded payments, gaming, bank chains, on-chain exchanges and social networks.
Speakers
Topics
From ETHCC 7, hosted by Ethereum France.
Transcript
Hey, good morning guys, morning, afternoon. How are you guys doing today? Um my name's Daniel Loumi. I'm the senior product manager of ZK Stack for ZK Sync at Matter Labs. Uh today I'll be talking about Sharding the Future. How can we redefine uh DAP and ZK chain design using the Elastic Chain. So first we'll talk a little bit about the evolution of blockchain. Um how ZK Sync is trying to sort of solve the fundamental issues with scalability in blockchain, and then we'll give examples of how you can develop your new DAPs or ZK chains with unlimited throughput. Oops.
So the the start of this all, the the first version of blockchain was a monolithic design, right? And this is similar to Ethereum or this is Ethereum Bitcoins and Solana's design. And the the sort of problem with this current design, it brought us to where we are, which is amazing and we're thankful, but it doesn't really scale, right? Like we we can't really take this sort of monolithic blockchain design to any real level of mass adoption. And this is because of of a feature which is also a bug, right? On blockchains, every single node on the network needs to re-execute every single transaction over and over again.
And it needs to do this because you need to have all these computers to reach uh consensus on what is the sort of global state of that blockchain. And that's amazing, but but it doesn't scale. Like if you have 10 nodes on this network, you still only have 1x scalability. If you have 100,000 nodes, you still only have 1x scalability because every single one of those nodes needs to re-execute every single transaction. And this leads to this sort of compromise, what's known as you know, blockchain trilemma, we like to call it dilemma, where essentially chains have to choose between whether they're sovereign, whether they're secure and decentralized, or whether they're scalable. So some chains choose to, like Solana, for example, choose to really increase the amount of gas, the amount of transactions that you can process through it.
Um, but this increases the node requirements for every single node on the network, and you still don't really get beyond 5000 TPS, which is nowhere near enough. And at some point, even though even if you keep going on that scale further and further, you're gonna run out of computers that can process um all the transactions in the world for blockchain. Ethereum made the opposite compromise, so Ethereum capped itself at 30 million gas, that leads to about 15 to 30 TPS, but then it's maximally decentralized and secure. And like let's not lie to ourselves.
There is 5.35 billion active internet users, right? If we get to any significant percentage of that in blockchain usage, a thousand TPS isn't enough. 10,000 TPS isn't enough, a hundred thousand TPS is nowhere near enough. Visa alone processes 60,000 TPS, and we don't just need to onboard Visa, we need to onboard New York Stock Exchange, we need to onboard all of traditional finance and all of these new applications. We need millions of TPS. And the point of this is again, even if you keep going further on that scalability compromise, let's say you only have supercomputers that can be a nodes on this network, yeah.
Like you cannot process every single transaction in the world on one computer. This should be really, really obvious, but there's a lot of marketing in this space. So what about cross-chain? What if we just have, you know, different blockchains like Ethereum, Solana, Bitcoin, we can even make copies of them. And the reality is, this is incredibly insecure. That bridging will never be anywhere near as safe as either one of the blockchains that it's connected to. They charge really high fees up to 1 to 2% of transactions.
Traditional finance is never gonna use blockchain if you have to actually spend that much on just bridging transactions. It's poor UX, you might bridge onto a different blockchain, and now you need that gas token, and it just it's not composable, it doesn't really work well. And just as an example, like for the security, it's it's actually a weakest link problem. So if you have 10 blockchains connected to this network, the weakest of those blockchains can steal all of those assets across every single connected blockchain. And in fact, that that validator said in between the blockchains is probably gonna be the tack vector.
Like that's never gonna be anywhere near as decentralized as any of the blockchains is connected to. So this has led to close to three billion dollars being stolen in bridges already, um, just in the history of blockchain. Okay, so how do we fix this, right? Um, Ethereum tried to do a model called Ethereum 2.0. The idea is you split ethereum into 64 different chunks each of those 64 different chunks can now handle 15 to 30 TPS so you have 64 times X the scale right but the problem in this was now each of those 64 shards has one sixty fourth of the security or the validator set the security and decentralization of Ethereum itself so you're again making compromises on this other thing was we didn't really have a good plan for interoperability between those shards trustlessly so you're still compromising like this is not solving blockchain trilemma and that's even 64 times is nowhere near enough to reach a mass market so Ethereum move towards what's known as like the roll up centric Ethereum these are kind of like shards not really but you have a bunch of separate uh uh roll-ups on Ethereum that run the execution off chain and then use cryptographic proofs to prove to Ethereum that they did that they processed the state transition correctly right and now each of those shards essentially has a hundred percent of the security and decentralization of Ethereum but the liquidity like the liquidity still fragmented between these L2s.
The UX is poor I don't know if you've ever tried going L2 to L2 especially if you go to safely through L1. It's a pain in the ass it's high transaction fees there's differences between these shards so this wasn't really a good plan it was a good middle step so how do we solve these fundamental issues? How do we get to where we can keep scaling horizontally like every single distributed uh uh network in the history of humanity? You have to go horizontal, but you need to keep be able to keep this trustless. So ZK Sync just went through the largest upgrade that it's got ever gone through by quite a bit, it was a pain in the ass.
Um, and this brings us to essentially ZKSync 3.0 or blockchain 3.0. In this concept, we're calling the Elastic Chain, a chain that can scale elastically with demand. And this is the current architecture of ZKSync 3.0. And we'll just dive into what is currently known as ZK Sync, ZK Sync ERA, the L2, right? Currently, out of the L2s, it has the highest transaction uh throughput measured in standardized uniswap 2 swaps. Gas per second is not a good way to measure across different chains and it's even across L2s.
No matter what people are saying, this is a really poor way to measure um transaction throughput. So this is just Uniswap 2 swaps, right? Uh we have uh over ZK Sync has over 400 million total transactions, that's number two in L2s. And we still have a half a million uh weekly active addresses. So some of the core features of this core, let's say it, of ZK Sync era, is the scalability. There are industry load transaction fees.
It costs you a penny to do a roll-up transaction. With Validium, depending on your DA choices, it's a fraction of a penny, it's like a tenth of a penny. And that's the real transaction fee that you don't need to artificially subsidize anything. That's the actual cost of operation. Um there is native account abstraction, which we'll come back to, uh, where essentially every single count on ZK Sync network is a smart account. So every single count can have the same features. Your MetaMask can have the same features as these smarter wallets. And we're making a massive push into developer experience and user experience in this year and the next year.
And these it's hard to explain. People wonder what is really the differences between L2s. Like on the face, they kind of seem similar, but these are fundamentally different architectures. Like ZK Sync was built over six years with a team of over 150 engineers, cryptographers, mathematicians from companies like SpaceX and Microsoft. These changes compound. You make thousands of choices every single day that lead to massively different architectures where you can enable this kind of scalability per uh chain and this kind of user experience, and you can't just sort of take ZK and slap it on an existing multi-chain architecture like optimistic protocols. It's it's much harder than that.
Like there's so much more to it than just proving. You need a custom built architecture for optimally actually executing this. So again, that's the base of this. That's ERA. And with ZK Stack, which is our developer friendly framework that allows you to essentially easily just keep booting up new shards, let's call them, new chains onto this existing architecture. And on this new architecture, the most important part of this is genuinely is zero knowledge proofs. If you do not have zero knowledge proofs, if you have to rely on shared sequencers or economic guarantees, you go back to the same situation of you cannot run every single blockchain on one computer.
It doesn't really scale it. It's trying to fake interoperability with poor design choices. If you have zero knowledge proofs, you can keep every single one of those ZK chains. None of them have to trust each other. You know for a fact if someone sends it, like if you have two banks with ZK chains, you know for a fact that that bank has the funds. They didn't rehypothecate assets. And this trust sounds small, but for a bank, that means they have to hedge counterparty risk, they have to have teams of auditors of reconciliation, and this literally leads to them having to pay hundreds of millions of dollars a year. ZK is the fundamental key to being able to scale blockchain to limitlessly horizontally.
So a key part of this architecture is ZK router. It's this set of contracts on Ethereum L1, where essentially every single one of these different ZK chains or shards registers itself onto. And then there's ZK Gateway, which essentially you essentially can combine different proofs and you can submit the data, and it's essentially the data in the proofs are tested to, which allows you to essentially have fast finality as fast as you can generate the proofs, and you can keep dropping that batch uh size, smaller and smaller, to really get like minutes in the beginning or minutes in the beginning and then seconds in the future. And again, the key part of this is no shared sequencers.
Don't use shared sequencers for fast finality. You can to fake it, but if we really want to get to millions of TPS, that's not a scalable design. And that's gonna cost every chain a lot. And if you do this right, if you have these ZK proofs being generated very, very quickly, you essentially enable seamless interoperability. So you might have your home base might be on Chronos chain, but you want to swap for an NFT. In one transaction, you can essentially make uh send uh your let's say ETH to another chain, swap it to USDC, send that to another chain, swap it to the NFT, and the NFT gets returned back to your home. And you don't have to worry about what actually happened underneath.
It is asynchronous, but again, to if you if you solve synchronicity without relying on centralized actors, let's not pretend synchronous can scale at mass scale. So this will just in the future it'll just feel like one massive monolithic, like limitlessly scalable blockchain. And part of the key to this again is the smart accounts. So on ZK Sync, every single account is a smart account. So your your user doesn't have to pay gas if it's sponsored, or they can pay gas in USDC if they're sending USDC. They don't have to deal with what is ETH, right?
Um you can essentially have like face ID login, and that's saved into pass keys. You don't ever have to worry about essentially having a seed phrase, or you can have spending limits like spending a hundred USDC per day without having to re-sign transactions for games or for purchases. And these simple architectural choices built over six years is what creates this sort of first um scalable elastic chain. And now every single one of these shards gets a hundred percent of the security and decentralization of Ethereum, and now we actually have trustless interoperability between every single one of these shards.
And ZK is the end game for this. Like this is the only way that we know of to scale blockchain beyond 10,000, 100,000 TPS. And so let's look at the Elastic Chain ecosystem. So we currently have over 20 chains that will be launching on mainnet by the end of the year. ZK Sync Era is already upgraded onto this new system, so it's the first ZK chain on this Elastic Chain. And we have many others coming by the end of the year. It's like it's a really exciting time to be in this space. I like, especially in my job, I talk to banks every day.
I talk to like traditional finance applications to massive multimedia companies to gaming giants. People, this is not talk anymore, people playing around with blockchain. Like we are really about to take off into mainstream adoption. And we need the scale to be able to support that. It changes a little bit how you can design your applications or how you can design your chains.
So Visa Today, when they send 60,000 transactions per second, they don't do that on one payment channel. They have multiple payment channels spread around, and then they settle between those. With uh the Elastic Chain design, you can keep spinning up new ZK chains, and you can keep increasing more and more payment channels, and they can trustless, like you send USDC here, you trustlessly know someone received it across what is the Visa chain. It's a sharded visa chain. There's many different shards to it, but essentially you can keep scaling horizontally to support any uh transaction throughput.
You could have uh sharded decks with different liquidity pools. You could have a game or gaming ecosystem where every single game has its own uh ZK chain, or one game shards its assets across many chains. So you could have like armor and and like equipment on one versus moves on another versus like NFTs on another, they could be on validium or roll-up mode, depending on the security you need for this. And again, this allows like actually scalable gaming infrastructure.
This is how gaming is built today, also. You could have uh central bank chain with many different like the central bank chain itself would have public data, so they can't cheat the system. There'd be verifiable rules to the game, but each of your banks would have a private validium chain. And this is exactly how the banking system is today, but that verifiability makes a massive difference. All of a sudden, you don't have counterparty risk. You cannot collapse other economies because someone slept on a keyboard and entered a few too many zeros.
Like there are rules to this game, so now people can't just re-hypothecate and lie beyond what is allowed. Um you could have like an on-chain uh centralized exchange exchange. We already have like ZK Lighter, for example, is building on us, or Gravity, where essentially you can have fully on-chain transactions at fractions of a penny using Validium mode, you could keep again sharding as demand needs every single one of the trading pairs, for example, could be on a different chain to support massive throughput. And um this really costs next to nothing.
Like ZK Liighter can do over a million transactions for about a hundred dollars, right? And this is starting to really get to a point that you could have New York Stock Exchange, and maybe even a fraction of a penny sounds like a lot of money for this kind of applications. But when you consider the fact that no one can front run you, no one can cheat the rules, you're not trusting people to do the right thing. This saves companies hundreds of millions of dollars. Like market makers fucking care about this, right? This saves people money when they know they don't have to hedge risk.
You could have a social app or social network like Lens Network on ZK Sync Elastic Chain where they can keep having they can have instances where there's private data, right? Maybe you don't want to reveal everything publicly, and you can selectively disclose that. Maybe you can keep like you could have likes on one chain versus comments on another, and you can keep sort of sharding to get that increased capability. Like this is the reason why Lens chose ZK Sync, because it was the only option for them to have a true on the on-chain social network. Or you could have like these this is a more abstract idea, but you could build a sort of like federated model of AI um chains where, for example, like you could use an adversarial competition where every single chain would be its own AI model, and depending on how successful they would be or not, they'd be rewarded in tokens, and essentially they'd be killed on the spot if they fall below a certain performance threshold.
So you can actually have on chain like AI systems, and like this will be in the long run the future of how AI is run because you need trustless systems across distributed models. And there's two ways that you can get started today. Um, building just normal dApps or sharded dApps or sharded chains or just ZK chains. Um, and that's just by building an app, or you could again build your own ZK chain. Um I so Matter Labs follows this credo religiously.
This is not marketing for us. You can find this on GitHub. Everything we do is open source. It will be free forever. We want you to fork the code, we want you to improve it, we want you to contribute it to it. Everything we will ever build will always be permissionless. No one can prevent you from deploying, from forking, from bridging out your funds. Like this is uh uh we're not here for anything else than the morals for trying to change the society to be able to re empower individuals and bring back choices to users. And ZK is the endgame.
You'll keep seeing this vision for like coming out. There's a lot more we can do with ZK to enable completely different types of chains, completely different types of virtual machines, no virtual machine in a completely trustless way, the same way that the internet scales, the same way the internet has different back ends that can interoperate with each other. You can follow me on Twitter at ZKLumi, and thank you.
Related talks
- Rise of The Hyperchain: ZK Stack for zkSync | Daniel Lumi - Matter Labs
- L7 - Exploring ZK Network | by Daniel Lumi | BlocSoc Lecture Series
- Introducing the Elastic Chain
- The Elastic Network | Alex Gluchowski - Matter Labs
- FULL DISCLOSURE: You’re not bullish enough on ZK
- zkSync's Hyperchain Network Effect | Alex Gluchowski, Anthony Rose
- The Elastic Network
- The State of Polygon
- Hyperchains and Hyperbridges: How the ZK Stack will power the Internet of Value