Bitcoin Wallets Part I - How do your Private & Public Keys work?

Have you ever wondered how your Bitcoin wallet works? And what the heck you need a key for?

Well, think of a wallet as a place which stores your keys to your cryptocurrencies securely, behind a layer of sophisticated math.

“A wallet is simply a collection of addresses and the keys that unlock the funds within.” - Andreas Antonopoulos, author of Mastering Bitcoin.

Understanding How Bitcoin Wallets Work

Your wallet’s address is a unique and public identifier which represents you on the blockchain. But it’s also important to note that your wallet provider can generate as many addresses as you need, as they can all be for a one-off or “single use”.

You can essentially have a different address used for each individual transaction. This helps protect your privacy and security. We’ll be talking more about this in a following Part II blog post.

When you create your very first wallet you also generate a pair of two “keys”, your Private Key and your Public Key, which are mathematically bound to each other for life.

This looks like two separate strings of alphanumeric characters that are created together and linked mathematically*.

Public Key

Your Public Key is actually the original, longer version of your wallet address/es.

Every Bitcoin wallet address you have has been “hashed”, or made into a shortened version of your Public Key.

This is done by using various hash functions, or special encrypting formulas**, to “simplify” it.

In this way, your Public Key acts like an email address, and your Bitcoin wallet address functions similarly to to a temporary username.

Your Public Key also acts as your ID, a sort of personal seal or stamp that the blockchain network verifies when processing any transactions you’re involved in.

Private Key

The Private Key is what “unlocks” your wallet. It is a secret code you enter each time you want to send coins, and can be “stored” as a file on hardware wallets. Remember to keep it very safe in a place only you know about.

The Private Key also digitally “signs” all your transactions, authorising them, like when signing a cheque.

How Public & Private Keys Work Together

Your Public Key is computed from your Private Key.

The Private Key is essentially put through a mathematical, cryptographic blender***, and the result is a shortened but entirely different and heavily encrypted Public Key which is extremely difficult to crack.

Here’s a simple infographic:


It’s almost impossible to figure out what the Private Key is just from knowing a Public Key; they call this asymmetric encryption, a one-way formula that takes all these letters and numbers, and turns them into another bunch of letters and numbers.

The More You Know

So in summary, your Bitcoin wallet address is like a username, your Public Key is the connected email address account, and your Private Key is the password.

Next time you send bitcoins, you’ll know about the wonderful and complex cryptography going on behind each transaction.

* Using the Elliptic Curve Digital Signature Algorithm (ECDSA)
** SHA256 | RIPEMD160 | Base58 hash functions
*** The SHA-256 cryptographic hash function