16 July 2015 - Filed under Decentralization
A few weeks ago, a phantom of a wallet service claimed to be organizing a stress test on the Bitcoin network by spending 20 BTC in fees over 30 hours. What they did was shine a spotlight on an often overlooked feature of Bitcoin.
Stress testing is a term Bitcoin has recently borrowed from the legacy banking sector where it refers to solvency and liquidity testing. If a bank goes under, is there a domino effect causing other organizations to fail or can the system withstand it? In Bitcoin, the stress test has been introduced in the context of the block size limit debate as a coordinated effort to publish more transactions to the Bitcoin p2p network than can be included in the block chain within a certain period of time. The results of such a test should inform us as to how various wallets and services handle a shift from excess capacity in blocks to a time when demand is high enough that every block is full and fees determine speed of confirmation. Stress testing also tests how different services manage their local versions of the set of unconfirmed transactions, known in Bitcoin Core as a mempool.
This post is about exploring fees in depth. What are they? Why are they part of the protocol? How will they look in a future where Bitcoin is either a settlement network or handles tons of smaller transactions?
Despite our tendency to think of bitcoins as coins or individual units of digital currency, the protocol does not handle such units individually. Instead transactions have outputs, each of which sends some amount of bitcoin (0.00000001 or more) to a new destination. Most transactions consume a number of previously created outputs and produce a number of new outputs with both inputs and outputs carrying a quantity of bitcoin. Outputs of a transaction may not have more bitcoin in total than the transaction’s inputs, but they can have less. In that case the excess bitcoin that is not claimed by the outputs is left as a fee that goes to the miner.
As an example, suppose I want to send 0.5 bitcoin to you to pay for a pizza party. I scan your qr code and my wallet then looks for outputs it can spend. It finds an output that I previously received for 1 btc. I have also set in my wallet to pay 0.0001 btc as a fee. The wallet then builds a transaction that sends 0.5 btc to your address, 0.4999 btc to a new address of mine. Since these add up to 0.0001 btc less than the 1 btc output that was consumed, the 0.0001 btc becomes the fee. When a miner includes my transaction and finds a block they are permitted by the Bitcoin protocol to add what used to be my 0.0001 btc to their mining reward. Instead of collecting
25 btc for finding the block, they collect 25 btc + my 0.0001 btc + any fees in other transactions in the block. That is how fees work on a basic level; leftovers are set aside and go to miners.
Why have fees?
Early drafts of the bitcoin software and the protocol it embodied did not have fees but had a significant long-term problem. When the block rewards taper down from 50 btc to 25 btc to 12.5 and so on, the security of the bitcoin network would tend to zero. In an economically efficient world, the system Satoshi imagined, responsible for up to trillions of dollars worth of value would see its miners turn off their machines and leave the system open to attack by nearly anyone.
To prevent this from happening, fees were added to transition from security funded by block rewards to one where active users of the system would compete for block chain space and pay over and above basic operating costs to pay for security of the network (hashes) in the process.
How will fees secure the network?
With the block size limit as it is, we are seeing periods such as in the stress test, where every block is as full as limits allow for hours on end. For the first time in Bitcoin’s history, we are seeing transactional scarcity as varying demand meets fixed supply.
A supply of 1,000,000 bytes worth of transactions every 10 minutes vs. variable demand means a fee market will emerge. In this market a minimum fee per kilobyte will be required to have one’s transaction confirmed. Anything above that gets confirmed in the next block while anything below must wait until competition is not so fierce or risk the transaction simply never being confirmed.
At this time and outside miner’s general desire to maximize profit, mechanisms to enable such a fee market are somewhere between non-existent and rudimentary. There is almost no way to easily view the distribution of fees among unconfirmed transactions. There are few estimates of the fee rate required vs. desired confirmation speed. It’s easy to include too low a fee and hard to increase the
fee to get closer to the front of the line. Thankfully compared to many challenges Bitcoin faces, implementing the machinery for a working fee market is fairly straightforward and mainly requires some basic statistics coupled with virtual knobs and dials.
Once in place, fees will respond to increased demand by rising to a dynamic equilibrium where the cost of fees meets the utility of sending native Bitcoin transactions. There are two basic scenarios to consider once the machinery of the fee market matures.
If the fee market matures and fees remain low (< 4% of a premium cup of coffee) this would be a sign that Bitcoin is providing little utility over other kinds of payments and only for a small population of users. Some transactions would pay no fee at all. Alternatives such as off-chain solutions or legacy payment systems provide most of the services that people want. It also would mean that the store-of-value use case for Bitcoin remained largely untapped, for fully uncensored economic activity requires recording transfers directly in the Bitcoin block chain.
If instead, we see fees begin to rise, certain use cases such as the instant low-value purchase will quickly become priced out. Merchants may still prefer the case where the customer pays the fee instead of the merchant but it is likely that trust relationships between off-chain payment processors would start to handle these low value transactions with the benefit that secure instant settlement would become possible. These payment processors would implement irreversible payments to remain compatible with Bitcoin but could offer escrow and fraud protection services for a fee when required.
What new services might a fee market require?
In the process of writing this, I realized that there was no good way to view the distribution of unconfirmed transactions versus their fees. I took that as an opportunity to hack together a simple script to generate such a view. Coding that script (running on http://bitcoinexchangerate.org/fees) helped me realize that fees have been something on the back burner. They haven’t been displayed
well by any block explorers (fee/kb?). There are no sites to help you estimate fees with charts and graphs in the way you can view exchange markets. There are also no ways to hedge against rising Bitcoin fees. All of these are coming and will be used by us Bitcoiners to start. As time passes and a high value for Bitcoin becomes realized, more high-net-worth and financial professionals should start using them.
Wallets will improve in fee estimation and a variety of strategies will be employed to minimize both fees and confirmation time. In the past few weeks, I’ve seen a smoothing out of the fee curve as the fee market has become more aware of the importance of fees.
Bitcoin fees might have been an afterthought but are now an important part of the Bitcoin system. For the first time, we are starting to care about fees, which is sparking a new area of activity in Bitcoin. Like bitcoin, the fee market is new and developing quickly and it is advisable to consider how fee rates might affect your plans going forward.
2015-07-16 » David Sterry