Bitcoin 101

What is a Bitcoin wallet?

In short, a Bitcoin wallet is a piece of software that allows you to manage your funds. On the surface, it works much like your bank account, as it allows you to send, receive and keep track of your coins.

However, under the hood there are fundamental differences between the two, the key being that a Bitcoin wallet does not actually store any bitcoin. At all.

If that sounds confusing, don’t worry. We’ll explain everything in this article.

Who owns all the money?

Let’s take a step back and ask an apparently simple question: who owns your money? You’d be tempted to promptly answer “I do”, and you’d be right - to a certain extent. Reality, as always, is a bit more complicated than that, as we’ll get to below.

For a long time now money has moved away from the physical world and into the digital realm, so much so that estimates put  narrow money - the sum of all liquid currency in the world - at not even 8% of the circulating supply. As for the rest, it’s nothing but numbers flashing on a billion screens.

Scrooge McDuck coin diving
Gone are the days of sweet coin-diving

In this respect, electronic fiat money and bitcoin are not that different. Both only exist in the digital realm. Both exist only as long as they are accounted for in a digital ledger. Owning a unit of either one means having the authority to determine what to do with the value associated with a given entry in a particular ledger.

There are, however, two fundamental differences between the two.

1. Tangibility

The more obvious one is you can potentially redeem your digital dollars for physical cash in your bank’s local branch and store it in your wallet, or under your mattress. It then leaves the bank’s ledger and you can hold it, fold it or even set it on fire.

Burning money

We strongly advise against that

For all practical matters, that money can be physically yours, even if in reality this is more of a grey area - you may own banknotes, but then again their value is not in the paper itself, is it? Anyway, this physicality alone has huge psychological implications, and is probably one of the reasons most people feel fiat money is “safer” than digital currency.

Bitcoin, on the other hand, is a digital native. It has no physical form, and more importantly, it never leaves the ledger. In fact, a bitcoin is nothing more than the sequence of all its previous transactions, all the way back to its generating block coinbase transaction (the first transaction on each block, rewarding miners with new bitcoin). 

So, much like life, bitcoin is a journey, not a destination.

2. Control

Remote control
Not this kind

A more subtle but perhaps even more pivotal distinction is about who controls the ledger, and therefore the value “stored” in it. In the traditional fiat system, banks control the registry and changes to it can only be made if cleared by them. Even cash, a tangible thing which supposedly has a face value and can be physically possessed, is ultimately a token from an entry in an even bigger, national ledger, managed by a central bank (and thus a national government).

There are, of course, a set of governing laws in place that dictate the rules of these ledgers - how new currency is created, moved and erased. These are called monetary policy. Financial regulatory frameworks, audits, minimum reserves and compliance laws can be quite strict in the name of protecting the citizen’s money both from fraud and inflation. At the same time, they are both detached from these very citizen’s realities as to become completely abstract, and prone to be changed at the stroke of a pen by a public official who may not be concerned so much about the public interests as he is about being reelected. And the next election may turn that upside down again.

Of course, these are extreme cases and our system has safeguards in place to mitigate this risk, but when these fails us, the effects can be catastrophic. The point is, he who controls the money (and thus the ledgers), controls the nation. In this case, who controls the controllers?

Bitcoin, on the other hand, is a piece of open-source software. As a currency, it has a built-in monetary policy, with clear and transparent rules that are agreed upon by everyone that chooses to take part on the network. Every participant owns a copy of the same software and ledger, which is updated and synced with every block that’s added, and governed by the software’s rules.

Anyone who wants to try and change them is welcome to try and do so - but unless an overwhelming majority of the network agrees to run the modified version, the changes will not be implemented. As of today, these rules mean only 21 million bitcoin will ever be produced, in a pace of 12.5 new bitcoin per mined block, with this amount halving every four years. So no bureaucrat can flood the market with bitcoin to put a band-aid over his terrible debt management.

What it means to own bitcoin

All this is not to say that you will be expropriated overnight of your fiat money or that you should make a run back to gold, or even bitcoin. It’s only a way of showing that “owning” something as abstract as money is a complicated business.

Burglar steals money

Every bitcoin is an entry in a ledger shared by all its users, and hence exists simultaneously in each copy of the registry. However, these entries are not associated to a physical identity, but to a bitcoin address - a seemingly random string of 34 alphanumeric characters. To make a transaction, a user must prove that he controls that address. But how does one prove that?

By the clever use of a concept called public-key cryptography.

Public-key cryptography

Also called asymmetric cryptography, this sounds like an incredibly complex behemoth, but the fundamental idea is not that hard to grasp. Basically, one starts with a long string of alphanumeric characters, called a private key (in the case of Bitcoin, usually 64 characters long). From that string, by applying a mathematical hash function, one derives a public key - resulting in a cryptographic key pair. Pretty simple so far, right?

The math-e-magic of it is, while you can easily get to the public key by re-applying the hash function, you would need literally billions of years to arrive at the private key by using only the public one (that is, until quantum computers are a thing, but for now just bear with me).

Another interesting property is cryptographic signing. Although a public key can’t be used to deduce its private key, any transaction signed with a private key can be verified by comparing the encrypted message with its corresponding public key, so you can guarantee that the transaction was really signed by your counterpart.

That’s why hash functions are called one-way functions, and it’s the root of bitcoin’s security.

Cryptographic keys and bitcoin addresses

In the Bitcoin network, cryptographic keys are used as a way of signing and verifying transactions, but also generating Bitcoin addresses. But what is the difference between them, and how does one get to the final bitcoin address?

We’ve seen that it all starts with a private key. A hash function is then applied to it, resulting in a public key. However, that’s still not your address. After that, the public key goes through yet two hash functions, and the resulting string is compressed to its final valid format of 64 alphanumeric characters.

So a bitcoin address is the resulting compressed twice-hashed version of a public key, which in turn is the hashed result of a private key. Phew, that was simple. Here’s a not-so-detailed graphic illustrating the process:

Gradient path from private key to bitcoin address
Got it?

All of these steps are one-way, meaning that you can’t deduce the originating key from the resulting one. That is, unless you have a few trillion years to spare. You can, however, validate the origin of any message/transaction signed by the parent key by checking it against its child, using a verifying algorithm (verifying a private key from a public key, or a public key from a bitcoin address). You won’t be able to read/modify its contents, though.


Bitcoin is safe

Don't worry, bitcoin is safe

Let's illustrate how it works with a rough analogy. Keep in mind that, as with every analogy, this one serves to understand the big picture while not taking all details into account.

Think of bitcoin addresses as numbered, transparent, slitted safe deposit boxes in a public space. Everyone can see its number and how much is there inside, but not the identity of the owner. We know that's not actually a real thing, but try to imagine it is. 

Whenever you need to send or receive coins, your wallet will point you to a fresh box whose lock your key alone can unlock. You can claim as many new boxes as you want, as your wallet can generate new keys that will always fit one - and only one - given lock.

Say Alice wants to send Bob some bitcoin. Bob then has his wallet point him to a fresh locker, numbered 3QJvK3qfvL9SuYo34Yi7Af3sRhW3qSinNB. He then sends Alice his locker number.

Meanwhile, Alice's coins are in one of her lockers - 1TRf35qfv5sSu0U34Yi7Af3sRhpxkyinNB. She starts by communicating her intentions to Bob. Then, she uses the key stored in her wallet to open her locker, withdraws the money inside and then signs it (it's a bit like a cheque). Finally she proceeds to Bob's deposit box address, inserts the signed cheque through the slit, and goes back home.

Bob - and everyone else - can see the deposit immediately, since the box is transparent. He can also verify Alice's signature on the cheque to make sure it was really her who deposited it. However, before he can actually spend it, he needs to wait for a qualified deposit box inspector (a bitcoin miner, in this case) to drop by and confirm that the money is really there, and that Alice didn't tie a string to pull it back or something like that. 

The inspectors' rounds happen every ten minutes. Once the inspection clears, Bob is free to use his own key to send that money to whomever he wants, or to just leave it there.

Bitcoin wallets

So, what does all of this have to do with Bitcoin wallets?

The name wallet itself is a bit misleading, as it holds no money or bitcoin. A Bitcoin wallet is much closer to a clever password manager. Its main role is to generate and manage cryptographic key pairs, while at the same time keeping a tab on all bitcoin associated with these keys on the blockchain.

Inserting bitcoin into computer screen

You're doing it wrong


For every new bitcoin address, the wallet generates a new key pair. Private keys are kept safe and usually encrypted by a password by the wallet, while the public keys are used verify transactions. The addresses themselves are a hashed version of the public key. When you start a transfer, the wallet software usually automates the whole process by finding your funds on the blockchain, proving ownership of that value via the corresponding private key, creating the transaction by associating that bitcoin with a given bitcoin address, signing and broadcasting it.

The transaction is included in the next block to be confirmed by a miner, that validates the corresponding signatures/keys, and then added to the blockchain. The whole network then proceeds to double-check that the block contains no invalid transactions.

On the other side, the recipient’s wallet monitors the path of the transaction on the network. As soon as it is confirmed on the blockchain, the receiving wallet then updates its balance, and the new bitcoin is now spendable by the new owner - even though no actual exchange took place.

Deterministic wallets

In the beginning, all wallets generated private keys randomly, which meant that every new key pair and address was guaranteed to be different each time. If you re-installed your wallet in another computer, for example, you would get completely new keys. The only way you could restore your account was to backup all your keys every time you received or sent bitcoin. If you ever lost access to your backup keys, your funds would be lost. Also, this means that even if you imported your keys into the same wallet at another device, they would not sync - since each wallet would independently generate different keys when creating a transaction.

To address those risks, developers in the bitcoin community have come up and implemented a new method of generating keys, giving birth to deterministic wallets. With this method, instead of randomly generating new keys, a wallet would start with a known string of characters (usually a list of 12-24 words called seed words, or seed phrase). From that string, the wallet applies a hash function and an ordered sequence of numbers, resulting in a consistent sequence of keys.

The gist of it is that, from a given list of words, you will always get the same sequence of keys and addresses. From that list, you will always be able to restore your account to any compatible deterministic wallet, and also keep your wallet synced in different devices. Most Bitcoin wallets nowadays are deterministic wallets.

This was a huge leap in safekeeping users’ bitcoins, and most wallet software nowadays are deterministic. That’s why you get a warning prompting you to write down the words whenever you install a good wallet - so pay heed to it, and keep it safe!

Summary

So that’s how Bitcoin wallets work in a nutshell. Of course details are much more complex that presented here, but these are the principles behind this incredibly useful piece of software. Like your bank’s pin and password, you should keep your wallet safe and always follow security best practices. Because unlike banks, if you lose access to your keys, your funds are irretrievable. They’re gone - forever. So make sure you backup your wallet and keep copies of the seed words (if applicable) in one or more safe places.

Bitcoin wallets come in many flavours, and we cover the main types, as well as their pros and cons, in another article - so you can choose the one that’s most appropriate for you. If you are a beginner and are having trouble choosing, we also have a tutorial on our recommended wallet so you can start transacting right now.

Afterwards, you can then use your brand new wallet to deposit bitcoin to your Cloudbet account and start betting in no time!

About the Author
Thiago Earp

Thiago Earp

Content Manager

Posted on 2018-05-02

What a silly speck of carbon, it thinks it's conscious.

Related Articles

Bitcoin Glossary: a Bitcoin language guide

Bitcoin 101

Bitcoin Glossary: a Bitcoin language guide

How to choose a Bitcoin wallet

Bitcoin 101

How to choose a Bitcoin wallet

How to buy bitcoin cash: a comprehensive guide

Bitcoin 101

How to buy bitcoin cash: a comprehensive guide