bitcoin

How Bitcoin Wallets Work (Public & Private Key Explained)

In the past, I’ve made quite a few Simply Explained videos on how blockchains and cryptocurrencies

work.

And there are a few questions that keep coming, like: how do wallets work?

You see, to use a cryptocurrency, you need a wallet to store your virtual coins.

And just like a bank account, it has a unique address.

It looks somewhat like this, depending on the cryptocurrency.

It seems like a completely randomly generated string of letters and numbers but in reality,

there is a bit more going on.

The first thing we need to know is how these are created.

Anyone can create a new wallet by generating a public and private key pair with a certain

algorithm.

In the case of Bitcoin or Ethereum that is via an elliptical curve digital signature

algorithm.

That’s quite a mouthful, but the take away here is that the algorithm will spit out a

private key and an associated public key.

These keys are mathematically linked to each other.

You can take the private key and derive the public key from it.

But you cannot take the public key and turn into the private one.

I made a video about this right here.

Now, these two keys serve a different purpose.

The public key will become your wallet’s address, kind of like your bank account number.

And the private key is your way of proving that you are the owner of the wallet and thus

that you can spend the money inside of it.

So in summary: public keys can be shared with everyone while private keys must be kept to

yourself.

Unless you want other people to decide what to do with your money.

So far so good.

But this system has a few interesting side effects that I want to mention.

For starters, everyone can generate an unlimited amount of wallets, right on their own computers.

It’s only limited by how fast your computer can generate key pairs.

However, nobody will know about the existence of your wallet until it receives some coins.

See, a cryptocurrency only keeps track of transactions between wallets.

It does not have a list of all existing wallets.

So if your newly created wallet has not been involved in any transaction, it simply doesn’t

exist for the outside world.

Think of it this way: the blockchain is just a giant spreadsheet with transactions going

from one wallet to another.

The blockchain itself doesn’t really care about if these wallets exist or not.

It’s only when you want to spend coins in a wallet that you have to prove that you’re

the owner.

And you can only do that with the private key that is associated with the address of

the wallet.

Another side effect is that you can transfer coins to a wallet address that doesn’t exist.

Again a Blockchain doesn’t have a list of valid addresses, so it cannot check if you’re

transferring coins to a valid one.

In case you transfer coins to an invalid address then they're just lost unless someone can

generate the private key for that particular address.

Which, right now, isn’t really possible because of how the algorithm works.

Fun fact, this is referred to as “coin burning” and it’s sometimes done intentionally by

cryptocurrency projects that want to reduce the total supply and therefore increase the

value of their coin.

Or they do it to get rid of coins that weren’t distributed during the initial coin offering.

The last cool side effect I want to mention is that you can create a wallet while being

offline, you can then give that address to someone else and they will be able to transfer

coins to it.

And later when you get back online, you can use the private key of that wallet to spend

the coins.

Cool huh?

So if you want to store some coins, in the safest possible way, you can generate a wallet

while being offline, print out your public and private key, destroy the key on your computer

and transfer coins to it.

This is called a paper wallet and is the most radical but super secure way of storing coins.

So that was a quick overview of how wallets work in a cryptocurrency.

I hope you liked this video and if you did, consider subscribing, clicking the bell icon

and liking this video.

Thank you very much and see you on the next Simply Explained episode!