Skip to content
by Unity Nodes
NEAR Protocol

NEAR Lunch and Learn Ep. 02: Economics in a Sharded Blockchain

about 23:19 long

Nothing is loaded from YouTube until you press play, and then without tracking cookies.

About this video

Here, Illia discusses Economics in a sharded Blockchain.

~~~ABOUT Lunch and Learns~~~ This is a new series of videos exploring a concept on the NEAR protocol blockchain discussed in the NEAR office at lunch. Grab a sandwich and settle in!

Follow the latest from NEAR Protocol on,

Discord: near.ai/discord Medium: near.ai/medium Twitter: near.ai/twitter GitHub: near.ai/github

Transcript

3,501 words

Captions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.

  1. 0:05

    hey everyone this Ilya from near I'm gonna talk about economics in our new episode of lunch series so let's start kind of to compare how the economics in sharted blockchains differs from economics and kind of regular blockchain with one one chain so right now if you think of it when we produce a block right there's a limited capacity how much you can have of transactions and as

  2. 0:36

    kind of blocks and that field more naturally you're starting to compete for resources naturally you starting to compete for the size for the space in the block for processing for space etc and to prevent that we have pretty much a market price for the transaction fee in the system and it goes up as the blocks get filled now in kind of shard block chain one of the main points is that we scale and don't have a problem of limited block sizes so instead we

  3. 1:14

    have multiple chains kind of going in parallel that pretty much can take over some of this capacity and balance out the size now there's different charting designs and actually depending on the shard and design the economics of this is very different today we'll talk about night chain design and specifically a few of the things we're doing to make sure that economics is both straightforward for developers and

  4. 1:46

    balances out so kind of one of the important things is that if you put if developers can put their applications into a specific shard right so you have shard 1 or 2 they can decide oh I want to be in chart 2 let's say it's less used I can see there's a you know the prices will be lower if you allow them to do that what this means is now some other people want to kind of join them there and as

  5. 2:22

    we saw in the seating one of them kind of main values his cross application interaction compatibility so if I want to work with the sales application let's just say maker decides to live in char to my application wants to interact with maker I want to use die in my application I will want to live in the same shark and obviously let's say this was compound somebody else want to kind

  6. 2:52

    of plug in there as well so as this starts to happen this shard will actually start fill up as well and at some point the prices here will start going up as well this creates a lot of kind of pervasive incentives on the application developers or as well as in general in the whole system now the other kind of consideration we should keep in mind is that that cross chain communication is actually

  7. 3:23

    depending on design may take some time so one of the things we're doing in Thein shade is making sure that the kind of receipts get rerouted every block and you can check out the previous episode to learn how exactly this is done to kind of compare this in some of the other approaches if you are using for example a beacon chain that might be producing blocks less frequently or actually just has this cross-linking happening less less frequently that

  8. 3:57

    means that the price of communications actually might be more expensive and as soon as you have more expensive price of communication this means that if my app lives on this chain the price of even using die it starts to become higher because it's not just that I need to create a transaction here I also need to execute something there as well pay for cross shard communication and wait for a period of time which was in which somebody can front around me and do all kinds of interesting things so again in

  9. 4:32

    nightshade with trying to prevent all this and we're trying to make sure that developer in a way doesn't need to think of sharding and Ted just deploys application and uses them in a straightforward way so the idea is that as a developer you just deploy an application and it can and it gets assigned to one of the shards depending on the current layout of the network so to do that one of the things

  10. 4:59

    we're doing is called dynamic charting this is the idea that if you have all your contracts let me draw this differently if you have all your contracts kind of laid out on some space for example this is just a hash of account ID and each contract has you know some amount of transactions that have happened during the period of time or specifically more like gas spant you know four on this contract you want to

  11. 5:35

    split it into shards trying to balance out that the charts has about the same amount of gas spent per ebook or per some period of blocks because this is now done dynamically developers even if they try to live together with some other contract even if they grind account IDs or whatever they may end up still be in a different chart right so you're kind of removing this incentive for them to live in the same shard and trying to be as close as possible instead you actually allowing this idea

  12. 6:10

    of like rebalancing and but it's trying to smooth out the economics of the system instead now the other thing this like in Night Shade we do write this we make sure that transaction had receipts happen was in the same block this pretty much provides us with idea that even if the two contracts are live in the same shard right now because of you know they end up in the same shard we still actually create cross shard

  13. 6:47

    receipts for the next block to execute here which means that as a developer you really don't have any kind of difference if your app lives in one shard or in like in different shards of the same shard with what you want to operate with so it's always happens the synchronously this also has a huge benefit of actually being able to execute this processing in parallel because you now and don't have any synchronization within the block and

  14. 7:17

    there's like lots of benefits around that now what this means is is that when the blocks are produced right when you only produce in block in proof of stake what happens is we don't actually execute it because you only need to assign the transactions that will be in a block and publish it and start accepting approvals which means a kind of cost for a block producer at the moment is actually not proportional to the transaction weight of transaction gas but it's just kind of proportional

  15. 7:56

    to the size and this kind of leads to a next interesting thing is that because of the way we want to make sure that the security system is is as a whole by pretty much having what we call hidden validators so this is valid as that are validating kind of each validator validate subsets of shards but all together they validate the whole the whole blockchain and provide security for the whole blockchain and you cannot

  16. 8:31

    like individually assigned to them all this guy validated this subset of shards and this is amount of gas was executed etc so now what this means is you actually rewards the whole system right instead of splitting off this block producer produces this block and did this much work instead you're saying well the whole system did this much work this validators provides security for all this for all this work and by work I mean actually executing transactions and

  17. 9:00

    processing state so now we're kind of going away from this idea that each blog producer competing for transactions instead the kind of cost of executing is been split between all of the participants in the system evenly so that's or like proportionate to how much actual participation they've done during this period so that's kind of one of the important things is that we're trying to remove a lot of incentives that in the

  18. 9:30

    current blog chains are around like competing instead to kind of collaborating and here like this counterweight is that like if somebody tries to you know pretty much compete in some some ways they'll be kind of punished by everybody else economically well the punishment I mean by like what is the ways to commit this is so improved stake right you actually have assignment for each slot who needs to do

  19. 10:02

    which work right so the only way to compete is actually to skip so like let's say somebody builds a blockchain and I want to compete right by getting all the transactions to myself so the only way for me to compete is actually to skip all those guys and take all the transactions from them to my to my block that's really the way to compete now because the way the reward is done it's actually smeared among all the validators so in reality that's not

  20. 10:31

    really helping you in any way so the only way is like if you are the only person in your chain and you collect all the transactions that's the only way to do it but then obviously this chain has way more validators and will be preferred so you'll get nothing right it's only like we don't have folks just so you won't say the shard anyway yeah I'm talking about the whole system so because like because from our

  21. 10:58

    perspective right transaction routing happens kind of within one block and we can dynamically rashard the way I model this is that it's one chain like because really within shards like we're trying to remove all kind of prop like sharding details right then as of like as a valid as well as a developer you don't need to think of sharding people who could have committed of block producers but they want because we smear their words exactly yeah like validators cannot compete for

  22. 11:32

    anything anyways they just about like they literally receiving block and executing it and just making sure that you know all the miracle proofs are correct and if they not correctly slashing and that's separate topic but that's idea is that you actually yeah pretty much removes the incentive for block producers to do a lot of things that in proof of work for example this is actually a very bad idea and then you

  23. 11:55

    start accumulating more weight on top of this by trying to skip all right so this is one part there's a lot more detail here there's a paper being published with all the details around this now so the interesting part here is like how do we get block producers and Hill validator selected right so yeah to just finish on the reward part right so now given we have kind of dynamic number and

  24. 12:26

    and one of the ideas here is that actually you can grow number of sharks so let's say is the amount of gas that has been used within las block is actually went up over you know previous period of time what you can do you can actually allocate new shards and pretty much we split it dynamically xplit now what this means is that you're actually never hitting the cap of those kind of capacity which means like if you run

  25. 12:55

    just the regular auctions like your price will never go up except within let's just say like there's a neat ebooks right half a day so it was in an e-book you can actually have like a gross happening and then you reach shard and it's kind of like will reset again right so that's idea like the total grows have like happens like this but it was in each shard it kind of starts from

  26. 13:22

    just from zero every time you're a shard so like one of the main concerns is for example sedum is that given the auction it's very choppy right like like this blog there is a lot of interest and you know the price went up and the next block there's nothing happening and it ended up being gas cheap gas being cheaper so actually this idea from italic is to pretty much have a formula which is predictably changes gas over

  27. 13:56

    time and it depends on if block are less than half empty then the price goes down and if the blocks are kind of more than more than how full the price goes up so kind of taking this idea right you can actually say that gas price is a how much gas was used divided by gas limit minus half multiplied by some alpha so alpha is like how much you want to change each block so then with Xin was in an epoch right you have this idea that like price will slowly kind of

  28. 14:46

    increase but in in predictable way so you can actually like look at the block and it's even if you assume that it next block will be half full which also does not apply to you but like let's say you know your transaction gets included only in a few blocks you can assume what the gas price will be and have a predictable way so that's a good question so if you have gas prices in its shard this actually creates a huge problem for developers

  29. 15:19

    because let's say my contract wants to call contract to another shard this will call some other thing will come back right actually paying for this process fluid become extremely hard because you don't actually know by the time you get there what's the price going to be so instead we suggest to in a way a little bit miss price the gas because obviously different shards may have different like gas price because of the usage at the moment but instead make it simpler where

  30. 15:51

    as the transaction comes in it buys it like the price is the same across all shards that it buys it this gas for the food processing across all shards and then gets routed and then you just get a refund at the end it's nothing for something left so it obviously this is not like like there can be a shard that's like fully you know fully used right now but this is only kind of mispricing within this one epoch period

  31. 16:16

    of time so as a 3 shards you kind of rebalance everything again and it can process it properly heavily relies on this model yes if we decide to deviate from this yeah I mean like I don't think like as far as we know like there is no other model has been published that like actually clearly explains how would you how would you charge in multi chain environment and it's unclear that any like as a

  32. 16:51

    developer you will be able to properly price it because like properly models is pricing unless like prices are kind of don't exist in the first place that's that's the only other option is like no no gas prices whatsoever so like the only way in like a really multi chain environment is some somewhere you prepay and then you kind of get get to use whatever the multi multiple chains that you have I mean there's a lot more details how all this kind of ties together there's

  33. 17:23

    also like a lot of interesting Possible's to attack right now so the Sharks producers can try to withhold transactions to pretty much bump up the price by you know waiting out until they collect maybe like hundreds of thousand block blocks of worth of transactions and then like wrong is him out to push the price up now one of the things that we've done is each transaction has time

  34. 17:47

    to light and tgl ten to life so which means that even if L that is start to kind of hold them they actually will just expire over time one of the other thing is in this system you may end up in a state where the gas price actually just keeps going down right until it hits like whatever you numeric ten a numeric spaces so here we still add a min fee or min price and this is just

  35. 18:18

    like both to prevent like in Americas but also at the end Valdez actually have some costs associated to block production even though they don't actually execute it at a time but there is a kind of production so if the price goes below the block production cost they will kind of stop except in transactions period because they can just produce empty blocks and receive the rewards and this is like pretty much targeted to prevent that

  36. 18:50

    obviously this is also mispricing it in some ways but at this point this is kind of a best way to to model this well let's just say we have a empty blockchain is like or like less than half full blockchain so like we're always less and half full the price is going down because there's no competition yeah yeah so so we will shrink the shards but like what you want to model here is actually hit half half-full across the blockchain because then you have space to fill in

  37. 19:27

    so so yeah ideally it will balance on a half full all the time yeah yeah so that's idea it should also lay it around half full all the time balance towards everything approximately half then some shards a little dozen have constantly some others and that's why this is actually smeared across all sharks so gas use gas limiters aggregation of of gas used across all sharks but exactly I mean just this is

  38. 19:56

    more like a stopper in case let's just say nobody used blockchain for a period of time you know as we launch like hopefully we'll have a lot of usage but it makes sense to have some you know mechanics to prevent it so just to finish up one more interesting thing is now we have this idea that like the network grows with usage and and we have this idea that validators our block producers are not competing anymore for transactions right so this is very different from proof-of-work systems where people are actually competing to

  39. 20:35

    include transactions in their block right and there's a lot of kind of possible issues with this especially in Bitcoin has kind of coin based or inflation starts to go down people now can prefer to instead of building on the longest chain actually steal transactions from the longest chain or split transactions into into once that they include and wants it they will give to an x-block producer right so there's

  40. 21:04

    a lot of interesting research on that like on Bitcoin issues with this now we kind of sidestepping all that and what this allows to do is to actually have a inflation that incentivize directly this right so it sent devices so given reward and giving let's say gas used we're actually incentivizing people to produce blocks let's just say at the incentive like target incentive is inflation at 5%

  41. 21:39

    or like 5% of coinbase per year as gas getting used more right the idea is that your inflation actually gets lower and then as we hit 5% from there it actually can keep going now obviously this is like actually a lot of gas use so the idea is that we target like a really large network with a lot of usage but the very interesting point here is that like as we reduce like the proportion of the kind of inflation is

  42. 22:13

    very much dependent on how much usage the network gets so the more network use the better start values as becomes and it pretty much kind of contracts a lot of this negative elements of the current proof-of-work systems yeah so add at this break point which is I I don't remember exact number but it's it is a fair bit of transactions per second well it's like a gas per second really actually yeah pretty much inflation

  43. 22:49

    disappears and this becomes fully just sponsored by transactions but if you know people stopped transacting then it kicks in again so it's the idea that they're actually balancing these two things in a very direct way instead of saying that hey in 2020 whatever the the there'll be no inflation figure it out so and we think this is actually a very interesting model to kind of target sounds of properties that people really want from blockchain this is it for

  44. 23:19

    episode number 2 and we will tune more tune in more for to learn more about other components