In order to send or receive bitcoins, you need to use a Bitcoin “wallet“.
But unlike a wallet in the real world that actually holds your cash (and debit and credit cards), a Bitcoin wallet does NOT actually “hold” your bitcoins.
Instead, a Bitcoin wallet is a hardware device or software program that interacts with Bitcoin’s blockchain by providing the necessary information needed to create Bitcoin transactions.
One piece of information is called a “wallet address” or simply an “address”.
Bitcoin transactions can be described as the transfer of bitcoins from one address to another address.
For example, let’s say Kim wants to send some bitcoins to Kylie. Each of them will have a Bitcoin wallet which will generate an “address” for them.
Kim will provide Kylie’s Bitcoin address, and then her wallet will ask to authorize the transaction.
And voila! The bitcoins will “move” from Kim’s address to Kylie’s address and this “movement” will be recorded on Bitcoin’s blockchain.
Sounds simple but there’s a lot more going on behind the scenes.
In this lesson, we’re going to learn what exactly a crypto wallet is. I’ll be talking about a Bitcoin wallet, but all crypto wallets work in a similar fashion.
What is a Bitcoin wallet?
Bitcoin wallets are totally different from physical wallets. Instead of storing money, Bitcoin wallets store something called “ keys”.
And one of those keys known as a “private key” is what allows you to send (“move”) your bitcoins to another address.
As you start using bitcoin and other cryptocurrencies, it is important to learn how wallets work.
When dealing with crypto wallets, you will come across terms like “private key“, “public key“, “address“, and “seed phrase“.
Wallet software often attempts to shield you from the need to understand what these terms are and how they work. But a basic understanding of key concepts underlying crypto wallets can help prevent you from making mistakes that could cost you money.
Let’s learn what all this wallet lingo is all about and how they all work together.
What are a private key, a public key, and an address?
To send and receive money online, you usually need an “account number” and a “password”.
In the Bitcoin world, this is called a” public key” and a “private key“.
Bitcoin uses a “two-key system” in which the public key allows you to RECEIVE bitcoins, while the private key is needed to SEND bitcoins.
The two keys are connected to each other in mathematical terms.
The “private key” is a unique secret number that only you know.
It is used to “sign” transactions. These “digital signatures” are required in order to send bitcoin. (More on “digital signatures” in a later lesson.)
This “public key” is a crazy long number so a shortened version of the public key is used instead making it much easier to read.
This “compressed format” or shortened version of the public key is called the address.
A “Bitcoin address”, or simply “address”, is a string of 26-35 alphanumeric characters, beginning with the number 1 or 3 or “bc”.
Here’s an example of an address:
It can also be shown as a QR code:
A QR code (which stands for “Quick Response”) is a graphical representation of the address that can be read by your mobile phone’s camera.
When you want to send bitcoins to a friend, you ask your friend for their “Bitcoin address”. It can be freely shared with the public and anyone can potentially send bitcoins to them.
On the other hand, and as its name suggests, a private key should be kept private.
But if you’re curious, here’s what a private key looks like:
L5eb3xFcPHSoSytWm77UVgC6vRk4pNrhjQMQNwfootvYnzZQLXJh(Please be nice and don’t steal my bitcoins!)
Think of it as a password that gives you the ability to prove ownership and spend the bitcoins associated with your address, similar to how you would use a password to access your bank account.
You should NEVER, under any circumstances, share your private key(s) with any other person.
No one should ever see your private key because the person that knows the private key controls the funds in a wallet address. If someone steals your private key, there is no way to prove that the bitcoins are yours.
And voilà! That’s the role of the private key, the public key, and the address.
- Your public key is like your “account number”.
- Your address is a shorter version of your account number. This is the one you give out to people to send you some bitcoin.
- Your private key is like your “password” that proves ownership of the bitcoins associated with a given address.
The sender needs the recipient’s address to be able to send bitcoins to the recipient. Once the bitcoins are in the recipient’s address, he/she will then be able to spend or withdraw them with his/her private key.
Where do keys and addresses come from?
It all starts with the private key, which is just a randomly generated number:
This long number is shortened by converting it into hexadecimal format.
Hexadecimal is a numbering system where 16 possible digits are used to represent numbers.
The first ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9; represent the same value you’re used to.
The remaining six digits are represented by A, B, C, D, E, and F, which map out to values of 10, 11, 12, 13, 14, and 15.
So a single hexadecimal digit can show 16 different values instead of the normal 10.
And that is a private key… just a big random number in hexadecimal format.
A private key can be any number between 1 and 115792089237316195423570985008687907852837564279074904382605163141518161494337.
Your public key is DERIVED from your private key.
But wait a minute, the public key is uh public! It can be seen by other people.Doesn’t this mean that people will also be able to see my private key?!
While the public key is created from the private key, you can’t work in reverse and try to figure out the private key.
How come? Well, it’s complicated. Let’s just say that an algorithm, based on something called elliptic curve cryptography (ECC). prevents you from figuring out the private key even if you know the public key.
Basically, your private key is protected by some serious math.
A private key and a public key are mathematically linked. So while it’s very easy to produce a public key from a private key, it’s practically impossible to produce the private key from a public key.
A private key can be converted into a public key, but a public key can’t be converted back into a private key.
The public key is then “compressed” to make it shorter and easier to use.
So think of an address as a shorter and (slightly) easier-to-read representation of the public key.
In summary, the private key generates the public key, which in turn, is compressed and shortened to form the public address.
The relationship between private key, public key, and Bitcoin address is shown below:
But each step is irreversible.
Each step is considered a “one-way function”, which means it’s incredibly difficult for a computer to reverse each operation and figure out the data from the previous step.
How are the keys and addresses generated?
If you haven’t noticed, it all starts with the private key. And while it’s possible to try and do it yourself, private keys are usually generated by your Bitcoin wallet. It’s all done behind the scenes but it’s still good to have a high-level understanding of the process.
Here’s some artwork to help you visualize the process of generating a private/public key pair and corresponding address:
- The wallet software generates a random number.
- This random number becomes the private key.
- The wallet software will use this private key to automatically generate the public key.
- With this public key, an address will then be generated.
- Congratulations! You now have a brand new address to send and receive bitcoins!
What happens if you lose your private key?
Losing your private key is similar to losing your cash.
Once it’s gone, it’s gone!
It is IMPOSSIBLE to figure out your private key from either your public key or address.
And you need your private key to move or spend your bitcoins!
So if you lose your private key, ALL bitcoins stored on the address associated with this private key will be locked there for eternity.
In order to spend the bitcoins, you need a “digital signature” to authorize the transaction, and in order to create a digital signature, you need your private key.
So without a private key…no “digital signature”….without a “digital signature”….no transaction.
Complicated math is used to ensure that a private key is not able to be figured out from the public key, especially since the public key (displayed in the format of an “address”) can be seen by everyone on the Bitcoin network.
While this approach is very unforgiving, at least you know that nobody or no entity, like the government, can go behind your back and seize your bitcoins.
There is only one private key to access your bitcoins, and you, and only YOU, are totally responsible for it.
If you lose or forget it, you have nobody else to blame…except YOSELF.
- Public and private keys are always created in pairs.
- The public key is used to RECEIVE bitcoins.
- Due to its length, it is compressed into a format known as the address
- The address is similar to an account number of a bank account.
- The private key is what authorizes you to control funds attached to an address and initiate transactions from that address.
As you can see, “storing” bitcoins simply refers to the safekeeping of private keys.