Developer Aspirations

YAPB - Yet Another Programming Blog

Tuesday

30

April 2013

Thoughts On Bitcoin

by Colin Miller, on Bitcoin, Cryptography, Currency, Economics

Lately I've been annoying a fair portion of my friends by talking about Bitcoin. I was actually fairly late into the game on even knowing about the existence of Bitcoin as I only was introduced to it around mid-April. However, I dove into the technical and community aspects of it pretty heavily because I thought the technology and techniques behind the currency were quite cleaver. No, I haven't spent any "real" money on Bitcoins, but I have done some mining to try out the system. It's been running through my head a lot and I wanted to express some of my current conclusions about the currency along with some ponderings of possibilities down the road. This is lengthy and talks almost exclusively about cryptography, technology, and economics; so if these things bore you, this probably isn't going to be a good read.

As any article or blog post on Bitcoins will start out, a description of what it actually is will need to be made. I know that many people have already been exposed to it and this will mostly be a rehash, but it's still new enough that a large portion of the population is in ignorance of the system. For a layman's overview, the following video that the Bitcoin team released is a good introduction:

A more detailed graphic description of how a transaction works that I really like is here:

How a Bitcoin transaction works in a fairly understandable infographic. (Who doesn't love infographics?)

And for people to lazy to watch a short video or look at an infographic, here's a quick textual description of the system (I'll be going more in-depth into this further on).

  • Bitcoin is a virtual cryptocurrency that is meant to act as a replacement for government issued fiat by having the traits of being (semi)-anonymous, have low to no transaction fees, be (mostly) instantaneous, peer-to-peer, and supply (for the most part) irreversible transactions.
  • Bitcoins you have are "contained" in something called a Wallet. In reality the Wallet is a pair of public/private keys that are part of a transaction chain that let the public network know where each bitcoin current resides.
  • All transactions are contained in a public ledger called the "Blockchain" which is verified by all nodes. All people on the Bitcoin network act as a node and verify the blockchain independently.
  • Coins are associated publicly in the blockchain by the public key. When someone sends you bitcoins, they send it to your public key and the coins are then associated with the wallet with that public key.
  • To make a transaction (send bitcoins), you need to encrypt the transaction with your private key which can be verified by nodes on the network using your public key. Since only the private key can make a valid transaction, and only you have the private key, only you can transmit your bitcoins to another public address.
  • Transactions are verified and added to the blockchain by a set of individuals called Miners.
  • Miners use the hash of the previous block on the blockchain, along with a hash of all of the transactions, and a nonce (random number) to generate a new "block" - basically a record in the public ledger - to the blockchain.
  • In order to prevent attacks, blocks are valid only if they meet a certain difficulty criteria. The criteria is based on a numerical representation of the new block's hash. If it is below a certain threshold, the block is valid and nodes on the network will accept it as such.
  • Miners who "mine" the current block are allocated a certain number of new Bitcoins that they can associate with any account (usually their own). They are also entitled to any transaction fees.
  • Transactions are verified at a rate of a new block every ~10 min.

That's a very rough description though. I'd like to dive more into the aspects of that description for some specifics. Specifically I'd like to talk about the technology that is behind Bitcoin and the network for transactions that it provides. I'm going to focus heavily on how the mining aspect helps not only protect the network, but also how it plays several other important roles in the Bitcoin ecosystem. I'm then going to get into the benefits that Bitcoins have over other forms of currency that currently exist. Finally, I'm going to talk about some of the disadvantages of Bitcoin, especially in relation to it's tendency to experience rapid deflation and finish it with some brief thoughts about the future.

Technology

Bitcoin as a technology is really rather brilliant. As an early attempt as a public digital currency, it does a lot of things right and in very clever ways. It starts with the adaptation of already existing open sourced and well publicized cryptography libraries that are well known in the security world. It then extends into using a decentralized network to remove a central authority over the currency - I'll explain why this is a Good Thing™. It also does a fairly good job at making transactions irreversible to avoid double-spending, though it's not perfect. Finally, the construct of mining serves several unique purposes in a fairly useful package.

To start, the technology behind Bitcoin isn't really very new. Many aspects of it already existed, it was just brought together when Bitcoin was built. I would argue that Bitcoin does a very good job at embracing the standards of code-reuse and the nature of open sourced software. Wallet data is kept using public/private keys via ECDSA. Transactions can be verified using the transaction signature and public key, but only someone with the private key can create a valid signature. Transactions are added to the network using what seems to be a bittorrent-like p2p protocol which distributes transactions through the network. After a transaction has been broadcast, it gets added to a block which is heavily reliant upon SHA-256. Once the new block is created, nodes verify each transaction using the signatures along with verifying the block's hash by rerunning the has against the block. Individually, none of these technologies is all that new or novel. It's the application together that makes them interesting.

One difference that Bitcoin has over most other attempts at a digital currency is its decentralized nature. Transactions in the system need to be broadcast publicly, and nodes verify the blockchain independently. This is a very good thing for a currency for a few reasons. The first is that no central authority really has control of the currency itself. If there were a central authority, that authority could be targeted for attack or become evil by changing protocols on everyone. By making the system network based, the system becomes more trustworthy by adding in a notion of mutual-distrust.

Mutual-distrust is a good thing as far as a currency protocol is concerned because it means that each node can safely distrust any single other node. Only by reaching a consensus among the majority of nodes is any activity accepted. In a centralized system, nodes are forced to trust a central authority would could become compromised. In a distributed system, if a node becomes compromised, other nodes will check the work of said node and note that it deviates from the majority and simply ignore it, building to greater confidence in the state of the blockchain. This also means that the rules of the system such as coin production rate is built into the protocol and can't be changed by any central authority. In a currency controlled by a central authority such as a government or company, that entity can (and does in the case of governments), issue new currency at it's discretion. This can lead to inflation that, if left unchecked, can cause some severe economic problems. Due to the limited coin introduction rate and eventual cession of coin creation, Bitcoin may actually end up having deflation problems which I'll discuss later.

The final construct that pulls everything together is the process of mining and adding new blocks to the blockchain. This serves a variety of purposes and is really the heart of how the system works. Each transaction that's added to the network needs to be verified and added to the blockchain. The main reason is that if I have 1 BTC (Bitcoin shorthand), and I try to send 1 BTC to person A and 1 BTC to person B as two separate transactions at the same time, the network has to prevent one of those transactions from going through to avoid double spending; or spending the same bitcoin twice. Each node on the network does this by adding the transaction into a block only if the coin has not been spent yet. So the first transaction that a node receives will be added to a block, the second one will be ignored. If two different nodes see two different transactions first, then each will be added to a block and the other one ignored. The block isn't added to the blockchain though until it is mined. At that point, whoever mined a new block first will become the accepted block and that transaction will become the accepted transaction. The second transaction will be discarded as invalid and the network will conform to the blockchain with the first transaction in it. This keeps the system from creating new invalid coins and prevents someone from spending the same coin multiple times.

Mining

Mining verifies transactions that happen on the network which is a useful thing. Because it verifies transactions using a difficulty rating that is relative to the amount of processing power of the mining network, the more power being used to mine, the more secure the system becomes. Because of this, the more widely adopted Bitcoin becomes as a currency, the more difficult it will be to perform an attack on the network which is a great thing for adaptation. So mining is important to keep the system running and secure, but there's actually two more problems that mining solves at the same time.

The first problem is currency introduction. When creating a currency you have a very real problem of distributing the currency in some sort of fair manner. People are less likely going to want to use a system where the creators generate all of the currency and can make an arbitrarily large portion of it for themselves. Also, anyone who is going to use the system should have some means of gaining currency from the system. Finally, the currency should be introduced over time rather than all at once; as the influx of currency at the beginning will cause severe deflation upon adoption and a sense of being ripped off by the creators. Bitcoin solves these problems by tying currency creation - something that needs to happen for building up the currency's base - with mining - something that needs to happen to keep the system running. By slowly releasing new coins with each block mined, the currency is being added to the system by those doing useful work for the system. Since mining is an activity relying purely on computing power, anyone with a computer can contribute to mining and get a chance at earning newly created Bitcoins.

The second problem deals with transaction attacks. The network is still pretty young and prone to large scale attacks. Many of the attacks don't target making false transactions or double-spending, but instead work on overloading the system to make it unusable. For instance, a single Bitcoin can be broken down into 100 million sub-units. While this will be incredibly uesful if Bitcoin becomes heavily adopted, it also creates a vector of attack for current users where such granularity isn't necessary. Someone with 1 BTC could send out 100 million transactions to different addresses (all valid transactions), and overload the young mining system as it currently stands. Since each transaction has to be recorded in a block and added to the blockchain, the chain could quickly become incredibly large and cumbersome to deal with and compute. In addition, the network load of distributing all 100 million transactions every 10 minutes (We assume the attacker will try spending again once it's cleared), would most likely block out and hide real and valid transactions. To avoid this type of attack, Bitcoin transactions below a certain amount are suggested to attach a fee. Since miners are allowed to add whatever transactions they would like into the blockchain, this fee is an incentive to have transactions added. For transactions that are too small and do not include a fee, miners may just skip the transaction and never add it to a block. If a transaction is never added to a block, it will never arrive at the target account and become spendable. In this way the network is secured against large-scale small transaction DDOSs.

The fees actually provide another benefit. Currently the main incentive to mine blocks and add to the Blockchain; therefor verifying transactions and making the entire system work; is based on the reward of new currency when the block is mined. There's an additional reward however in the form of transaction fees. Each transaction that goes into the block that has a fee associated with it will have the fees claimed by the person who mined the block. It is expected that when massive adaptation occurs, the amount of BTC gained through fees will replace the BTCs that are currently gained through new Bitcoin creation when mining a block. Since the creation of Bitcoins created when mining a block gets cut in half every 4 years, eventually the fee system is required to take over as an incentive to mining for new blocks.

Overall, the mining system is quite clever in it's multiple purposes of verifying all transactions in the network, creating new currency, preventing network abuse, and working as an incentive program to participate in it.

Benefits of Using Bitcoin

The system is in place to create, distribute, and perform transactions with Bitcoins on a technical level. The value of the currency is of course related to the trust that people have in the currency having value. In fact, all currencies work like this. It has no intrinsic value at all other than the faith that people put into the system. Since all currencies do this it's not really an problem, but what benefits does Bitcoin give people over just using Dollars or whatever their fiat of choice is?

There's a couple of advantages of a digital currency like Bitcoin. First, easy transactions online over any distance. In our current system, we use credit cards or bank transfers to do transactions online. The problem with these is that while it's easy to spend money with them, it's more involved and expensive to accept money with them. Fees are fairly expensive and in many countries it's not easy to accept them at all. While systems like paypal exist to make it possible for everyday people to accept money online, the fees are even higher. In either event, it can take several days for transactions to clear. With physical currency I can accept a payment from someone and immediately spend it somewhere else. This is currently not the case with using the credit card system.

There is also the problem with reliability of transactions using the credit card or paypal system. People who have sold items on Ebay know that PayPal (and credit cards) can reverse any transactions using a ChargeBack. This makes transactions reversible in a way that cash payments are not. While this can be a reassurance to the buyer, it's a large liability for sellers. If the funds for something you sold is revoked after you've delivered the good or service, you can potentially be out the entire amount with often little recourse other than difficulty and usually fruitless civil court charges.

Transactions with Bitcoin are almost always irreversible. And the longer a transaction has existed, the less likely it is that an attacker could create a parallel blockchain and reverse his transaction. Transactions are also global and can exchange funds between any two parties who can access the network. This can be really useful for 3rd world countries where credit card processing or currency exchanging can be prohibitively expensive. While there are transaction fees for smaller amounts, the fees are often way below that required by other online payment systems.

Disadvantages

For all of the positive aspects of Bitcoins, there's actually a lot of negatives. Some can be fixed with some modifications to the protocol that are being worked on. Other problems are built into the system with no plans of change that may cause some very large problems.

For instance, a block is added to the chain every 10 minutes. This means that the time between me sending you money and you getting it and being able to spend it is going to be around 10 minutes. This isn't too bad for online commerce where we're shipping things or can generally just wait. But imagine going to the store and buying groceries. There's no way you could easily pay and just walk out the door like you can with money right now. You would have to basically adopt banks on top of Bitcoin to do faster processing which sort of goes around the entire point of the system.

Another major problem that may be the most difficult one to deal with and might possibly lead to Bitcoins ultimate downfall as a currency is one of stability. Currencies work as a unit of exchange because we can easily associate an amount of a currency with the value of a product. A pizza is $15. It was $15 yesterday, and it will be $15 tomorrow. It may not be $15 in 5 years (we do have ~3% inflation), but it most likely won't be $100. This is because the USD is a fairly stable and established currency.

Bitcoin, in it's infancy, does not have this stability. As it gains popularity, the demand for bitcoins increases. The rate that they come into existence however stays static. Due to this difference, around April the price in relation to USD increased dramatically. Shortly after, a problem with a new version of the protocol over the old version caused a split in the blockchain, shaking the confidence of the system and plunging the price from $230 to $50. Less than a week later it rose back to $150 and has fluctuated pretty heavily on a daily basis since. This fluctuation is mainly due to public perception of the currency.

With the rapid increase in price, people saw an opportunity to speculate against the value of Bitcoin. People bought in massively, raising the price, hoping to sell when the price is high. Some people end up selling after it gets high which causes the price to drop a little bit. People notice the price dropping and feel that maybe the price has peaked so they also sell, which drops the price more. A panic sell sets in which plunges the price. Eventually some people think that it's dropped so much that they can speculate and make money if it went back to where it was so they start to buy and the price raises again; starting the roller-coaster.

Speculation like this is similar to the price change in Gold over the last decade, only to a greater extreme. This instability makes it really difficult to use Bitcoin as a currency. If a Bitcoin was worth $15 today and you sell a pizza for 1 BTC, but tomorrow it's worth only $5 it's hard to use that coin to buy flour and cheese. However if the next day that 1 BTC is worth $100, you won't be able to sell a pizza for 1 BTC any more. People will expect it to still cost $15 worth of BTC instead.

Deflation

If the plan is to make Bitcoin a universally accepted global currency, there are some problems with deflation. People will often complain about inflation because it makes the money they have worth less over time and also causes prices to increase in the long term. Deflation however has some similar but opposite problems. Imagine you take out a loan for 100 BTC which is worth around $100 worth of purchasing power today. Rapid deflation causes the price of BTC in relation to USD to increase to $100 per BTC. Now your 100 BTC loan that gained you $100 worth of purchasing power will now cost you $10,000 to pay back. Not very fun.

On the other hand, if you paid $100 for 100 BTC and a year later the price of BTC goes up to $100 each, your $100 investment just turned into $10,000. "Awesome!" you think. "That was such a good return, if I hold onto it for another year and it goes up by another factor of 100 I'll have $1,000,000". Because of the dramatic increase of purchasing power of the currency itself over time, it's a better investment to hold onto the currency rather than use it in transactions. This causes a hoarding mentality among users in the network which decreases supply, causing the value to raise, causing more hoarding, and less transactions to take place.

The health of an economy is often defined by the amount of transactions taking place in the economy. If everyone is hoarding and no one is using coins to actually buy anything, it's usefulness as a currency drops.

Combined with deflation is the fees associated with smaller transactions. The current recommended fee is 0.005 BTC for every 500 bytes in a transaction assuming that the transaction is under 0.1 BTC. For larger transactions, it's possible to not pay a fee and still get added to a block, but it uses an aging and importance algorithm that slowly adds larger transactions over time. We'll assume that most transactions will require a fee. The current problem with the fee is that 0.0005 BTC can add up to a fairly large amount once deflation sets in.

To put it into perspective, if everyone in the US were to adopt Bitcoin as their primary currency, and assuming that all of the Bitcoins that will ever exist already existed, and assuming that none of them have been lost due to hard drive failures or lost private keys (already many have been), then the amount of Bitcoins each person could have if evenly distributed is 0.07 BTC. The mean net worth of american families in 2007 was $506k. We'll assume that the average family is 2.5 people which leaves us with 120 million households. That means each household allotment of Bitcoins is 0.175 BTC. To have everyone's net worth represented by Bitcoins then, each Bitcoin would need to be worth $2,891,428.57. If the currency were to become global, each person would only be allotted 0.003 BTC (for mean wealth). The mean net worth is $20,372.02. This would price a single Bitcoin at $6,790,673.33. Early adopters would become billionairs.

More importantly though is that the current fee for small transactions of 0.005 BTC would mean that each time you wanted to use money to buy something, you would have to pay the equivalent of $33,953 which would be above most people's net worth and therefor no longer useful as a currency. Luckily the protocol can (and needs to be) modified to reduce the transaction fees as adoption increases.

The Future

Is Bitcoin going to be the next universally accepted currency that will revolutionize our ways of doing business and democratize money in the way that only a decentralized system can? Or will it smolder and die under technological problems, rapid deflation, and low adoption rates? I don't really think it will be either. There are too many problems for Bitcoin to become universally accepted. However, it's also gained enough critical mass that it's too difficult to ignore. Already there are merchants accepting Bitcoins as payment and the market cap on the currency itself is over $1 billion. That's small for a currency, but pretty large for a business. If the growth continues and Bitcoins reach prices of $1k or more, the amount of money in the system will be large enough to support some niche businesses.

In any case, cryptocurrency is getting an interesting trial run with Bitcoin. It may not be the long-term defacto currency for the world going forward, but I imagine the lessons learned from it will be applied to future currencies and also provide direction for any governments that want to enter the digital realm.

comments powered by Disqus