Sunday, March 3, 2019
Buying and Selling Bitcoins
You can buy bitcoins from anyone who has them. Likewise you can sell bitcoins to anyone who wants them. Fortunately, there are various places where you are likely to find a group of people willing to trade at competitive prices - exchanges. Just like stock exchanges, Bitcoin or cryptocurrency exchanges are places (usually websites) that attract traders. However, you don’t buy bitcoins from the exchange itself. Just like a stock exchange, where you buy shares from another user of the exchange rather than from the exchange itself, a cryptocurrency exchange is the website that allows people to buy and sell between themselves. The exchange itself is just the location that brings together buyers and sellers, and people go there because they know they are likely to get the best prices there.
In financial services jargon, the exchange is an order matching engine. It matches buyers and sellers. It also acts as the central clearing counterparty. All matched trades appear to be against the exchange rather than between the customers directly, providing anonymity for customers. Finally, the exchange is the cash and asset custodian. It controls customers’ fiat money in its bank account and cryptocurrencies in its wallet.
Exchanges are based in different countries and support different fiat currencies and different cryptocurrencies. They all work roughly the same way using the same four steps: create account, deposit, trade, withdraw. To use an exchange, just like a bank, you need to open an account.
Exchanges are coming under increasing regulatory scrutiny due to the fact that they process large amounts of money. The top cryptocurrency exchanges match billions of dollars of buys and sells per day. Most legitimate exchanges follow a similar account opening procedure to banks, where new customers submit details and evidence of their identity, for example passport and utility bills. The documentation needed may become more onerous in proportion to the value of fiat or
cryptocurrencies you plan to transact, in a progressive risk-based approach. Exchanges are now big business and take these processes seriously. Once the exchange is satisfied, your account is created. Then you can log in and the next step is to deposit.
Before you can attempt to buy or sell anything on an exchange, you need to fund your account. This is like funding an account with a traditional broker before being allowed to buy traditional financial assets. Exchanges have bank accounts and cryptocurrency wallets. In order to fund your account you click on ‘Deposit’, then follow the instructions. If you are funding your account with fiat currency (presumably in order to buy cryptocurrency), then the exchange will display a bank account for you to make a fiat currency transfer to. If you are funding your account with cryptocurrency, (presumably to sell for fiat currency or trade for a different cryptocurrency) then the exchange will display a cryptocurrency address for you to make a cryptocurrency transfer to. Once exchange has detected the transfer to their bank account or cryptocurrency address, the balance will be reflected in your ‘account balance’ on the exchange’s website, and you are ready to trade.
Wednesday, February 27, 2019
Software Wallets & Hardware Wallets
You may hear that bitcoins are stored in wallets. If this were true, then if you copied your wallet you’d own double the number of bitcoins. Clearly you couldn’t have digital money that works this way. So no, bitcoins are not stored in wallets. So where are bitcoins stored? Ownership of bitcoins is recorded on Bitcoin’s blockchain, which is, as we have seen, the database replicated on over 10,000 computers around the world containing every Bitcoin transaction ever. So you can look at that database and see that at this time, a specific address has a specific number of bitcoins associated with it. Bitcoin’s blockchain doesn’t store balances of accounts (it is not a list of account numbers and corresponding BTC balances), it stores transactions. So to get the current balance of any account, you need to look at all the inbound and outbound transactions through that account. Bitcoin wallets store private keys (not bitcoins) and their software makes it easy for the user of the wallet to see how many coins they control and to make payments. If you cloned your wallet, you would be cloning your private keys, not doubling your bitcoins.
Bitcoin wallets are apps that can: create new Bitcoin addresses and store the corresponding private keys; display your addresses to someone who wants to send you a payment; display how many bitcoins are in your addresses; make Bitcoin payments.Creating new Bitcoin addresses is an offline operation and involves creating a public and private key pair.
When someone wants to send you bitcoins, you need to tell them your address - like telling someone your bank account number so they can send you money. There are a few ways to do this. One popular way is by showing it as a QR code. QR codes are not magic. They are just text, encoded in a visual way that makes it easy for QR code scanners to read the code and convert it back into text. Another way is just to copy and paste the address itself.
The wallet needs to access an up to date version of the blockchain in order to be aware of all the transactions going in and out of the addresses it is keeping tabs on. The wallet, software can do this by either storing the entire blockchain and keeping it up to date (this is called a full node wallet) or by connecting to a node elsewhere which does the heavy lifting (this is called a lightweight wallet). A full node wallet would contain over a hundred gigabytes of data and would need to be constantly connected over the internet to other Bitcoin nodes. So in many cases, especially on mobile phones, this is not practical so the wallet software is lightweight and connects to a server which hosts the blockchain.
As well as reading the account balances, the wallet needs to be able to make payments. To make a Bitcoin payment, the wallet generates a bundle of data called a ‘transaction,’ which includes references to the coins that are going to be spent (transaction inputs consisting of unspent outputs of previous transactions), and which accounts the coins will be sent to (new outputs). This transaction is then digitally signed using the relevant private keys of the addresses holding the coins. Once signed, the transaction is sent to neighboring nodes, via its server node if it is a lightweight wallet, or directly to other peers if it is a full node wallet. The transactions eventually find their way to miners who add them to blocks.
Good wallet software has more functionality, including the ability to back up private keys (encrypted with a passphrase) either to a user’s hard drive or to a cloud storage server somewhere, to generate one-time use addresses for privacy, to hold addresses and private keys for multiple cryptocurrencies. Some are even integrated with exchanges to allow users to convert between one cryptocurrency and another directly from within the wallet software. Often wallets will allow you to split keys or set up addresses that require multiple digital signatures to spend from.
Sometimes Bitcoin wallets can have a hardware component. Private keys are stored in chips on small handheld devices. Two popular hardware wallets are called ‘Trezor’ and ‘Ledger Nano’, but there are others. These devices are specifically designed to store private keys securely and only respond to certain pre-programmed requests, for example, ‘Please sign this transaction’, and not, ‘Show me the private key you are storing’. Because the private key is stored on hardware that is not connected to the internet and can communicate with the outside world only via a limited set of pre-programmed interfaces, it is much harder for a hacker to gain access to the private keys.
The user interface software is run on an online machine. When it comes to the critical part of the transaction (the signing), the unsigned transaction is sent to the hardware wallet, which returns the signed transaction without revealing the private key. Hardware wallets are more secure than
software-only wallets, but nothing is infallible.
The phrase ‘keeping coins in cold storage’ was popular in 2013-17 before hardware wallets became widely available. Remember, you don’t store bitcoins, you store private keys. ‘Cold storage’ is keeping a note of those private keys on offline media, such as a piece of paper or a computer not connected to the internet. There are many ways of storing them. You can memorise keys if you have a good memory, you can print them out on bits of paper, you can even engrave them on a ring that you wear. You could store them on an offline computer which, for increased security, should not have a modem or network card. You could write them down and put them in a bank’s locked deposit box. These are all methods of storing your private keys offline.
If you do keep private keys on a device or printed out, you wouldn’t want someone else to be able to see it and use it to steal your bitcoins. So one way of increasing security is to first encrypt the private key with a passphrase that you can remember and then store or print out the encrypted result. Passphrases are a lot easier to remember than private keys. This means that even if someone gets hold of the device or print out, they’d need to decrypt it with your passphrase before the private key is revealed. You can split keys or use multi-sig addresses for further security. This means if one part is found by a thief, it is useless without another part, and also means if one part is lost, the other two will still work. Remember, you are trying to simultaneously guard against two things: loss of keys and theft of keys.
A hot wallet is a wallet that can sign and broadcast transactions without manual intervention. Exchanges, who control many bitcoins need to manage lots of Bitcoin payments, as we will see later. They often have a ‘hot wallet’ that controls a small proportion of their total bitcoins. Customers of exchanges like to withdraw bitcoins from the exchanges by clicking a button, causing an automated process to run to make and sign a Bitcoin transaction moving bitcoins from the exchange’s hot wallet to the user’s personal wallet. This means that somewhere, a private key belonging to the exchange must be stored on a ‘hot’ machine connected to the internet. There is a trade-off between security and convenience. Online machines are easier to hack than offline machines, but can automate the process of creating and broadcasting Bitcoin transactions. Due to this trade-off, exchanges keep only a small fraction of BTC in hot wallets, enough to satisfy customer demand, similar to banks that keep a small amount of cash in tellers’ tills at branches.
Bitcoin’s Price
Like gold or oil or any other asset, bitcoins have a value that can be priced in USD or any other currency. This means there are people who are willing to exchange BTC with USD, usually using cryptocurrency exchanges, marketplaces which attract buyers and sellers. On exchanges you can see indications of supply and demand for cryptocurrencies at any price level (more on these later). You can also buy and sell bitcoins with anyone in the world, physically on the streets or over the internet, or using brokers who mediate between buyers and sellers, or who trade on their own behalf. To trade BTC, you simply need the ability to send or receive BTC and the ability to receive or send the other asset, usually a local currency.
Like any other market-traded asset, the price of Bitcoin fluctuates with supply and demand. At any point in time, people trade at prices that they are comfortable buying or selling at. If there is more buying pressure and people want to buy more bitcoins, prices will increase. If there is selling pressure and people want to sell more bitcoins for fiat currencies, then the price at which the bitcoins change hands will drop. Later we will go into more detail about how cryptocurrencies and tokens can be priced, but here we will look at specifically Bitcoin’s price. Bitcoin’s price has been a wild ride. A recent price rise to almost $20,000 USD per Bitcoin and subsequent fall the $4,000 levels has caught the media’s attention. But this is not the first time Bitcoin has been this volatile. Bitcoin appears to be cyclically volatile, with each cycle as dizzy as the previous.
Subscribe to:
Posts (Atom)