Bitcoin Q&A: What is a Private Key? - YouTube

Channel: aantonop

[0]
"How is the private key calculated using the elliptic curve mathematical computation?"
[7]
"If transactions are public, why can't someone launch a brute-force [attack] and guess the private key,
[13]
knowing the fact that we have quantum computers now?"
[16]
Let's start with the first question for Rojit.
[19]
Private keys are numbers, that's all they are.
[22]
If you wanted to generate a private key, you can do so fairly easily using just pen and paper.
[29]
A private key is a number that is 256 bits long. A bit is either 0 or 1. How do we calculate a bit?
[39]
The easiest way would be to flip a coin.
[41]
Take a big sheet of paper and a coin. Flip [the coin]. If it's heads, write down 1. If it's tails, write down 0.
[54]
Repeat this 256 times. Now you have a binary private key, written on your piece of paper, generated randomly.
[64]
If somebody else tried to do the same thing,
[68]
they would have to try 10 ^ 77 times in order to produce the same private key (on average).
[77]
That private key is just a number [like 3 or 7],
[88]
[though those would be] very easy to crack, not very random [out of the vast possibilities], but still.
[95]
[With] that private key, the elliptic curve mathematics that follow is to take a known point on the elliptic curve.
[102]
When I say point, that means an X,Y coordinate on the line drawn by the function.
[111]
If you take the elliptic curve function of Bitcoin, and when drawn on a piece of paper it creates a line.
[121]
That line is in the form of curve, an elliptic curve, and it looks a bit like a squid.
[131]
There is a very specific point on the line of that elliptic curve called the generator point.
[138]
It's a set of X,Y coordinates that is pre-defined.
[144]
Everybody uses the same one. We write it down as 'G' for generator point.
[151]
The public key is simply the point 'G' multiplied by the private key.
[159]
If my private key is 3, then my public key is 3 multiplied by 'G.'
[164]
You might say, "Well, that's very easy! If I know the public key is 3 multiplied by 'G' and I know what 'G' is,"
[170]
"why don't I divide by 'G' and then I know your private key?"
[177]
The reason is because you can't do division on the elliptic curve. Division doesn't exist [there].
[182]
You know 3 multiplied by 'G' is the public key, but you can't figure out that 3 is the private key,
[189]
even though you know what the value of 'G' is.
[193]
That's how the elliptic curve computation works.
[196]
Now, what does multiplication by a scaler mean on the elliptic curve?
[201]
What does it mean to take a point and multiply it by 3? How do you multiply X,Y coordinates by 3?
[210]
This has a specific meaning on the elliptic curve.
[213]
To add 'G' to itself, to do 'G' plus 'G,' you take the tangent of the [generator] point on the elliptic curve.
[227]
The tangent is a specific mathematical construct.
[231]
You draw the tangent at the point of 'G' and at some point that tangent will touch the elliptic curve again.
[243]
That is one of the properties of elliptic curves.
[245]
If you take the tangent of a point on the elliptic curve, the tangent will bisect the elliptic curve at another point.
[252]
If you flip that point on the axis, that is '2G.'
[257]
Drawing a line between the two points is how you add them up.
[265]
You can create a multiple because 3 multiplied by 'G,' is simply 'G' plus 'G' plus 'G.' You can keep adding 'G.'
[273]
Essentially, all private to public key computation is that: taking 'G' and adding it to itself, with your private key.
[285]
That's the number you generated randomly.
[289]
When you do that, you still end up with some X,Y coordinate on the curve.
[297]
Every time you add the points, you [end up somewhere on the curve] and that point is your public key.
[308]
You know that point, [but] you simply have no idea how you got there.
[315]
"Do all private keys start with the number 5?" No, Bill.
[322]
Private keys encoded with wallet import format (WIF) start with the number 5.
[329]
But those that correspond to compressed public keys can start with the letter 'K' or 'L.'
[339]
You will see private keys for wallet import format [that start with a 5].
[344]
When they're 'with compressed,' as it's called, they start with a 'K' or 'L' instead of a 5.
[352]
"How do you ensure the private key is transmitted securely and privately into the blockchain?"
[358]
This is also a point of confusion. The private key is never transmitted anywhere [on the blockchain]."
[367]
What you transmit is a signature, which is a number produced from the private key...
[372]
by a special equation that anyone can check.
[375]
By checking that against your public key, they can confirm you know what the private key is,
[381]
but they don't know / cannot know what the private key is.
[385]
That little trick ensures that you can sign as many times as you want, transmit as many signatures [as you want],
[397]
and people will only be able to verify that you know the private key, but nobody else does.
[402]
"Please explain key collision. Also, please give an example of encryption collision."
[408]
'Collision' as a word is mostly used for hashes.
[412]
Perhaps what you're asking is related to the very next question.
[417]
Jason asks, "Is it possible to generate a private key that is already being used?" Yes Jason, it is possible.
[427]
It is absolutely improbable, however.
[432]
Even if you were trying to do this deliberately, by generating a trillion new private keys every second,
[440]
and then recruited a billion people to generate a trillion keys each, all you would do is touch the very surface...
[450]
of the absolutely enormous number [of possible] private keys that [could] exist.
[455]
This is something that a lot of people have difficulty wrapping their heads around;
[459]
the idea that the [number of possible private keys] is so large that you will never ever get through them.
[468]
The number of possible private keys is 2 ^ 256. It's not quite, but for rounding purposes it's 2 ^ 256.
[481]
The main idea doesn't change, no matter how much you round this.
[487]
2 ^ 256 is equivalent in decimal to 10 ^ 77. That's 10 with 77 zeros after it.
[499]
Let's say you could generate a billion keys per second. How much is a billion keys? That is 10 ^ 9.
[515]
What you're doing now is taking 10 ^ 77 and dividing it by 10 ^ 9, which is a billion keys.
[525]
What you're left with is 10 ^ 68. You cut that number from 10 ^ 77 down to 10 ^ 68.
[536]
That's 10 with 68 zeroes [after it].
[539]
That's how many [possible keys you may still have to generate]...
[542]
to [find] a private key that matches somebody else's.
[549]
Let's say you take a billion people and they all try a billion keys per second.
[554]
Instead of 10 ^ 68, it will now be 10 ^ 59.
[561]
It may seem like you're making progress, but not really.
[566]
Because a billion seconds would mean that you would be no closer.
[574]
You would be down to 10 ^ 50 with a billion people trying a billion keys.
[583]
I'm using very big, big numbers here.
[587]
Let's say that you were able to do all of that for a year, and then you decided to do it for a billion years.
[599]
As you can see, if we take off nine more digits from the end of this [exponent], it doesn't get much smaller.
[607]
You're still looking at numbers that are unfathomably large.
[611]
At this rate, the amount of time it would take you to run through all private key combinations...
[617]
exceeds the total time of the universe's existence.
[621]
Which, depending on whether you apply science or not, is either 13.4 billion years or 6,000 years.
[630]
"If transactions are public, why can't someone launch a brute-force [attack] and guess the private key,"
[634]
"knowing the fact that we have quantum computers available now?"
[638]
I already gave you the answer as to why you can't guess the private key by trying [to generate] all possible keys.
[646]
You will run out of time. The sun will extinguish, its nuclear fusion reactions will end.
[653]
The universe will expand into nothingness. Civilizations will come and go.
[658]
And you will still be trying to [guess] private keys. That's the scale of numbers we're talking about.
[665]
But what about quantum computers? Does that change the equation? Yes, it does.
[670]
With a quantum computer, you could actually work out all possible combinations of a 256-bit number instantly,
[679]
as long as you had a quantum computer [with sufficient qubits].
[683]
If you follow news about quantum computing, you know we currently have 5 to 10 qubits.
[696]
The progress of adding each additional qubit is actually slowing down.
[703]
To quote Peter Todd and one of his memorable memes that I really like:
[708]
"Quantum computing may be the one area of science that scales worse than blockchains."
[714]
Quantum computers are not getting to 256 qubits anytime soon. In fact, you would only need 128 qubits...
[723]
to break [the elliptic curve function in Bitcoin], but we are very far from there.
[729]
What happens when quantum computers become available? We have to change cryptographic algorithms.
[736]
There are algorithms that are better in terms of protecting against quantum computing [attacks].
[743]
We don't need to use those algorithms [yet] because there are not quantum computers with enough qubits
[751]
to be able to crack Bitcoin's private keys.
[755]
The next question comes from Sesame Meow:
[759]
"Quantum attacks on Bitcoin and how to protect against them."
[764]
"I just listened to an Epicenter podcast about quantum threats to Bitcoin. Here is their paper."
[771]
"From what I understand, quantum computing effects would start to kick in, at the earliest, during 2027."
[777]
"Attacks on proof-of-work are straightforward to address, but attacks on ECDSA...
[781]
for [unconfirmed] transactions are a credible threat."
[784]
"I'm aware of the argument that if the ECDSA is broken, we are worried about a lot of other things."
[788]
"Focusing on Bitcoin: how easily can Bitcoin incorporate quantum-safe public key signature schemes?"
[795]
"Does it require a complete overhaul of the code, a hard fork, or a soft fork? What?"
[802]
Sesame Meow, do not fret! Yes, it's it's true that quantum effects could limit the lifetime of the ECDSA.
[814]
All cryptographic algorithms have a limited lifetime. The good news is that ECDSA can easily be replaced.
[823]
It can be replaced with a very simple soft fork.
[827]
One of the important innovations that came with the introduction of Segregated Witness,
[835]
was the ability to have a script version number that allows soft fork upgrades
[842]
to the scripting language within Bitcoin.
[845]
This was introduced and activated on August 1st 2017. It means other signature schemes can be introduced,
[855]
by a simple soft fork.
[856]
The first of such schemes [will be] Schnorr signatures, [acting] in conjunction with or in addition to ECDSA.
[869]
A lot of this isn't about replacing ECDSA, but rather about adding more signature algorithms so that...
[878]
people can choose which signature algorithms they want to use and effectively migrate their funds...
[885]
to more secure signature algorithms.
[887]
Schnorr signatures, which are about to be introduced, have been in testing and development for quite a while.
[894]
They are one of the soft fork upgrades that can be done
[899]
with the script versioning capability and Segregated Witness.
[903]
But they're not the only one. Bitcoin could introduce quantum-safe signature schemes with a soft fork,
[911]
just by using the script versioning.
[913]
It's actually a very simple soft fork. It's completely optional. It's not mandatory.
[920]
It's opt-in. People can choose to use it, if they want to. If they don't, they can continue to what they used before,
[927]
which may be ECDSA or something else.
[930]
It can be introduced incrementally so that different parts of the system upgrade and [add] support slowly,
[939]
just like we've seen with the new bech32 address format for SegWit.
[945]
Some wallets support it, some don't. Gradually, the ecosystem is evolving.
[951]
Quantum attacks on Bitcoin? Not as scary as you might think. 2027 is a very long way away.
[965]
Within the next decade, the number of [security] improvements that could be made to introduce...
[970]
quantum-safe digital signatures in Bitcoin, and the ease by which these could be done,
[975]
really [makes it] not a problem.
[980]
Let's see what other bogeymen and scary thoughts we can banish with all of these questions,
[989]
which are showing a high level of anxiety in the Bitcoin space.
[995]
Before we continue to the next question, remember:
[999]
when engaging in cryptocurrencies, it is important every now and then to take a deep breath.
[1010]
Realize that there are many things in life that are more important, and the end is not near.
[1017]
The apocalypse is not coming, Bitcoin is not dead or dying.
[1023]
It is going to be okay. The roller-coaster is part of the show. Don't worry too much about all of these things.
[1033]
A lot of the articles and academic papers you read have come out with a sensationalist [title] and they say:
[1040]
"We've discovered a fatal flaw that will be the end of Bitcoin!"
[1045]
They mostly address academic edge cases that are very hard to apply and fairly easy to mitigate.
[1053]
But that's not what they're going to tell you in the sensationalist headline.
[1058]
They're not going to write a headline that says:
[1061]
"Edge case discovered; will have minimal impact and be easily mitigated, but we wrote a great paper about it!"
[1069]
No. They're going to say: "Doom! Gloom! Bitcoin's dead!"
[1073]
Don't believe it.