Tip:
Highlight text to annotate it
X
What I would like to do is describe an imaginary or fictitious bitcoin transaction
and then talk about how somebody might try to game or defraud this system
and why it's mathematically hard to do
but why there is actually an economic incentive in the Bitcoin system
for different people to behave honestly.
Let's suppose that there is someone out there named Dan.
Dan wants to order a cheese pizza from Pete's Pizza Shop.
Let's say that Pete's Pizza Shop accepts bitcoins as payment
and that it costs 1 BTC for a pizza pie.
Imagine that Dan previously received 5 BTC from his cousin Carol.
So, Carol, laballed by "C", gave to Dan 5 BTC,
which we can label as a "B" with a circle around it.
He wants to use one of these 5 bitcoins to buy a pizza from Pete.
What Dan's bitcoin client will do is it will create a transaction record
that includes information about how Dan got these bitcoins.
So, in this case it includes information about this transaction between Carol,
who we've marked by "C" and Dan for 5 bitcoins.
Then it specifies that Dan wants to give one of these bitcoins to Pete...
We will label Pere by "P".
...and also that Dan is going to take the remaining 4 bitcoins
and that will be basically change to himself.
The way that bitcoin is built is that you have to actually specify the change.
Whatever goes into the bitcoin system has to come out at the other end.
So, you can't have a transaction with the numbers on and up.
Whatever is remaining is either change
or part of it can be used a a transaction fee and so on.
For this example, to keep things simple,
I'll assume that there is no transaction fee in place.
The transaction fee is just zero.
We'll focus only on the situation
in which everything is being accounted for in the transaction.
This transaction record is going to be boradcast out
to the entire Bitcoin world.
In particular, Pete is going to receive a copy of this transaction.
But in addition to Pete receiving it,
so too will the other people on the Bitcoin system.
If you recall, there are these special nodes, these special entities or people in Bitcoin
that are known as bitcoin miners.
These bitcoin miners are going to be responsible
for making sure that everything checks out in the transaction from a global perspective.
What they do is they look at the full record of transaction
and this transaction record is public,
it's known as the transaction block chain...
I'll put the description of the transaction block chain right here.
...and this transaction block chain contains the history
of every single transaction that ever occured within the Bitcoin system
from the beginning of time,
the time of the first block, which is known in Bitcoin as the genesis block.
Everybody can verify the details of any transaction if they wanted
because that information is public.
In particular, what these bitcoin miners will look at
is whether or not Dan previously received 5 bitcoins from anybody else,...
In this particular case it was his cousin Carol.
...whether or not Dan has tried to spend those bitcoins previously,
and so on and so forth.
These bitcoin miners are all collectively trying to take all these recent transactions
that haven't yet been recorded.
That includes not only the transactions between Dan and Pete,
but there may be other transactions floating out there
that took place around the same time.
The bitcoin miners will look at all these different transactions at once
and they are going to try to figure out how to form a transaction block out of these transactions
and they'll wanna add this transaction block
to the end of the current transaction block chain.
If you might recall from previous videos,
that for a bitcoimn miner to add a transaction block to a transaction block chain
they have to solve, what's known as the proof of work puzzle.
The Bitcoin system is designed, or maybe calibrated is the better word,
so that, on average, one miner will solve a puzzle in about ten minutes.
It's worth stressing here that it could take a long time
for any one individual miner to solve the puzzle...
It could even take maybe a year or even two years.
...but because there are so many of these miners working at the same time,
one of them is bound to get lucky and solve the puzzle quickly.
Each of these proof of work puzzles
that is associated with a transaction block
happens to have a difficulty score associated with it.
This difficulty basically represents how hard it was to solve that proof of work puzzle.
Imagine that there are some numbers
and we will call these numbers
for the most recent difficulty score.
These are just numbers that somehow represent
how hard it was to solve this proof of work.
When you at overall chain,
what the Bitcoin system is interested in,
it is interested in how hard was it to construct that entire chain.
The reason it's important for someone to understand how hard the entire chain was constructed
is because this overall score for this chain,
this difficulty score for the chain
is what's used by Pete or by other people who are receiving bitcoins
to figure out whether or not they trust the transaction.
The more work that went into the overall chain,
the more trust they will have in that transaction.
The reason for that is that the way Bitcoin works
is that if there was ever more than one transaction block chain out there...
Let's say there was a bad user out there
or maybe somebody didn't receive a particular message in time
or whatever reason.
If there is somehow more than one transaction block chain out there,
according to the Bitcoin protocol, everyone is supposed to work off of the chain
that had the most work put into it.
So, we ignore chains that have a lot less work
and only consider the chain that had the most work put into it.
In the Bitcoin system, that particular chain is often referred to as tha longest chain.
This is actually kind of a confusing piece of terminology
because by longest chain we don't mean that this chain is long in any physical sense.
We really just mean...
And I'm gonna put equal bars to kind of say what it means.
By the longest chain we mean tha chain that has the most work.
The way that the work is defined is that you look at all these different difficulty scores,
you add them up and that gives you a difficulty score for the entire chain.
Now we are gonna be interested in the chain that had the most work put into it
and we call that the longest chain.
Let's imagine that Dan is dishonest
and that after he eats the pizza...
Let's say Pete is convinced,
he gets this bitcoin from Dan, he waits a bit,
he sees that there is a long chain out there that contains the transaction,
he sends the pizza over to Dan,
Dan eats the pizza
and then decides that he doesn't want to behave honestly,
he wants to somehow cheat Pete or he wants to defraud the system.
The way that Dan is gonna try to defraud the system
is by attempting to create another transaction,
in which he assigns the 5 BTC he got from Carol to somebody else.
Let's call this person Fred.
Fred could be Dan's alter ego, could be a friend of Dan's.
It doesn't matter who Fred is
because we know that Fred isn't the rightful owner of these bitcoins.
What Dan is gonna try to do is he is gonna try to take those 5 bitcoins that he got from Carol
and he is gonna now try to take these 5 bitcoins and assign them over to Fred.
This is something that we don't want to allow
because that would mean that somehow Dan was able to spend these 5 bitcoins twice over,
he's effectively double spent those bitcoins.
Obviously, one of these transactions should be considered fraudulent.
The other one should be allowed to go through.
It's important to keep in mind that if Dan just tried to spend the same coins again
without trying to cover his tracks or anything of that nature,
everybody out there would know that Dan is up to no good
because thay can see from the existing longest transaction block chain,
namely this existing chain from the beginning,
they can see that Dan already spent these coins before,
he shouldn't be allowed to spend these coins again.
What Dan has to do is he has to create a different transaction block chain
that contains just the second bogus transaction in it,
and this will be the transaction to Fred,
and that would leave out the other transaction to Pete.
Hopefully, everybody else will start to accept or believe this newer chain.
Since everyone in Bitcoin ultimately goes with the transaction block chain
that contains the most work,
namely this longest chain that we talked about,
Dan has a chance, he has a hope potentially of being able to pull off this type of a fraudulent scheme.
The real question now is how likely is it for Dan to succeed.
For Dan to be able to pull this off,
he has to start off with the transaction block chain that existed previously
and he has to try to add to that transaction block chain a different transaction.
So, rather than having this previous transaction
where he gave money to Pete,
he is gonna try to create a new transaction and add it to the transaction block chain
that contains this other fraudulent transaction between Dan and his friend Fred.
This is gonna be the bad transaction between Dan and Fred that will be in this new block.
In Bitcoin lingo this idea is known as a fork in the chain.
And what is meant by a fork is that somehow there is more than one version of histories.
Somebody tried to rewrite their tracks or to cover their tracks
and to revise history the way we know it.
What that really means is that there is now somehow more than one version of what happened out there.
In this example, one branch in this fork is legitimate
and the other branch is bogus.
The legitimate branch was the one where Dan paid his friend Pete for pizza
and the bogus one is this follow on transaction
where Dan attempted to pay his friend Fred with those same exact bitcoins.
Remember that any transaction block that's added to this transaction block chain
has to contain within it a proof of work puzzle,
or solution rather to a proof of work puzzle.
Otherwise, noone will accept the chain.
So, if Dan wants to cheat the system,
he has to secretly solve a new proof of work puzzle himself.
But the challenge for Dan is that he is starting off with a bit of a handicap,
because there is already this longer chain out there
that people have started accepting.
Keep in mind that because this chain is out there,
other nodes may have started to build on top of this chain.
Every ten minutes, somebody is adding to this chain on average.
So, there is this longer transaction block chain out there
and Dan wants to create his own fake chain.
So, in order for that chain to be believable
he has to now be the longest chain out there
and he has to basically do all this proof of works
to create the chain that is longer.
To come up with this longer chain on his own,
Dan has to outrun the existing proof of work chain.
That means he has to solve not just typically one proof of work puzzle,
but may need to solve several proof of work puzzles
to create another chain that he hopes will be longer than the chain that's out there.
If he can get the longest chain and he can get people to start using that chain instead,..
and that's the chain he might want people to use
because it contains this fake transaction,
but it removes the previous transaction where he gave money to Pete.
To solve a proof of work Dan has to take whatever computing power he has access to
and he has to start working on solving the proof of work puzzle.
There are no known shortcuts for solving these puzzles.
If you recall from any of the proof of work videos,
to succeed in a proof of work is kind of like winning a lottery.
There are ways to do it, but it depends of how much computing power you have.
The more computing power you have access to,
the more lottery tickets you have.
If somebody has even one lottery ticket, they do have the chance to win the lottery,
but they are far less likely to succeed
compared to somebody ho has a lot of lottery tickets in hand.
Even if you succeed once in winning the lottery with the small numer of tickets,
the likelihood of repeating that feat over and over again, several times in a row
becomes much smaller.
That's exactly what Dan has to do.
He has to win this lottery multiple times
until he has a bigger chain.
The key thing you have to look for is how much computing power Dan has
versus how much computing power all the honest nodes in the system have together.
If it's the case that all the honest nodes...
Let's say we call this "the honest computing power".
When I say "honest computing power" I mean the total computing power
for all the bitcoin mining nodes who are honest in a network.
If that total computing power that they have access to
is greater than the power that Dan has access to,
so Dan's computing power,
the Bitcoin system will be safe
because it will be hard for Dan to be able to create this fraudulent transaction chain,
because he won't be able to outrun the honest people.
The honest people win the lottery more frequently and will create the longer chain
and Dan's attempt is gonna be very much an uphill battle.
It is still possible that Dan could have access to a lot of computing power,
maybe he is very wealthy or he has a lot of resources,
but he'll really need a lot to be able to do that.
More than everyone else who is legitimate combined.
That's one aspect of why the transaction block chain is secure,
because it's unlikely for anyone individual to have access to just that much computing power.
Here I should point out that there is also another aspect to the security of Bitcoin.
If Dan has access to that kind of computing power to solve these proof of work puzzles,
rather than trying to fight this uphill battle of forking the transaction block chain
and creating fake transaction and so on,
Dan is probably much better off,
just using that computing power he has for legitimate bitcoin mining himself.
You might remember that bitcoin miners, who solve proof of work puzzles
get both a reward...
For succeeding they get some numer of bitcoins.
...and they also get a transaction fee for all the transactions in the block that they validated.
So, there is this economic incentive for Dan to behave honestly.
Maybe I should just recap in closing the video
that the security of bitcoin transactions
comes from, first of all, this mathematical barrier
that makes it hard for Dan to fork the transaction block chain in a dishonest way,
as well as an economic incentive for Dan to just act honestly
and mine bitcoins for himself.