What is Shared Security? Shawn Tabrizi - Lead Developer of Polkadot
Ethereum Denver·Mon, Oct 9, 2023, 12:00 AM
Speaker
I will go into the basics of what shared security is, how Polkadot can provide it, and what it can bring to the larger Blockchain ecosystem. I would like people to walk away from this talk having a shared understanding of a new primitive that can be useful and innovated on in the Blockchain space. Shawn Tabrizi is one of the lead developers of Polkadot and has been developing in the Blockchain space for over 6 years. Before that he was working at Microsoft on cloud and identity systems.
Transcript
so yeah share security it is an economic scaling solution for blockchains thank you that's my talk and uh no no we're gonna go deeper that's really just at the iceberg economic scaling this is a very important piece that's missing kind of in the space like we talk a lot about computational scaling data scaling what about economic scaling what does that mean how does that impact our system right so let's explore that idea a little bit more so first let's talk about the word security I'm sure you all have heard like blockchains are these secure mechanisms these like we want to look for blockchains that bring security that have security right well what is security well security really represents the economic cost to change the canonical history of a blockchain right chains with higher security are more resilient to attacks like double spend right this is Ultimate what security is security isn't like my account is more secure or this cryptography is more secure security really means what does it take to change the history right that when I have a transaction in what will it cost for me to change that this is a very important detail which gets lost in words a lot I think okay and I also want to note this I mentioned double spend attacks but I want to clarify that a double spend is not inherently an attack a double spend is perfectly valid in many blockchains I can make a transaction um with the same nonce sending two different accounts and the whole point of a blockchain is to come to consensus the whole point of a blockchain is to determine which of these two transactions is truth right so it's perfectly valid to um to allow a double spend to happen but you can also create an attack through this mechanism and so let's take a look at what that attack looks like so an attack on a proof of stake chain may look something like this right in this situation we have like the Asia area and the North America area um separated through some kind of um uh fragmentation of the network right now they cannot talk to each other except through Australia in this case you could have 33 honest notes in um the Asia area 30 odds nodes in the Americas area and 33 malicious nodes in Australia in this case since the only way for these two regions of the um of the earth to talk to each other is through Australia Australia can take advantage of this and create a um forked blockchain where both sides are true right so when you talk about Byzantine fault tolerance normally we're talking about 66 of a network agrees about some truth in this situation you can see I've created two different 66 um truth or 66 backed blockchains um but in this case Australia is being malicious and trying to present to you two different truths right this is how you actually attack with a double spend or attack with any kind of conflicting transaction so in this case what is the economic cost like what are the economies here well basically at some point we should assume that the network won't be fragmented Forever at some point these two regions will be able to talk to each other and what will actually happen is that you'll start to see well Australia has been lying to us right we've seen that Australia is telling us two different truths and we'll be able to identify that this is a problem and when that happens what we'll do is slash them right Australia is being malicious we have signatures and other verifications that say there's there's um conflicting ideas in these two different spots and we'll actually do a slash the people in Australia and say hey you did something bad but it could be that the attack that Australia did to everyone else by the way nothing no offense to anyone from Australia so just an example right but the attack actually did to the network could be worth more than the slash that they imposed right but often you would hope that the slash conditions are so high such that it would deter any of these activities from happening but I want to clarify again this is not a flaw in blockchains all blockchains can be attacked it's all about security how much is the economy cost to prevent that what's the probability of it happening knowing the economic costs right so again there's a very tight relationship between economies of blockchains token values and securities right so what is the bootstrapping problem well if we know there's a relationship between economies and security then what we have to worry about is new chains when new chains are are coming into our ecosystem oftentimes their economies aren't sufficient or stable enough yet right um and really one of the things I want to argue why statistically is so important is that one of the scarcest resources in the blockchain space is a economy is money right um yeah we'll go deeper into this idea but like this is a really important thing so when we talk about new chains oftentimes new chains have relatively small market caps oftentimes new chains are very speculative that you know price goes up and down crazy if we know the security of a chain is attached to these kinds of economies it's not good right we want to have and provide secure blockchains while allowing new members to join this is the bootstrapping problem right and so how do we solve this problem I think we can all say it together shared security this is the idea so the idea is if you believe that economy is attached to security then new blockchains need to become and exist that's a good idea we need to think about ways to actually share security between different blockchains now there are some different forms of shared Security today um and shares the truth I mean in a broader scale could actually mean a lot of things but I'll talk about a few different ones there's native shared security which is the kind of thing that we provide with polka dot I'll talk about a little bit more but it's basically shared security at the protocol level like protocol is designed to provide shared security then you have Roll-Ups I'm sure everyone's heard about Roll-Ups roles are very exciting thing especially for the ethereum space but they are actually using shared security too you have off chain somewhere some kind of roll-up solution they're aggregating and putting transactions together and then they're bringing those transactions and verifying them on things like ethereum acting as a security layer right the security of those Roll-Ups are as much as the security of ethereum um and similarly there are other ideas I think eigenlayer and some others are doing restaking basically if we know that the main issue is we need a stable currency a valuable currency we can actually just take currencies from other blockchains and reuse them to secure other chains right and we'll kind of go through these things but these are different forms of share security but I want to mention that not all of these are equal you know some of them are better than others and so what I would like to do is present our form of share Security in polka dots tell you a little bit about it and then compare some other protocols and just let you all decide for yourselves what are the trade-offs and benefits between these different things okay so it's going to Deep dive into polka dots really really briefly polka dot is a network that connects blockchains we call those different blockchains we connect para chains and really polkadot is a vision towards a multi-chain future if you believe there'll be many blockchains in the future which I hope you do um polkadot is really trying to solve and work on those kind of problems um polka dot provides shut security that's one of actually the main functionalities of the protocol it's Unique in that all of the para chains connect to polka dot natively have the same security as the main relay chain so if you see thought as one of the top 10 15 cryptocurrencies out there know that every single small chain attached to polkadot has the same kind of security as a top 10 15 blockchain that's really exciting and so that we think is going to be really scalable for new blockchains out there now I want to actually go through the mechanics of how shared security and polkadot works but I want to give you the information that there's some building blocks and there's some ideas and there are other protocols out there which are trying to do their version of shared security and I would argue to you that if they don't have these similar pillars that they are probably not doing it the best the pillars here is wasm which is kind of a shared execution of executable formats and open formats for how we can decide how chains should execute the pair chains protocol which is a native protocol built into our blockchain to handle all of the mechanics of handling pair chains shared security Etc and then the relay chain which you know you might have heard the term Beacon chain or other things like that this is a very key part of of um coordinating all of the parachute protocol coordinating the shared security together okay so these are the kind of pillars if you look at other protocols they don't have similar pillars to this they're probably doing something a little bit different they're probably making compromises in other areas okay so look at this so in right all of the blockchains in our ecosystem they Define their state transition function their core logic of their blockchain using wasm we kind of um creatively um basically implement this wasn't blob into the chain itself and we use it as like the how do we do execution and this is a very key part of a lot of things we do in our space but it's also very important for shared security I want to give you an analogy okay the analogy is like a game console so you can imagine that there is a polka dot client there's some binary that you run on your computer right this is a game console but it isn't it doesn't have built into it one game in fact you can actually switch out the games you can build different games in this case those games are different wasm runtimes wasm state transition functions and all we do in this client is basically say hey we can execute a wasn't file you give me the wasm we plug it in and we turn your game console into a specific version of a blockchain right if you put in the polka dot console or the Pokemon game it's a polka dot blockchain if you put in the a-star one it's an a-star blockchain this is a very key idea for how we kind of separate the clients and the actual logic of your blockchain okay it's easy enough and I'm going to kind of show you this but I'm going to explain it more but really polka acts as a super console it doesn't just have one slot it has many slots polkadot can be many different chains at the same time and this is a key part of how we actually create shared security we actually validate the things that are happening so now let's talk about pair chain validation okay this is the next piece so the way that we scale polka dot is we do execution sharding the word charting probably also something you have heard before hopefully but really starting comes down to two things sharding data into separate places and knowing because data is sharded you can actually execute over those shards in parallel right the problem with parallelization in blockchain is that if you try to touch the same data twice in parallel you have a risk condition right and if you you know you know basically if you know you can do this you can attack a chain by basically trying to force it to touch a lot of the same data over and over if we can actually Shard data we can actually parallelize execution and so polkadot has built into this this execution sharding mechanism where basically all the validators in our in our system they um execute every religion blocks but only a subset of them execute different pair chain blocks and we have this whole pair of chains protocol so we need to make sure that's still secure while paralyzing all the work okay and I'll show you more about that right now so quickly how would I even validate a block well the the information you need to validate block is actually quite simple first you need the block of transactions what am I going to be trying to where this changes I'm trying to make then I need only a subset of the database which is relevant for those transactions right imagine you have a blockchain with a million users if the block only has transfers between two users I don't need everyone's balance I need a Merkle tree and I need the two balances of the users in that Merkle tree and that's all the information I need to have a sufficient proof for this data decision function acting over this data right so I only need a subset of the data over overall Market Tree by the way Miracle trees are very important and cool because of these kinds of properties right then what you do is you take the block of transactions you take the sub-mercal tree you put it into your state transition function and you get outputs a new a new data a new state route right and that is really what a blockchain does every single block it just takes the the transactions it acts on the states it with the state transition function and then outputs the data very simple right so what do we do in polka dot we just scale that we parallelize that every single parachain provides to us a new block and their um version their view of the the information that's needed to satisfy that block and these call these are called proofability POV blocks and in the relay chain inside of polka dot we already have the blockchain state transition function like the we have the game console saved already um and we already store the route that we know about so when the when the um pair chain gives us a POV we can easily check does this Merkle tree match the route that we expect and then we just execute their block using the execution um the station function the wasm file that we already have on the chain and they'll take this so basically we have now collected for every single pair of chain in parallel what is their transition function what is the block of transactions they want to execute what is their POV right and it's up to now the validators to validate that that's actually correct and how do we do that well basically we take all of our validators and polkadot which are building the blocks of polka dot and then break them apart randomly so each one of them has a different purchase that they'll validate right so you can imagine if there's a thousand validators and there's 10 pair chains we'll randomly assign 100 um validators to each pair chain to actually execute and validate those those transitions right and when that valuation process happens um and everything is executed successfully then we actually commit the changes to polkadot in the form of a new state route right so as long as we can keep track of the Merkle roots and we can keep track of the state transition functions and the blocks we can basically keep track of all the blockchains and how they're moving together right so far does it make sense so far yeah okay I see heads everyone is nodding that's great um and then but you know this process sounds very um nice right like oh that everything's just gonna work right well that's not how blockchains work you know there's a lot of attacks but we have within the protocol which I won't go into today a lot of different checks to make sure these things happen correctly for example in polka dots natively we have a data availability solution we use Erasure encoding to make sure all the data that's needed for polka dot verification is is available um we have approval checking we have a process that other validators are checking each other's work we don't just trust one person says hey this looks good accept it a lot of people are checking there's a lot of economics and slashing that can be involved to make that happen and finally dispute handling if there is someone who comes and says hey I think this person did the problem wrong we have a whole disputes process handled natively in our protocol which will actually resolve and figure out what is the problem is it actually a problem who should get slashed where the economies and security around the network right we talked about economies and security and what does this all mean well this is really there's like what we've achieved with this perishing process is the ability to finalize para chain blocks along with polkadot itself right this is what I thought about polkadot shares the security because every time Pokemon makes a new block it is including all of the blocks of all of the other para chains that it has validated right so each of these slices you see here these are slices you can think about as a pair as a relay chained polka dot block and connected to them is all of the parachain states for all the parishes connected to it so as we make new blocks on polka dots we are ingesting and processing new blocks on the pair chains and each time we spin a new block parachutes also get that block included and finally when we finalize our blocks in the network you having your state in that block it also gets finalized right that means that your parachain canonical State your finalization your consensus is delegated to polkadot we give you security that's the whole idea and there's more than this right actually if you think about it even deeper if we're actually building a native shared security protocol we can also secure the interactions between chains this is actually you don't get in a lot of other protocols if you're trying to build your security on top of something like ethereum ethereum doesn't have a native interoperability stack attached to layer twos right they have to build something themselves because we've designed it from the beginning to be an interoperable solution we can actually finalize the interactions between chains and handle that as a part of our protocol itself this is a very key piece uh maybe answer questions later because I'll have to go but that's I would love I love that you're asking a question here because it's a good good place to ask okay so then I went really fast through this but the high level idea again you can see how wasm as a generic way to create these game consoles which can be shared around and passed around very important the pair change protocol natively handling all of the things around a sharded Network and product security importance and the relay chain acting as a hub for these different finalization points how everyone should work together very important if you have shared security protocols which don't have all of this something is funny to me at least you have to convince me that you don't need all these things okay so I want to leave comparing some options okay I talked that our other shed Security Options out there they have Pros they have cons let's talk about it and start a discussion around it right like let's not assume that what I'm telling you is the the to send all BL right we should think about and analyze these different options okay obviously a little bit biased maybe my this is my view on things but you know it's okay so restaking Solutions right so these seem to be pretty cool because they're like protocol agnostic it's really simple to move tokens around and basically create systems where you can slash them right um smaller newer chains can actually take advantage of you know more established economies right the problem here is that you know as you restate the same token over and over and over again that token becomes it's like it's like one strong guy I couldn't hold more and more chains on its back at some point it's going to fail at some point it's going to be more valuable to attack 10 chains at once against one token then to you know then to um basically scale that token out like it just no you can't have one token secure everything right and also there's really no cryptography happening here it's all kind of soft systems where basically you fall back on centralized trust saying hey this went wrong I mentioned a lot of cryptographic interesting verifiable ways to do things you can't really do that with restaking it's just moving tokens around and slashing them okay optimistic rollups this is really cool um this is obviously not limited by the complexity of the on-chain VM it can be paralyzed um you can stuff a lot of data in there because all of it's happening off the main chain really cool I think the main concerns here is around censorship resistance and centralization like to have those kind of um sequencers created it's you know that's where you're saying the whole well ethereum is very decentralized but the sequencer for this roll-up chain is like 10 people and they all may choose to include or not include your thing or there may be a target for governments like all this kind of stuff right and there's also this really big problem with time to finality because it's an optimistic roll up they are optimistically assuming these blocks are valid um what happens when something goes bad because all of this disputes handling has to happen on the main settlement chain it can be take very long up to days to actually finalize transactions right um also fees and all kind of stuff you can read the slide zero knowledge now these are really cool this honestly I'm very excited to learn more about I don't know enough about but I really like zero knowledge Roll-Ups um they're great they can be proven trustlessly you don't need that much data because I think the data proofs are generally like kind of O of one or like in the fixed size um they have instant finality as long as you can kind of execute the zero launch proof um and it's really exciting if you can do recursion right if you can have a proof inside of a proof inside of a proof you can really wrap a lot of data the problem again is around centralization right like zero knowledge computation is very intensive probably not everyone can actually create a new proof also ZK circuits are very complex today to write I think there aren't any really great Frameworks for easily writing ZK proofs right and um the complexity of proofs get really really heavy again some problems with on-chain allocation of block space Etc yeah one minute um this is my last slide um basically um the last part about Native security right so we have great things I already talked to you about a lot of stuff like all the things that we do which are great which is like true verification handling um Native handling of share security and operability secure like um sharding all that kind of stuff it's easy to develop a a new uh logic because you just have to make it wasn't right anything that compiles to wasm will work as a polka dot compatible chain basically um and there's much less concern centralization um from our collator system how we produce blocks then from the sequencers improvers in the other spaces but there are some downsides I would like to tell you them um unfortunately was them is about two times slower than a natively compiled executable that sucks um we require a lot of data being provided like you know you need to have that mercury proof whereas like ZK Roll-Ups kind of have this like abstract verification proof we have to provide like the real data the real balances um and there are certain limitations when you join polkadot you have to follow certain limitations to be able to actually be a valid parachain right so anyway these all the different ideas and they're all good so I just want to say shared security is a topic coming up a lot a lot of ideas are converging here I think we should explore Solutions I think Pokemon has done a lot of really cool things I think we're a long way to go but um if you have any questions for me you can ask me I'll be outside and thank you so much for my talk [Music]
Automatic transcript — names and jargon may be misspelled.