DAPPCON 2019: Designing Staking, Rewards, and Slashing - Peter Czaban (Web3 Foundation)

DappCon 2019 · August 2019 · 23:32

Peter Czaban of the Web3 Foundation discusses the design of staking, rewards, and slashing mechanisms at DappCon 2019. He examines how validator incentives are structured to secure proof-of-stake networks, weighing the tradeoffs between reward design and slashing penalties that shape network security and decentralization.

Speakers

Topics

From DappCon 2019, hosted by Dappcon Berlin.

Transcript

I'm Peter from Wesley Foundation and great to be here the depth conference since pretty much everything that we do at the web through foundation is trying to make a a a solid foundation for building the centralized applications and a foundation that is also easy to use and as part of that we are working on on a project called polka dot which makes which aims to make it easier to build both domain-specific chains and general-purpose chains to support the deepika system and in particular I will jump into the core element of the protocol which is the economics of it

and tell you a few things about it and hopefully you can get some insights from it for also designing dubs and depth protocols so yeah I'll go basically through first why do we need these economics and jump into the core components of it which is taking slashing and rewards and then I will go through the example polka dot and how we design these incentives within within the polka dot protocol and different mechanism that we have there so generally the centralized protocols we need a number of actors to actually run

these protocols and they have to do things that are compliant with whatever protocol we specify but we don't have any enforcement party police or Oh or anything like that to make sure that they actually perform actions correctly so we have we have to rely on on economic incentives to make sure that they perform good actions and they avoid bad actions so good actions are the ones that that follow the protocol and they help the top the protocol to progress so forces that could be producing a block or in polkadot it could be a testing

validity of one of the Constituent of polka-dot bad actions are one that can disrupt or break the protocol so it could be equivocation in some consensus protocol or whatever other bad action within your protocol and for all of that that's why we have all these usually why we have all of these scarce tokens on on the blockchain is because we need these these new tokens for further for for the protocol to make sure we have we are able to incentivize good and and disincentivize to bad actions so how would we disincentivize that the bad action so usually that the way it's being done improve work and improve

stake is we get the some of the actors that are willing to to maintain the network to actually invest significant resources so in proof of work that would be doing lots of mining and proof of stake it would be making a deposit or locking up stake and then if they do something bad so saying in proof of work they are trying to mine a parallel chain and as long as they don't break security assumptions of the other network then they risk not getting rewarded for all the work that they have put in into making that chain in proof of stake on the other hand we don't have this notion of mining and we just have the stake and then the that whoever maintains the network risks that the their deposit

will not be fully returned so there will be slashed for further further misbehavior so but why would anyone want to actually maintain a protocol if we are penalizing people and and they're running the risk of not getting the money back for for their efforts so this is where rewards come in so in proof work again we have the more mining for someone puts in the more frequently they can receive their rewards so that means that basically the higher security they provide to the network the higher the rewards and improve of stake it's usually not more frequent but just the

rewards are some way proportional to the stake that is being submitted by the whatever actors are running the network and now let's let's I won one more thing is that when we talk here about these these good and bad actions we are not talking about actions that are very like trivially detected by any anyone in the network so for instance it is pretty much impossible to introduce an invalid block in Bitcoin because an or idiom because any any single node can instantly detect it and just reject it so these are all actions that are a little bit harder to detect or identify and does need to be either instant

advice and disincentivized so now let's let me quickly recap polka-dot so so it is this multi chain framework it aims to allow for interoperability both between existing chains and new kinds of chains that are being built so again either application-specific chains that are being built for a particular dub or general purpose chains times to provide pulled security to all the new changes that are being attached so that each each new chain that one builds doesn't need to create its own set of stake or its own for mining community but but the security can be provided by the by the polka dots network

it aims to support heterogeneous chains so so again this this these different chains are both to support the existing ones and going into the future as we develop new kinds of change they should be able to attach to the network and the idea is we're still figuring it out but what the governance should allow the protocol to evolve into the future and not remain stagnant so adapt to to whatever needs we have as as we as we go forward and the way we think about this this incentives in polka dot is first we have we have certain desired properties that we would like the protocol to achieve and and we have some general understanding of what is going on based on the things that that I mentioned from

from there we derive some general design principles and then figure out what the actual protocol is and what actions should be incentivized or disincentivized in in what way so I will now walk roughly through through this through these steps to to to show how it it works so let's start with this with with the properties and the different types of actions so here on the left you can see the different kinds of properties that we want to ensure and these are also the properties that that can be enjoyed by any chain that is that is part of the of the network and on top we can see different kinds of actions some of them might not tell you much but

but we'll go more in-depth through some of them so let's go through the properties so these are important properties pretty much for any blockchain system or the centralized protocol some of them may be a bit more specific to multi change frameworks so the first one is liveness so we always need to make sure that new transactions are being processed new state transitions of the different block chains are being added so that the system doesn't does install we need to ensure validity so that each state transition its is valid so it's correctly performed it is very easy and usual block chain that is just a single block chain where everyone checks everything but not so easy when one if we have multiple chains availability so

everyone should be able to get the data and actually check for themselves if is everything going all right finality which means that we should not be able to easily revert whatever state transitions or transactions happened they should once they are what happened they shouldn't be reverted reliable messaging which means now that we have multiple different trains running together we need to ensure that once a message is issued from run chain it definitely gets to the other chain so we want to make it as easy as possible to anyone that builds an application to do not have to worry if if the message gets lost so a bit like interacting between two smart contracts where you are sure that they will communicate well together utilities are going to make sure that these constituent chains provide some

sort of level of utility to the users that we measure by economic means here and we need to make sure that there is not we don't use up too many resources when one runs this protocol so there are some considerations there and of course some of these properties are partially insured by this kind of trivially enforceable rules of the protocol that every node can check but many have to be many properties have to be insured by some of these incentivized actions and as you can see like some of the core core elements are these payable actions and / herbal actions that I will talk about which which influence quite a few parameters of the protocol and so now let's let's kind of list a few a few

kind of general dynamics that that that followed mostly from the from the things that saying before so the higher we can make the penalties the higher the security because basically these bad actions are able to disrupt the protocol so we want to disincentivize them as much as possible but also high penalties discourage parties from even participating so we might get lower stake in the network in the first place so we need to ensure that that there are some rewards but also as we increase the rewards the issue is is that introduces inflation which is a cost for an average user because an average user that doesn't maintain the network doesn't get

these rewards they're the share of the network that they own or the share the tokens will will decrease and there is also one other point where where there are certain actions where where penalty and reward is is linked together so for instance for bad actions which are so good actions are very easy to detect because I knew every one every one that performs that good action wants to tell everyone about it so that it gets rewarded but with bad actions it's a little bit harder so we need an intermediate step of reporting for for for bad actions so in these cases where we reward someone let's say for reporting and then we penalize someone we need to make sure that there is no

perverse incentives that actually in the end rewards someone from misbehaving and then reporting themselves right so from that there are some some some principles that we can follow so generally slashing or this risk imposed on the on the people that run the protocol should be as small as possible unless it actually threatens a threatens the network and then it can be high the inflation should be should be somewhat stable or at least it should be kept as low as possible given given there is enough stake in the network what we can use here in order to make sure that we actually get parties that are willing to get penalized a lot while not getting

rewarded a lot we can use markets for that and we have to just make sure that anyone anytime we reward someone it is less than a penalty associated with the same action so that's that's probably just a subset of this but these are these are the some of the important some of the important principles so now let's get to the kind of the core of the of the of of the this proof of stake system and how does it work so it's the nominated proof of steak with payable and / Fable actions so here they go we want to as we said before already we

want to maximize the security by capturing as much as take possible in particular we want any actor that is maintaining the protocol to be as highly sztyc as possible so then what that means is that the minimalistic validator should have us high stake as possible so that any action they perform in the protocol has as high of a guarantee of not being bad as possible so this is especially important for Pocoyo because there are certain actions that are just performed by a single validator that is randomly chosen and and we also need to we are also trying to minimize the rewards as long as the staking ratio is high so if there is lots of stake we

don't have to worry about rewarding people too much if there is very little stake we have to reward them more so that they actually decide to stake and the rewards should be relative to the effort that is required to perform the good actions because we want all good actions to be performed roughly at this right so if one good action takes more work than another then then maybe no one will be doing that good action so it has to be somehow related to the work that is that is required and we assume that there are certain actors out there that are willing to participate in this in the system so we have we have validator candidates which are willing to run actual physical nodes that will maintain the network for a certain fee and we

have nominators that are willing to select some set of validator validator candidates for either because the validator candidates have certain self stakes so they already risking something themselves or they have a certain reputation but generally they are not willing to these dominators are not willing to run any note but they might have capital that can still contribute to the to the total stake that that we have in the system so this is our clarify why this is not called delegator Xin in a second so now that let's get to the actual kind of steps of the rough

steps of the algorithms that that that we follow here in order to determine these these dis amounts that that are being rewarded and penalized and how do we actually capture the stake in the in the first place so we'll go through these six steps now so first we we gather interest so we had this assumption that we have validator candidates and nominator so we want them to kind of apply and say hey I won't like to participate so here you can see we have nominators validators on the right validators which is not indicated can also indicate some fee that they would like to have for for running the node and the first nominator is for

instant Nominating on the first validator a while the second Dominator is nominating validators validator candidates a B and C right so so you are able to indicate multiple parties so now we need to actually get this taken to the system select a set of parties that will be maintaining the protocol so become the actual validator so in our case the validator set or a set of parties that will be maintaining the protocol is for and then and we have five validator candidates so we need to select four out of five that maximize our security so you can see on the left is one solution

to this problem problem where we assign now uniquely the steak from nominators to validators but then you can see that the lowest steak validate or D or e only has six six tokens so when they perform a bad action they will not be penalized as much as on the right where where validators b c and d have have steak nine so this this problem in order to do it optimally actually is an np-hard problem but but we have a fast heuristic that is run on chain and then we have also a few other algorithms that approximations that can be run and then submitted to the chain in order to to

get a better solution and also what we can do is besides that we can also ensure this property of fair representation without sacrificing security by which basically means that validators should be selected proportionally to the rate at which they are nominated so and this is an important property to get even small nominators are small validator candidates selected from from time to time and one one interesting thing here is because you are able to select multiple validator candidates you don't have this issue that you may have with with a proof of stake system where you

select only a single party that you nominate because then you need to make sure that that party in the end gets elected into the validator set while here you can say like I'm willing to trust one validator candidate that is not very popular one that is a bit more popular and it's actually the less popular validator candidate gets enough nominations anyways then in the end I might get elected so it lowers the this kind of sticking effects associated with with only selecting single set of parties with which we've already seen an existing proof of stake systems now now we have the stake locked up so this is our stake that we can work work with it comes from

nominators and validators now as I said we need this system of reporting in order to actually detect that bad actions and so this is a bit it is a bit more complex part of the protocol that I will not get into not much but but we have this mechanism of probabilistic checking in or in order to to to make sure we always detect even the bad actions as soon as possible and and escalate them through kind of a chain of checks to be detected but then once we detect actually the debate action occurred then then it comes time to slash so as we said before we we don't

want to be slashing a lot if if the if the issue doesn't pose a big threat so we have we basically look at how many bad actions are correlated with each other or happening help happening simultaneously and then if there is just an isolated case of an of a misbehavior as you can see here on the left basically you don't get / anything or very little so if you forgot you know wants to turn something on and and it is not correlated with anyone else then then it's not a big deal but then as as soon as the number of bad actions approaches or the security bounds of the protocol which is one third of of malicious mistake then then we basically

take away everything yeah so you don't get anything back because that means it says some sort of coordinated attack potentially or a lot of people have been overly reliant on some sort of centralized solution to to render thing and this is this is exactly one important point is that by doing this we also discourage nominators from selecting validator candidates that run the same infrastructure or even controlled by the same organ and and promoted more decentralization through penalizing correlated bad actions then but then of course we are penalizing these bad actions but then we also want to reward everyone and we want

to get enough stake in the system in the first place in order to make sure it's secure so we have this we have this take targeting curve that basically ensures that here on the x-axis you can see that the proportion of all tokens that are being currently staked so when there is not many tokens staked then the interest rate that any singles taker gets is very high and as we get more stake this this interest rates goes down and down until we say at around 50% that it's actually quite a bit of stake we don't necessarily need more and we also buy that by saying that we also cap the inflation at at 10% and then the rewards

and the interest rate quickly drop off so that's so that we we don't need to introduce excessive inflation if we have sufficient stake within the system and so so this is targeting our total amount or our staking ratio and now how do we distribute it to all the actors that have been running the network so as we said before we wanted to distribute it proportional in some way to the to the work that they are doing so we basically take this this pool of money that there's a pool of reward that we now want to issue and then we see how much good good actions or how much have each even each given validator

performed and we count different things like number of issues Valley Duty statements for these different trains number of blocks produced ankles included and we have this estimator that that that that keeps track of what is a usual number of these things to be to be produced and then we kind of divide it across all the validator so if somebody deters haven't been as active as some others then they will get less less of the total payouts and and between also the different actions they have performed they will they will get proportionately different amounts so this is just a quick overview of of the of the polka

dot economics and if you are interested to find out more please check out the the wiki or the research pages or if you have any questions you can maybe either ask me now or outside about how you can build on this stuff I think also the week is a great place to total to understand a bit better what you can do right now will be soon releasing a a new network called Kusama which is aimed to test a lot of these economics that I was just talking about and some other things as well but it should be a cool playground tool to see if if pocket could be a good platform for for your

dub so thanks a lot [Applause]