By now, most people have heard of Bitcoin and cryptocurrencies and know that they are digital currencies. Many people also understand that there is no central authority, such as a bank, in charge of managing this. Instead, they will have heard of the Blockchain and how it stores money in a decentralized way.
We have explored the Blockchain and how it is used to implement cryptocurrencies in a previous article. However, as we are dealing with abstract concepts, it is still difficult to fully understand what bitcoins (or other cryptocurrencies) actually are and how they are stored. And quite frankly, the names and terms engineers have come up with do not help at all. There are wallets, forks in the chains and coins that can be stored hot or cold. It’s no wonder even computer scientists get confused.
Let’s clear this up a little!
Your Bitcoins don’t exist!
Yes, you have read this correctly. In the whole Blockchain data-structure, there is no data entry that says, “Bob owns 3 Bitcoins”. Your wallet software on your computer or mobile phone and your USB hardware wallet do not store any coins.
All this is just an abstraction aimed at making your life easier. In fact, cryptocurrency wallets are not like wallets at all. The metaphor is poorly chosen. The word “keyring” would describe a cryptocurrency wallet much better.
Keys and Transactions
Wallets store are cryptographic keys that allow you to claim the output of transactions. A wallet might manage many keys, in fact, there are standards to generate keys deterministically from a passkey, for example, 12 words in the English language. Given these 12 words, you can always generate the same public and private key pair sequence. This is important, in case you lose your keys, for example through hard drive failure. It is also considered a good practice to use different keys for different purposes to increase privacy.
The wallet software can query the blockchain for funds available to the keys you own. In fact, anyone can look up the funds attributed to the keys you own, provided they know the addresses, which are derived from the public keys.
Whilst some cryptocurrencies have a notion of accounts and balances, the original, Bitcoin, and many other cryptocurrencies are based on an Unspent Transaction Outputs (UTXO) Model.
In Bitcoin, transactions from one account to another are a combination of transaction inputs and outputs. Let’s say, Alice wants to transfer 1 Bitcoin to Bob. The transaction process can be illustrated as follows:
Alice can use the outputs of previous transactions sent to her address as inputs for the new transaction. Let’s say Alice has an unspent transaction output with a value of 0.8 Bitcoin. She also has another UTXO of 0.6 Bitcoin. Alice can use these outputs as inputs for a new transaction, with two outputs: 1 Bitcoin for Bob, and 0.4 Bitcoin for herself. She has to create a transaction output to herself, in order to process the change. Any difference between inputs and outputs is attributed to the Bitcoin miner that confirms the transaction as a transaction fee.
This example shows that Bitcoins attributed to an account are only present as the sum UTXOs that can be unlocked with the correct keys. Wallets manage keys and keep track of unspent transaction outputs, in order to abstract all this complexity away from the user.
Conclusion
Cryptocurrencies are new technology. The abstractions we use to describe them do not always accurately represent what is happening under the hood. It is important for users to gain a basic understanding of how the underlying technology works, in order to keep their holdings safe. After all, removing banks and other trusted third parties is about empowering you as an end-user, which also involves accepting the responsibility for managing your money.