What did we do? So this is where Proof of Work comes in.
I'm sure you've- you've heard the term,
uh, Proof of Work many times.
And the whole point of Proof of Work,
is to choose a miner at random,
even if one entity tries to pretend to be a large number of miners.
So how do we- how do we do it?
What happens is every block,
uh, defines a certain puzzle.
Yeah, so this is a cryptographic puzzle,
um, which we'll denote by X. Yeah.
So a block number N defines puzzle X.
Now, what is a puzzle?
A puzzle is basically a problem that takes a certain amount of work to solve.
Yeah, so let's say that,
um, we'll call the solution Y.
So Y is a- a solution to a puzzle,
and it's very easy to verify that if a particular Y is a solution to puzzle X.
So to mine a block,
basically the miner has to find the solution Y,
that solves the puzzle X defined by the previous block.
Yeah. And that allows the miner to create the next block.
The next block is gonna define a new puzzle X-prime,
that's gonna have a solution Y-prime and so the system continues.
So how does the miner find the solution X?
Well, let's suppose that the density of solutions is about one in two to the 70.
That's roughly the density in the Bitcoin Proof of Work system now.
Yeah. So that means that one in two to the 70 values of Y,
is a valid solution to the problem.
Okay. So how do- how does a miner,
uh, find that solution?
Basically, he's gonna try lots and lots and lots of random Ys,
until finally he finds one Y that solves the puzzle.
How does he do that? Well, he's just gonna
try over and over and over and over and over again,
until he finds a Y that works,
and that's roughly gonna take two to the 70 tries.
Two to the 70 is a very large number yeah,
but the- basically the- the miner is gonna,
uh, run basically for- for, uh,
enough time to try two to the 70 different values,
until he finds a solution to the puzzle X,
and that let- that lets him mine the- the new block.
Okay. So of course,
it's an assumption that there is no faster way to find the solution.
If someone figures out a way to solve the Bitcoin puzzles
faster than trying lots of candidates at random, you know,
obviously they'll be able to become a dominant miner,
because they'll be able to solve- to find solutions before anybody else.
Okay. So the point here,
is the first person to find the solution Y to puzzle X,
is the one that gets to publish the new block and- and win the mini- miner rewards.
Okay. So that's basically what we see here,
that whoever finds a solution Y first,
publishes their block and gets the, uh,
mints the new block and gets the mining rewards.
Now, in some cases,
we might have, uh,
two people who find a solution at the same time,
uh, that introduces a fork.
And I'll say that Bitcoin actually has a mechanism, uh, uh,
to, uh, handle these forks,
but, uh, I will not discuss that here.
Again, this is something that we- we- we cover
at great length in our, uh, blockchain classes.
Okay. Good. Um, so we already said that the miner who finds the solution Y,
is the one that mints the new block and therefore,
wins the mining rewards.
So in Bitcoin, the mining reward is 12.5 Bitcoin,
in Ethereum the mining reward is five Ethers, and so on and so forth.
So generally, in a Proof of Work system,
the miner who actually finds the solution,
makes a lot of money from finding that solution.
Okay. Good. So interestingly,
the probability of actually finding the solution,
is proportional to how much computing- computing power you have, yeah.
So, uh, if you have a lot of computing power,
and you can always find the solution,
that means before everybody else,
that means you'll earn 12.5 Bitcoins every 10 minutes.
And so just you realize, that translates today to around $90,000 every 10 minutes.
Yes. That's basically what's, uh,
the maximum amount that a miner can make,
if they're able to find the solution every time.
Well, so the fact that this is how much money they can make every 10 minutes,
puts an upper bound on the amount of power that- that
economically makes sense to spend in finding a solution Y.
And so if you just put this, um,
together so just look at the price of power.
So $90,000 every 10 minutes,
it translates to about 18 terawatt hours of energy at any given time.
So this is the maximum amount of energy,
that economically makes sense to use for Proof of Work,
if you're still gonna be making money from, uh,
from mining, and that applies to the whole ecosystem as a whole.
Of course, miners are not even close to spending this much energy for finding solutions,
but this is in some sense a theoretical, uh, maximum.
Nevertheless, it's kind of interesting just as a kind of, as a funny anecdote,
it's kind of interesting,
that if you look at how much the country of
Ireland may- how much energy the country of Ireland makes,
well they make about, uh,
26 terawatt hours, um, at any given time.
And so it's kind of interesting that the, uh,
maximum theoretical amount of energy that makes sense in a Bitcoin network,
is basically comparable to what the entire- entire country makes.
Now again, this is actually incorrect.
It's not true that the Bitcoin network actually spends this amount of energy to,
um, to find the solution Y,
this is just a theoretical maximum.
Nevertheless, uh, we know that there's actually quite a lot of energy being
spent to find these Ys because there's competition among miners,
to be the first to find the Y,
and the more computing power you have,
the more likely you are to find it,
and to find that that Y and get the mining reward as a result.
So there's a lot of competition,
a lot of energy being spent at finding these solutions.
And really, uh, there's not a lot of benefit to that energy,
other than creating these new blocks.
Okay. Good. So that's what,
uh, Proof of Work is.
The reason, uh, it prevents- presumably prevents the Sybil- Sybil attacks, is, um,
if you're gonna, say that you can control many miners,
that's gonna be expensive for you [NOISE] because
you are going to incur a quite high costs,
in the power that,
uh, your hardware is gonna demand.
Yeah. So controlling many miners is, uh, not that easy.
So that was the idea that would lead to
presumably decentralization of the mining infrastructure.
In reality, unfortunately, that hasn't quite happened.
And so if you look at blockchain.com,
they will tell you the distribution of miners for different blocks,
or for every block we can identify the miner that mined that block.
Um, right, that's the miner that gets paid by the Coinbase.
And so we identified the miners,
and we can look at a particular, uh,
24-hour window to see who mined the most blocks.
And so you can see that, um, you know,
btc.com mined around 20 percent of all blocks.
Endpull mined around 14 percent of all blocks, and so on and so forth.
If you sum up the top four,
you'll see that together they, uh,
control about 55 percent of the Bitcoin mining power,
which means that every other block is,
uh, mined by one of these four.
So in reality, there's actually quite a lot of centralization,
um, of the mining power, which is kind of a problem with,
uh, the Proof of Work system.
Okay. I should say though, that, uh,
consensus protocols and Proof of Work,
is a fascinating and extremely interesting topic.
There are lots and lots and lots of attacks and lots and lots of, um game theoretic,
uh, issues around, around mining,
how to distribute rewards and so on.
Um, it's a fascinating and long and large topic,
which I won't be able to, uh, cover here unfortunately.
Um, [NOISE] but again, we- this is something that we cover quite,
uh, extensively in our courses.
If you wanna learn a little bit more about, uh,
Proof-of-Work and the issues with proof-of-work, um,
there are beautiful attacks that are kind of interesting to look up,
so I would suggest looking up an attack called selfish mining,
an attack called feather forking,
um, and many others.
And so you can just look for those terms,
and- and read a little about,
um, issues with Proof of Work,
and attacks on Proof of Work,
uh, on your own.
However, I have to say that because of the energy,
uh, expenditure with Proof of Work,
and also the fact that it doesn't quite lead to decentralization,
the more modern projects are moving away from Proof of Work and eventually,
Proof of Work actually might be phased out.
So just to give you an idea for what's coming to replace
Proof of Work because we still- we still try to pick,
uh, generally speaking, try to pick miners at random,
and we try to do it in a way that's Sybil resistant.
Um, and so two ideas that have come- have come up,
is one called Proof of Space,
where the idea here is rather than choosing a miner proportional to how much,
uh, computing power that miner has.
We instead, choose a miner proportional to how much disk space that miner has.
So this encourages people to use their disks to win, uh, you know,
to win the mining rewards,
but disks aren't very- are energy-efficient.
So it's not gonna be, uh,
it's not gonna require a lot of power to actually compete in this- in this environment.
All you need is, uh, a lot of disk space,
which presumably, you already have for other reasons.
Yeah. So there's a- a blockchain being created
that uses Proof of Space instead of Proof of Work.
Another idea which is very popular,
and many blockchains actually use,
is what's called Proof of Stake,
where again instead of, uh,
uh, committing to resources like,
computing power or space,
instead, the miners put up collateral which we call stake.
So they use coins themselves that they bought,
as collateral for behaving honestly.
And then if they ever misbehave,
they're penalized in some way.
For example, in the Ethereum network,
there's a proposal, um, to basically, uh,
what- what's called slashing,
where misbehaving miners will ask- actually lose some of their stake.
Yeah, and there are many examples of Proof of Stake systems,
I just listed a few here if you wanna
read a little bit about how these Proof of Stake systems work.
It's still a very complicated,
um, concept to get right.
Uh, there are a lot of ways to design a Proof of
Stake system that would be in a non-stable equilibrium,
uh, that might actually,
uh, uh, become unstable.
Uh, and so this is actually a fascinating area,
it's still an area of research.
Um, but as you can see they're already experiments in
place that are experimenting with Proof of Stake,
so no energy being wasted here.
Um, and instead we use,
uh, we use, uh,
stake, um, uh, to- to choose the miners.
And finally, I'll mention there's another approach called uh, Quorum systems,
where instead of choosing miners at random,
basically we say, we designate miners that we trust, um,
and essentially new blocks are issued by a quorum of miners,
you can imagine maybe, you know,
20 miners that are distributed all- all over the world,
perhaps run by large banks,
large reputable banks where you just happen to
trust them to run the blockchain correctly.
And if they do, then they're the ones who are allowed to issue blocks.
And there are a couple of systems in that, uh,
paradigm, uh, Stellar is a good example.
Um, and so again,
no energy being wasted here.
It's basically the blockchain is being managed by a collection of miners,
that the users decide to trust.
Okay. So that's another example of a consensus system.
Okay. Good. So that's what I wanted to say about consensus mechanisms,
and so we're almost done.
Uh, in the next segment, I'll just tell you a few final thoughts and then