"Always Has Been" (or, "Wait, It's All Resource Pricing?" Part 2)

ETHCC 5 · July 2022 · 20:54

John Adler examines resource pricing at the execution layer of modular blockchains. The speaker challenges conventional gas-metering assumptions and argues that metering can shape demand rather than simply reflect resource supply.

Speakers

Topics

From ETHCC 5, hosted by Ethereum France.

Transcript

okay hello everyone so today uh we're going to be continuing on uh on a discussion that i started at last year's ecc where i gave this talk on resource pricing i kind of broke down how certain blockchains such as bitcoin and ethereum price their various orthogonal resources since then we've all become about 12 months wiser some of us have uh you know gained also about 12 pounds but we are now at the next ecc and we're going to talk about resource pricing yet again

this is again part two of this conversation uh so we're going to start off uh by talking about plastic grocery bags plastic shopping bags and i swear this is going to go somewhere so don't you know immediately immediately dismiss this as being orthogonal to the conversation this will this will go somewhere so about in 2008 some cities in canada implemented a rule where you would have to pay five cents if you wanted to get a plastic shopping bag when you went grocery shopping for each bag prior to this grocery stores just handed them out as freely as just completely freely you know if you wanted

to pass a plastic grocery bag to carry groceries they would just give it to you from the story that rule was actually repealed but regardless the point being it was implemented in the first place uh you know to curb various things one was waste right dealing with these plastic bags in the landfill wasn't exactly very good or easy it was also for environmental reasons right the environmental effects long-term environmental effects of plastic and things like fossil fuel consumption and so on can be pretty detrimental to the environment so they they implemented this rule that if you want to buy a plus if you want to get a plastic bag when you go buy your

groceries you have to pay five cents that's it just immediately five cents and in a few years this dropped the usage of plastic bags in grocery stores by up to 70 percent so it's a pretty pretty astounding result given how small this change was so what are some lessons we can get from this i said i said this is going somewhere so uh in a completely free market there are two parties there's producers and there's consumers in other words their supply and demand and where the two meet you get some sort of price equilibrium a price for a good or a service or a resource if you will but we don't live in a free market do we

because there's a third party there's literally everyone else on the planet right when it comes to things like let's say a single-use plastic when it comes to things like you know you live next to a coal plant so you know the emissions from a coal plant the consumption of fossil fuels you don't just have a producer and a consumer you also have literally everyone else on the planet and you have the planet itself that is also going to be affected by this you know by this transaction uh and the kind of lesson on this is that the free market where you only have two

parties the consumer and the the producer and the consumer is not very good at pricing in and accounting for negative externalities uh an example of this is exactly like we saw with the plastic bags the environmental waste caused by single-use plastics uh if you have you know coal power plants this is like the you know the trivial examples you can see you see anywhere uh there's obviously much more nuanced things but you know the trivial examples is like you know the coal power power plant you know if you live nearby it you see the emissions you know the the beer can six you know the six packs the those little plastic rings can go and like choke turtles sea turtles right these are negative externalities that are not actually involved directly in the transaction that takes place uh and

the free market doesn't actually account for these things uh if it did then the resource might be more expensive to purchase such as plastic bags going from free to not free to five cents so what is good or what is a possibility to actually account for negative externalities that is the thing known as regulation uh which is something that you know in the blockchain space we don't really like talking about because it has certain negative connotations but you kind of do need regulation if you want to price in and account for negative externalities which do exist in the blockchain space and believe it or not this talk will not be about proof of work at all and it's en

energy consumption so how does what we discuss relate to the blockchain so in the in any blockchain be it bitcoin or ethereum whatever you have there is a resource that is being sold there's a resource that is available to purchase and that resource is block space in ethereum block space is measured in gas right as a resource now from my talk last year and kind of you know briefly summarizing it you don't actually just have a single resource gas i mean that's what ethereum provides but really under the hood what a blockchain provides is a number of orthogonal resources such as a computer's cpu time power consumption you know running

computation stuff actually consumes power network bandwidth memory usage and capacity memory io potentially and also disk usage for things like storing the blockchain state blockchain state being you know things like account balances contract storage slots and whatnot uh all of these things are actually orthogonal resources they're not all just one thing in gas uh but they're priced in gas uh in in the ethereum chain so uh the supply of these orthogonal resources like the maximum supply that is provided by the blockchain because again here we're analyzing you know supply and demand stuff is what is it bounded by

right it's not actually a free market uh it is not the case that if people want more block space that the blockchain will provide more block space to keep the price at an equilibrium the fee market that we all know and love when it's a bull market and ethereum fees go up to 100 is actually caused by not having a free market on the capacity of gas the capacity of gas or the capacity of resource consumption really is bounded it's fixed it's set through what we could call regulation right the protocol itself enforces some regulation it does not allow free market on the gas capacity on the block space of the

ethereum chain rather we enforce them we say you can only have 15 million gas per 12 13 seconds right that is a form of a regulation that's how we kind of bound upper capacity uh this is obviously needed because if you allow the block space to be completely unconstrained it would be impossible to run a full node and then goodbye decentralization okay so let's see how now bitcoin uh accounts for uh negative externalities and so on using regulation which is kind of the ultimate irony given the you know crypto uh given the libertarian roots of cryptocurrencies you know crypto anarchist and all this other stuff is

kind of ironic that bitcoin has regulations built into his protocol around resource pricing so uh last year i discussed segwit a lot so if anyone wants to learn more i suggest you refer to that talk but to give a very brief overview the segwit uh the segwit protocol change that was done in around 2017 or so you know the bitcoin block size wars was essentially the separation of witness data from non-witness data where witness data is something like a digital signature in other words it's authorizing some state change and the non-witness data is a state change it's like a state changing data things like you know alice sends five bitcoin to bob uh the

wit that's the non-witness data and the witness data is alice's signature that she authorizes the spend uh the reason you want this separation between these two things is that the signature once you've validated it and once you've executed you know once you've actually verified the signature against the state transition you don't actually need to keep it around in your full node right your phone load can actually discard witness data but your full node needs to keep around witness data it can discard witness data but it needs to keep non-witness data in other words it needs to keep the account balances of everyone right if you don't know the account balance if you don't know alice's account balance you don't know if alice has five coins to send to bob so a full node needs to keep what is

called state around forever uh and the state is a negative externality so how what are the regulations in bitcoin around this negative externality uh here's some brief clips from peter willa one of the bitcoin uh core developers a former maintainer bitcoin core uh he's talking uh the the kind of background on these on these tweets is that witness data actually has a 4x discount in cost over non-witness data so one byte of witness data costs four bytes of witness data costs as much as one byte of non-witness data uh which may seem like well why is it that you're why are you doing this price

fixing right why is witness data four times cheaper why don't you just make them the same price if they're both bytes right this seems a bit unfair to charge witness data less and that's because just bytes themselves aren't actually a good measure of the negative externalities imposed by that byte because witness data can be discarded therefore there's no negative externality to that byte you download it you execute it and then you discard it non-witness data in other words you know state changing data you need to keep that around forever so it's not just you download that byte you execute it and discard it you have to download it execute it and keep it forever potentially not keeping it forever that

you that uses up disk space that is a negative externality that all full nodes need to pay for forever and you have to account for it in some way and that's what bitcoin does it makes witness data cheaper than non-witness data or rather it makes non-witness data more expensive than witness data okay how does ethereum do it right this is probably more familiar to you and it's a much more uh kind of nuanced and detailed uh thing than just bytes and you know witness anonymous data there's a gas accounting schedule right every instruction in the ethereum virtual machine has a particular cost in gas so it's associated with it right so an addition might cost two three gas

right a state changing operation like a state uh read might cost several hundred gas i think nowadays i don't remember when i took the screenshot nowadays a state read i think might cost a couple thousand gas if it's a cold read uh and the state right costs 20 000 gas right so there's an almost 10 000 x difference between a state right and an addition and why why is this the way it is uh why why isn't it something different and what is this ultimately is this a free market well you know it's saying that a state right cost 20 000 and an addition cost three that ratio between them is fixed in other words it's not actually a free market between

your different resources it's actually regulation so any form anything you do with resource pricing this accounting you know this differentiating of different resources which again you don't just have one resource you have multiple orthogonal resources and you have negative externalities accounting for these negative externalities is ultimately a form of regulation and it's a regulation enforced by the protocol itself so we talked a lot about supply here uh but we haven't talked about the other side of the coin right we've talked about supply we talked about how to add some regulation to that supply but we haven't talked about the other side which is the zoomer over here the consumer

right uh what can we what can we do with these guys so uh as we saw before in a free market you have supply and demand and where they meet there's going to be some price equilibrium now uh you would expect that in a free market if you increase the available supply and demand demand does not change then the price will decrease right there's just more of the stuff but if the price has some sort of equilibrium and the demand is flexible rather than inflexible then if you increase the supply the demand can also increase and you can keep the price the same right

uh this isn't exactly a particularly interesting thing for us if our blockchain resources are all metered under a single thing in other words if all you have is bytes or if all you have is gas this you know this notion that you can potentially change the supply uh to then affect the demand and keep the price the same isn't particularly interesting because as we saw way back in the previous slides you can't change the supply block space really right the supply of block space is fixed for any blockchain ethereum is 15 million gas every 13 seconds bitcoin is 4 megabytes every 10 minutes right bsc is whatever it is uh right there's some sort of fixed

block fixed capacity on the block space that every blockchain provides and you can't increase it flexibly right so the block space the block space is not flexible but what can we do we remember that the block space isn't actually a homogeneous single resource that is not just gas it's something else right uh it's that the resources that a blockchain provides are fundamentally backed by real computer hardware right there is a real cpu there is you know real power consumption there's real network bandwidth there's real physical ram then there's real disk usage used to store the state and these things are what the blockchain network provides right it's a

abstraction it's a virtualization over real hardware to create the internet computer right so it's not it doesn't just have a single resource it actually has multiple resources that are orthogonal and you can actually use one resource more and you can use one resource less now out of these some of these are negative externalities and some of them are not right cpu usage for instance well first of all cpus improve dramatically year over year maybe not in single core performance but in multi-core performance they improve just well i mean moore's law is still in effect uh right despite despite everyone's predictions that'll end some day it's still in effect even to this

day uh you know computers are the cpus are getting dramatically faster uh what is not necessarily getting better is potentially things like power consumption right you don't necessarily want your blockchain to have a lot of power consumption want to verify transactions you know again it's not related to proof of work but rather just you know the node execution uh things like bandwidth for instance network bandwidth you download you download your block once and then okay you're done right you don't have to re-download it again you don't have to infinitely consume network bandwidth for all future time for that one block you've downloaded similar thing for ram but disk on the other hand disk is where you're going to store your blockchain state right and as we discussed earlier a blockchain state is

things like account balances contract storage for bitcoin would be the utxo set uh those things need to be kept around by all full nodes forever you can't discard the state because if a full node doesn't know what everyone's balance is it can't actually verify that a transaction is valid uh so you you know this this this disk usage for for blockchain state is a negative externality when you send the transaction you can't just pay for the cpu time you also have to account for in some way for the negative externality of uh this you know persistent disk usage forever to store the blockchain state

and this can't be done well with the free market as we've seen but it can be done through regulation and it can be done through the gas accounting schedule that we saw earlier right you price something like a state right 20 000 gas you make it much more expensive than a an addition in the hopes that you're accounting for the negative externality that's why you get that ratio and not a free market ratio between the two so uh since we set the ratio is there anything stopping us from setting the ratio differently and the answer is actually no and this is where the graph that we saw in the previous slide here comes in right that if you increase supply and price remains

the same then you can also increase demand right and vice versa so what you can do with this is sure you can't change the total gas capacity but what you can do is play around with through changing the regulations and in anticipation of negative externalities such as this usage for state you can actually make one resource be used more than the other for instance if you took the ethereum gas accounting schedule and you said let us make the cost of writing to storage 10 times more expensive what would people do they would write contracts that did something like this your blockchain would then use storage less as people were induced as demand were

induced to use storage less but the total gas capacity is the same so what would they do instead well they would use more cpu and that is what you want you don't want negative externalities you want to reduce those as much as possible so you want to reduce state usage and you want to encourage things that are just one-time costs such as cpu time especially if those one-time costs if the capacity of those resources that are you know that are that are uh hitter cost is denominated and can scale grade the year over year which cpu time does uh so you have this uh very interesting property that we don't actually have to take the gas accounting schedule and

just live with it we can actually induce demand for different orthogonal resources by changing the regulation by changing that gas accounting schedule for example like i said greatly increase in the cost of s storage right and encouraging people to use cpu more and you don't actually have to be reactive with this a lot of changes a lot of proposals rather in the ethereum ecosystem have said well it's more expensive to do storage now than it was a year ago why don't we double the cost of storage but you don't have to be reactive you can always be proactive we know where the negative externalities are

it's in state storage so why don't you be proactive and change the induce a change in demand by changing the supply and specifically by changing the ratios in the supply for these different orthogonal resources okay so with that uh we can wrap up with question time we have a few minutes and if anyone wants to follow along with the work that we're doing here's a qr code for our website [Applause] okay thanks so much everyone [Applause] you