How Bitcoin Wallets Work (Public & Private Key Explained) - YouTube

Channel: Simply Explained

[0]
In the past, I’ve made quite a few Simply Explained videos on how blockchains and cryptocurrencies
[4]
work.
[5]
And there are a few questions that keep coming, like: how do wallets work?
[9]
You see, to use a cryptocurrency, you need a wallet to store your virtual coins.
[14]
And just like a bank account, it has a unique address.
[17]
It looks somewhat like this, depending on the cryptocurrency.
[21]
It seems like a completely randomly generated string of letters and numbers but in reality,
[26]
there is a bit more going on.
[28]
The first thing we need to know is how these are created.
[31]
Anyone can create a new wallet by generating a public and private key pair with a certain
[35]
algorithm.
[36]
In the case of Bitcoin or Ethereum that is via an elliptical curve digital signature
[40]
algorithm.
[41]
That’s quite a mouthful, but the take away here is that the algorithm will spit out a
[46]
private key and an associated public key.
[49]
These keys are mathematically linked to each other.
[52]
You can take the private key and derive the public key from it.
[56]
But you cannot take the public key and turn into the private one.
[59]
I made a video about this right here.
[62]
Now, these two keys serve a different purpose.
[65]
The public key will become your wallet’s address, kind of like your bank account number.
[69]
And the private key is your way of proving that you are the owner of the wallet and thus
[74]
that you can spend the money inside of it.
[77]
So in summary: public keys can be shared with everyone while private keys must be kept to
[83]
yourself.
[84]
Unless you want other people to decide what to do with your money.
[87]
So far so good.
[88]
But this system has a few interesting side effects that I want to mention.
[92]
For starters, everyone can generate an unlimited amount of wallets, right on their own computers.
[97]
It’s only limited by how fast your computer can generate key pairs.
[102]
However, nobody will know about the existence of your wallet until it receives some coins.
[107]
See, a cryptocurrency only keeps track of transactions between wallets.
[112]
It does not have a list of all existing wallets.
[115]
So if your newly created wallet has not been involved in any transaction, it simply doesn’t
[121]
exist for the outside world.
[123]
Think of it this way: the blockchain is just a giant spreadsheet with transactions going
[127]
from one wallet to another.
[128]
The blockchain itself doesn’t really care about if these wallets exist or not.
[132]
It’s only when you want to spend coins in a wallet that you have to prove that you’re
[137]
the owner.
[138]
And you can only do that with the private key that is associated with the address of
[142]
the wallet.
[143]
Another side effect is that you can transfer coins to a wallet address that doesn’t exist.
[147]
Again a Blockchain doesn’t have a list of valid addresses, so it cannot check if you’re
[153]
transferring coins to a valid one.
[155]
In case you transfer coins to an invalid address then they're just lost unless someone can
[161]
generate the private key for that particular address.
[165]
Which, right now, isn’t really possible because of how the algorithm works.
[170]
Fun fact, this is referred to as “coin burning” and it’s sometimes done intentionally by
[174]
cryptocurrency projects that want to reduce the total supply and therefore increase the
[178]
value of their coin.
[179]
Or they do it to get rid of coins that weren’t distributed during the initial coin offering.
[185]
The last cool side effect I want to mention is that you can create a wallet while being
[189]
offline, you can then give that address to someone else and they will be able to transfer
[193]
coins to it.
[194]
And later when you get back online, you can use the private key of that wallet to spend
[198]
the coins.
[200]
Cool huh?
[201]
So if you want to store some coins, in the safest possible way, you can generate a wallet
[206]
while being offline, print out your public and private key, destroy the key on your computer
[212]
and transfer coins to it.
[214]
This is called a paper wallet and is the most radical but super secure way of storing coins.
[221]
So that was a quick overview of how wallets work in a cryptocurrency.
[224]
I hope you liked this video and if you did, consider subscribing, clicking the bell icon
[228]
and liking this video.
[229]
Thank you very much and see you on the next Simply Explained episode!