Clients, Wallets & Storage in Bitcoin
Bitcoin is an open source software. Today there are thousands and thousands of users and developers but in the initial days, it was a very close-knit community of developers strictly guided by their ideology. The technology, terminology and core concepts evolved with contribution from the global community.
Earlier the developer community had a clear demarcation between a Bitcoin ‘Client’ and Bitcoin ‘Wallet’. Today these 2 terms are used interchangeably and rather now mostly everyone just uses the term Bitcoin Wallet.
I will explain it as 2 different terms
As we have already discussed, Bitcoin is a decentralized network where each terminal or node is equal in terms of hierarchy. Bitcoin is truly a peer-to-peer network. Each node runs a specialized piece of software called a Bitcoin Client. This client downloads the entire network (i.e history of all transaction blocks) at once on the node and takes care of all the communication with the Bitcoin network. The Client connects with the user’s ‘Wallet’ and updates it with incoming and outgoing funds and uses the keys generated by the ‘Wallet’ to sign the transactions. The protocol is designed in such a way that a Bitcoin client cannot enforce its own rules and all other nodes running the Bitcoin client ensure that every other node is following the rules (in short not trying to hack or corrupt the network). Bitcoin client has to continuously synchronize itself with the entire network. The different types of Bitcoin client are —
Full client : It is also called as a full node. In the early days, even a basic laptop could run a full client. Today full clients are run on specialized hardware. It takes about 2 days to sync with the entire network as part of the initial setup and consumes around 100 GB of storage.Every aspect of the protocol is taken care by the full client. There is absolutely no dependency on any third party service. A good analogy will be running a full email server where the server takes care of all communication and continuously synchronizes with the network. Some examples of Full client are bitcoind and Bitcoin core
Lightweight client: This is like running MS-Outlook on your local PC. It will download and communicate only pieces of information that matter to you. In terms of Bitcoin — it will only communicate the information about your Bitcoin addresses and keys. These clients do not download the entire history of transactions. These clients are also called as Thin clients. When the clients are accessed from a web browser they are called as web clients and when executed from a smartphone they are called as mobile clients.
A Bitcoin wallet is a piece of software used to store the private keys. It is very similar to a physical money wallet or better analogy will be a suitcase of money in the sense that they need a key to open it. Primary purposes of wallets are —
Generation and management of Bitcoin addresses. Similar to email addresses, a user can generate virtually unlimited addresses. The address is public and broadcast to the entire network. The user just has to give the public address (which is a string of 27–34 alphanumeric characters starting with 1 or 3) for transfer of funds.
Generation and management of the public and private keys associated with each address
Most Bitcoin full clients internally store a Bitcoin Wallet. This Bitcoin websitegives an excellent resource of wallet to choose from depending on your platform. The types of wallet are
Non-deterministic wallets : These are also called as Random wallets or Type-0 non-deterministic wallets and they were the most initial types of wallets used. Usage of these wallets is now no more recommended. These wallets were just a bunch of randomly generated private keys with no fixed pattern. It is difficult to manage too many keys (backup, import etc) generated by such wallets. One way to secure the funds in your wallet is to not re-use Bitcoin addresses. Preferably one address should be used for only 1 transaction. However, non-deterministic wallets creates multiple keys and hence frequent backups are needed
Type -1 Deterministic wallets : All the keys generated in this type of wallet originate from one parent ‘seed’. So now even if you lose your wallet it is very easy to restore the wallet and all the keys in it. The seed is a randomly generated number that is combined with data such as an index number. With just the seed it is now easy to import / export keys between different wallet implementations. There is still a slight disadvantage with this type of wallet. The seed is very long 512 bit number which is very difficult to remember. Hence the usage of mnemonic codes
Mnemonic Code words (Passphrase): A human-understandable string of 12 -24 English words derives a seed. From this seed you can generate the keys. Example — The 12-word mnemonic “erode random hand fine hotel amazing wish beach catalog cement flock never” generates the seed “f17d45b139fe841eb1894305620119675bd1520eeeb66e2e798ab7cb9b68190716f9a7cf31bf51a7c393b7556dec258e45f03cf89e6d7a7f5002b9b9af2933b0”. From this seed you can generate the public and private keys. It is easier to backup or remember just the mnemonic rather than the entire seed number. You can test it yourself at https://iancoleman.github.io/bip39/
HD Wallets mechanism (Source : Mastering Bitcoin eBook by Andreas Antonopoulos)
Hierarchical Deterministic (HD) wallets: Hierarchical deterministic wallets contain keys derived in a tree structure, such that a parent key can derive a sequence of children keys, each of which can derive a sequence of grandchildren keys, and so on, to an infinite depth. This is illustrated in above figure. An organization can distribute and track its expenses by giving 1 branch of keys to each department. Or else 1 branch of keys can be used for just incoming transactions etc. Now users or employees within an organization can create their own set of public keys and they wont have access to the corresponding private key. These public keys can now be used for transfer of funds.
In terms of Bitcoin storage — the terms ‘hot’ and ‘cold’ refer to online and offline storage.
Hot Storage: In the above examples — any wallet that is always connected to the internet is called as Hot Storage. It is recommended to use these wallets only for online transactions and then move the funds to an address which has no trace online.
Cold Storage: The best practice is to generate keys offline from a device that never has been connected online. The device which stores the keys of cold storage should go online only for the purpose of signing transaction. Addresses in cold storage are preferably used to store large sum of funds for longer time. Addresses in cold storage make perfect sense where they will be used only for the purpose of receiving funds.
Brain Wallet: We already saw the mechanism of using mnemonic code to generate the seed number and from that to generate the keys. All you have to do is to remember the English mnemonic code which is collection of meaningful 12–24 English words.
Trezor Bitcoin Hardware Storage: Image Source
Hardware wallet: Trezor is one of the best example of one of the most secure Bitcoin Storage. It is a USB wallet which generates keys. It generates and stores the private keys. Each transaction is signed by this PIN protected external device. In case your hardware wallet is lost or stolen, you can still restore all data from the encrypted backup. It also helps you to take a Paper wallet backup of your keys.
Bitcoin exchanges: If you have an account at a bitcoin exchange then the exchange generates an address for you. The private keys are stored by the exchange and you only have access to the public address key. It is highly recommended to use these addresses only for the trades that you would be carrying out. It should store only the funds which you need for trade. All other funds should be transferred to addresses in cold storage