馃攳
Blockchain 101 - Part 2 - Public / Private Keys and Signing - YouTube
Channel: unknown
[1]
Welcome back
[2]
Last time we looked at a blockchain, and how it works
[6]
particularly in the financial context
[8]
and we have these transactions that we were creating that move money from one person to another but there's a
[14]
big problem with this and that is what's to stop somebody from just adding a
[20]
Transaction that spends all of someone else's money to them
[25]
There's seems to be no
[27]
Protection here for that so what we're gonna do is we're gonna look at ways to add
[33]
transactions to a blockchain
[35]
that
[36]
Keep it. So not just anyone can create these transactions in order to do this. We need to look at
[44]
another cryptographic primitive and that is
[48]
Public private key pairs, and then we'll use that for signatures, so let's take a look at that right now
[54]
so here's a
[55]
public/private key pair
[57]
The private key here
[59]
It's just you know
[60]
It's a really really long number and any number is a private key right you could
[65]
Make this be one one is a private key
[67]
It's not a very good one lots of people have thought of the number one before
[71]
but you could you know you could pick some really really long number and it's sort of a random number and
[77]
We can use that as a private key. Now. You can see every time. I'm adding digits here its
[84]
Recomputing the public key that relates to that private key, and that's why the stuff down
[89]
Here starts changing so as the name would imply this
[94]
Private key is to be kept private only you have this private key, and you never tell it to anyone else
[101]
Okay, and just as the name implies
[105]
Public key the public key here, you just tell everyone this is something that you want everybody to know
[112]
This is something that there's no harm in letting everyone know
[117]
There is not a way to derive from this public key
[120]
What the private key is okay? So it's just a kind of a public
[126]
Version of this private key that does not reveal what the private key is
[131]
Okay, so I'm gonna hit my little ray number generator, so I get a nice really long private key
[136]
And it's not something you know where the numbers are close together where I typed
[140]
On the keyboard it's something a little bit more random looking and then the system has derived a public key
[146]
From this so this is going to be my private key, and I'm gonna use this to do signatures
[151]
So let's do that right now, so
[154]
Here's a message signature
[157]
So here is a message. I'm gonna type. You know hello on ders. That's me
[163]
and I have
[166]
My private key here six five six whatever it is is my private key only
[171]
I have that and here's the message that only I have
[174]
And I can hit sign and come up with a message signature here now this message
[182]
Signature I can pass to someone else
[185]
I'm gonna hit my little verify button I'm gonna pass this message signature to someone else to anybody else okay
[191]
now of course they don't have my private key because I keep that private nobody else can see that but I
[198]
Publicize my public key, and they know that everybody knows that this is my public key
[203]
So given this message and everybody knows my public key and given the signature that I just made
[210]
You should be able to verify this now of course if I hit verify sure enough the screen goes green
[216]
This is a valid message
[217]
And I have verified that whoever signed this message and came up with a signal
[224]
Signature had access to the private key behind this public key
[230]
Okay, and if I have kept that private key secret that must be me okay
[236]
So that's a message signature
[238]
And how you can sign something and verify it now instead of just using this freeform text box
[244]
Let's put some structure around this. I'm gonna make a transaction here instead all right. This is similar to what we saw before
[253]
the message I'm gonna say is I'm gonna send twenty dollars from this happens to be my
[261]
public key to
[264]
Somebody else's public key whoever whoever this is that I'm sending money to okay? I
[270]
Of course because I'm Simon smashes. I have my private key
[273]
I never tell anybody the private key, but I can use this private key to sign this message
[278]
Which consists of these three things up here?
[281]
And if I hit sign I get a message signature great all right now
[286]
I send this whole thing out I send out my message and my signature to to
[293]
somebody else and
[295]
They know that I'm trying to send twenty dollars from my public key to this somebody else's public key
[301]
You'll notice this little blue box around the from public key that
[307]
suggests that
[308]
You can check this signature against this public key to see whether or not the private key behind, this public key
[317]
actually sign this message
[318]
so let's hit verify sure enough it verifies so I know that the person in possession with the
[326]
Private key behind this public key must only beyonders is sending twenty dollars
[332]
To some other public key, okay, now, let's use this in the blockchain
[340]
Let's go back to the blockchain case where we were that we're looking at before now
[344]
You'll notice a couple of different things here all right first of all
[349]
There's not names here anymore right there
[352]
There are just public keys in the from and the two and you'll also notice that that I added a signature
[359]
section here, okay, so
[363]
In this case this is this
[367]
Public key sending two dollars to this public key
[371]
And here's a message signature that says that it is well
[374]
What happens if I change this to you know 25 dollars okay?
[379]
Of course it broke the block
[380]
But it also broke the signature the signature is not verified and that's why the signature is turning red so Wow?
[389]
we couldn't press the little mine button you know a miner could take this altered block and
[396]
Remind this block
[398]
They're gonna end up with something where the block is signed
[403]
which should eventually happen and
[406]
there we go and
[408]
the signature though is still
[411]
invalid because the the minor has no they don't have my
[416]
Private key, they only have my public key, so they can't come up with the right signature. Okay, so that's the way
[422]
We can make sure that
[424]
The message this transaction here was posed
[428]
By the person that had the money and only that person not just anyone else on on the Internet
[435]
So that's how public private key pair
[439]
Message signing is used to protect
[442]
transactions and make sure that they are
[445]
from the people that they
[447]
proposed that they're from
[450]
Now if you think about it it actually works really well because in order to create a new
[456]
address a new public key the only thing you have to do is go back and
[462]
Come up with a new private key a new random number. You didn't have to go to a centralized Authority to
[471]
come up with a
[474]
Public/private key pair, you know you just make up a private key
[478]
And you use it you derive the public key from it and you put that out there
[482]
And and that's how people can pay you so
[486]
That's a blockchain and again. It's it's a financial context all successful production block chains that are
[494]
Distributed use a token of some sort so they did they're all they'll have a financial
[500]
context so that's
[502]
You know how a blockchain?
[504]
Will will work I mean I have glossed over a couple of
[509]
the details
[510]
But for the most part the the overall idea here that you're looking at is is very similar to the way that
[518]
Bitcoin works
[519]
And many other cryptocurrencies as well, so that's a blockchain. I hope it's helpful to you
[525]
please leave me some notes down below and let me know what you think of this and
[530]
I hope to see you next time in the next video
Most Recent Videos:
You can go back to the homepage right here: Homepage





