by David Gerard
Attack
of the
50 Foot
Blockchain
Bitcoin, Blockchain,
Ethereum and Smart Contracts
David Gerard
Copyright © 2017 David Gerard. All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system without the written permission of the author, except where permitted by law.
A Bitcoin FAQ © 2013 Christian Wagner, used with permission. (This section is also available for reuse under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported [cc-by-nc-sa].)
“Stages in a Bubble” © 2008 Jean-Paul Rodrigue, released by the author for any reuse with attribution.
Skunk House photograph © 2016 Karen Boyd, used with permission.
Mr. Bitcoin photograph © 2014 N00ba the Hutt, used with permission.
Mining rig photograph of unknown origin; if this is yours, please get in touch.
First edition, July 2017
Book site: www.davidgerard.co.uk/blockchain
Contact the author: [email protected]
Cover art and design: Alli Kirkham www.punkpuns.com/author
Contents
A Bitcoin FAQ
Introduction
Chapter 1: What is a bitcoin?
Why Bitcoin?
What you have when you have “a bitcoin”
The blockchain
Secured by waste: Proof of Work
Chapter 2: The Bitcoin ideology
Libertarianism and cyberlibertarianism
Pre-Bitcoin anonymous payment channels
The prehistory of cryptocurrencies
The conspiracy theory economics of Bitcoin
Austrian economics
Chapter 3: The incredible promises of Bitcoin!
Decentralised! Secured by math!
Anonymous!
Instant! No fees!
No chargebacks!
Be your own bank!
Better than Visa, PayPal or Western Union!
Remittances!
Bank the unbanked!
Economic equality!
The supply is limited! The price can only go up!
But Bitcoin saved Venezuela!
When the economy collapses, Bitcoin will save you!
You can use Bitcoin to buy drugs on the Internet!
Chapter 4: Early Bitcoin: the rise to the first bubble
The tulip bulb era
The art of the steal
Pirateat40: Bitcoin Savings & Trust
Bitcoin exchanges: keep your money in a sock under someone else’s bed
The rise and fall of Mt. Gox
Drugs and the Darknet: The Silk Road
Chapter 5: How Bitcoin mining centralised
The firetrap era
Abusing your hashpower for fun and profit
Chapter 6: Who is Satoshi Nakamoto?
Searching for Satoshi
Dorian Nakamoto
Professor Dr Dr Craig Wright: Nakamoto Dundee. That’s not a signature.
Chapter 7: Spending bitcoins in 2017
Bitcoin is full: the transaction clog
Bitcoin for drugs: welcome to the darknet
Ransomware
Non-illegal goods and services
Case study: Individual Pubs
Chapter 8: Trading bitcoins in 2017: the second crypto bubble
How to get bitcoins
From the first bubble to the second
Bitfinex: the hack, the bank block and the second bubble
Chapter 9: Altcoins
Litecoin
Dogecoin
Ethereum
Buterin’s quantum quest
ICOs: magic beans and bubble machines
Chapter 10: Smart contracts, stupid humans
Dr. Strangelove, but on the blockchain
So who wants smart contracts, anyway?
Legal code is not computer code
The oracle problem: garbage in, garbage out
Immutability: make your mistakes unfixable
Immutability: the enemy of good software engineering
Ethereum smart contracts in practice
The DAO: the steadfast iron will of unstoppable code
Chapter 11: Business bafflegab, but on the Blockchain
What can Blockchain do for me?
But all these companies are using Blockchain now!
Blockchains won’t clean up your data for you
Six questions to ask your blockchain salesman
Security threat models
Permissioned blockchains
Beneficiaries of business Blockchain
Non-beneficiaries of business Blockchain
“Blockchain” products you can buy!
UK Government Office for Science: “Distributed Ledger Technology: beyond block chain”
Chapter 12: Case study: Why you can’t put the music industry on a blockchain
The rights management quagmire
Getting paid for your song
The record industry’s loss of control and the streaming apocalypse
Berklee Rethink and blockchain dreams
Imogen Heap: “Tiny Human”. Total sales: $133.20.
Why blockchains are a bad fit for music
Attempts to make sense of the hype
Other musical blockchain initiatives
SingularDTV
Summary
Conclusion
Further reading
Glossary
Acknowledgements
About the author
A Bitcoin FAQ
© Christian Wagner
http://brokenlibrarian.org/bitcoin/
Short Version
1) Should I buy Bitcoins?
No.
2) But I keep seeing all this stuff in the news about them and how
No. Tech journalism is uniformly terrible, always remember this.
3) How does this work? It doesn’t make any sense!
No, it really doesn’t. It’s impossible to accurately explain Bitcoin in anything less than mind-numbingly boring technical terms so you should probably just not worry about it. Go do something useful instead.
Introduction
Abstract: A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution.
– Satoshi Nakamoto, Bitcoin: A Peer-to-Peer Electronic Cash System, 20081
An experimental new Internet-based form of money is created that anyone can generate at home. People build frightening firetrap computers full of video cards, putting out so much heat that one operator is hospitalised with heatstroke and brain damage.
Someone known only as “Pirateat40” starts a “high yield investment program.” Just before its collapse as a Ponzi scheme, it holds 7% of all bitcoins at the time. Aggrieved investors eventually manage to convince the authorities not only that these Internet tokens are worth anything, but that they gave them to some guy on an Internet forum calling himself “Pirate” because he said he would double their money.
A young physics student starts a revolutionary new marketplace based on the nonaggression principle, immune to State coercion. He ends up ordering hits on people because they might threaten his great experiment, and is jailed for life without parole.
A legal cryptographer proposes fully automated contractual systems that run with minimal human interference, so that business and the law will work better
and be more trusted. The contracts people actually write are automated Ponzi schemes, though they later progress to unregulated penny stock offerings whose fine print literally states that you are buying nothing of any value.
The biggest crowdfunding in history attracts $150 million on the promise that it will embody “the steadfast iron will of unstoppable code.” Upon release it is immediately hacked, and $50 million is stolen.
Bitcoin’s good name having been somewhat stained by drugs and criminals, its advocates try to sell the technology to business as “Blockchain.” $1.5 billion of venture capital gets back, so far, zero. The main visible product is consultant hours and press releases.
How did we get here?
Digital cash, without having to check in with a central authority, is obviously a useful idea. It turned out in practice to be a magnet for enthusiastic amateurs with stars in their eyes and con artists to prey upon them, with outcomes both hilarious and horrifying.
Bitcoin and blockchains are not a technology story, but a psychology story: bubble economy thinking and the art of the steal.
Despite the creators’ good intentions, the cryptocurrency field is replete with scams and scammers. The technology is used as an excuse to make outlandish near-magical claims. When phrases like “a whole new form of money” or “the old rules don’t apply any more” start going around, people get gullible and the ethically-challenged get creative.
You can make money from Bitcoin! But it is vastly more likely that you will be the one that others make their money from.
Remember: if it sounds too good to be true, it almost certainly is.
In this book, I cover the origins and history of Bitcoin to the present day, with some of the important stories, the other cryptocurrencies it spawned – particularly Ethereum – and smart contracts and the attempts to apply blockchains to business. There’s also a case study on blockchains in the music industry.
I go into technical detail where it’s relevant, though what’s more important are the implications. There are also extensive footnotes, with links in the digital edition to the sources for further reading, and a glossary.
Chapter 1: What is a bitcoin?
Why Bitcoin?
Paper notes and metal coins are annoying and inconvenient, and we have the Internet now. So digital money sounds like a useful idea.
The solution the developed world has mostly come to is just using our banks – you have an account, and you can move money to other people’s accounts, via debit card, credit card, PayPal or whatever. The central authority means it’s sensibly regulated, errors and thefts can be reversed and so on. It’s also a smooth transition from paper money – the same thing, but you can do new things with it.
But this isn’t a complete solution; a shop’s card reader could be down, your payment gateway might charge fees, you may want to send money to someone not on the same banking network, you value your privacy, checking in with your bank every time gets annoying. So a form of digital cash would be nice too.
Bitcoin is a cryptocurrency: a thing on the Internet which lets you exchange unique digital objects. The objects would take approximately forever to fake; so if we assign the objects a value, we can exchange them in a manner something like we do money. It’s decentralised, so you can send money without having to go through a central clearing house.
Bitcoin’s transaction ledger, the blockchain, is touted as immutable: nobody can alter it without it being obvious that it was tampered with. The idea is that there’s no central control, anyone can run a Bitcoin node and be part of the network, nobody can block or reverse your transactions and you don’t have to take anyone’s word for the state of the system.
What you have when you have “a bitcoin”
You know what feels like “money” to you. You can earn it, you can spend it on all manner of things, you can save it for the future, you can invest it. It might be in a bank account with a card, or notes and coins in your pocket – it still feels like a pound or a dollar to you.
In practice, bitcoins are a bit like money in a bank account with a debit card, except without any sort of safety net – it’s all unregulated and uninsured, there’s no way to reverse a transaction, and there’s no customer service.
If you “have” bitcoins, you don’t actually have them as things on your computer. What you’ve got is a Bitcoin address (like a bank account number) and the key to that address (another number, which works like the PIN to the first number).2 The Bitcoin address is mentioned in transactions on the blockchain; the key is the unique thing you have that makes your bitcoins yours.
To send bitcoins from your address to another address (a bit like sending money over PayPal), you generate a transaction that is sent out into the network and added to the next block of transactions. Once it’s in a block, that transaction is publicly visible on the blockchain forever.
A wallet is where you keep your keys. Usually it’s a program which generates and manages addresses, and presents you with the balances. You can generate a new address, and its matching key, any time you like.
You can keep your bitcoins’ keys in a hot wallet (like a current account), running on a computer attached to the Internet, or in a cold wallet (like keeping money in a sock under your bed), which might be on a computer not attached to the Internet, or could just be the keys themselves stored on a USB stick or even printed out on paper.
If you lose the key, your bitcoins are lost forever. If someone else gets the key, they can take your bitcoins. If you send bitcoins to a nonexistent address, they’re lost forever. If you send bitcoins to the wrong address, you can’t reverse it. Bitcoin security can be very technical, difficult and unforgiving; most people just keep their bitcoins on an exchange. These have their own problems, as we’ll see later.
The blockchain
Bitcoin transactions are grouped into blocks. Each block has a cryptographic hash, a number which is quickly calculated and serves as a check value – like the last digit of a book’s ISBN, or the last digit of your credit card, but longer – to verify that a chunk of data is the chunk you think it is.
The hash will be completely different if there’s even the slightest change in the data; as such, two things with the same hash are routinely assumed to be identical.
Advocates describe Bitcoin as “secured by math.” This is because cryptography works on arithmetic that is fast going forward and impossibly slow to reverse – to make another data chunk with the same hash, you would have to go through a stupendous number of possible values. (Bitcoin mining relies on this – see below.)
Each block is also hashed with the chain of previous blocks, so the entire chain of blocks is tamper-evident. This is called a Merkle tree, invented in 1979 and widely used since.3 What Bitcoin does is make possible a tamper-evident public ledger of transactions, without any central authority declaring whose ledger is the official one.
The Bitcoin blockchain contains every confirmed transaction back to January 2009. In June 2017 it passed 120 gigabytes and is growing at 4GB a month.
Secured by waste: Proof of Work
So how do you decide who gets to write to the ledger? The answer is: competitive Proof of Work, where you waste computing power to demonstrate your commitment.4
A new block of transactions is created every ten minutes or so, with 12.5 bitcoins (BTC5) reward attached as incentive, plus any fees on the transactions. Bitcoin miners (analogous to gold miners) apply as much brute-force computing power as they can to take the prize in this block’s cryptographic lottery.
(The mining reward halves every four years – it started at 50 BTC, went to 25 BTC in 2012 and 12.5 BTC in 2016 – and will stop entirely in 2140. There will only ever be 21 million bitcoins.)
Satoshi Nakamoto, Bitcoin’s creator, needed a task that people could compete to waste computing power on, that would give one winner every ten minutes. The difficulty would need to automatically adjust, as computing power joined and left, to
keep block creation steady at about one every ten minutes.
What he came up with was: Unprocessed transactions are broadcast across the Bitcoin network. A miner collects together a block of transactions and the hash of the last known block. They add an arbitrary “nonce” value, then calculate the hash of the resulting block. If that hash satisfies the current difficulty criterion, they have mined a block! This successful block is then broadcast to the network, who can quickly verify the block is valid. The miner gets 12.5 BTC plus the transaction fees. If they failed, they pick another nonce value and try again.6
Since it’s all but impossible to pick what data will have a particular hash, guessing what value will give a valid block takes many calculations – as of June 2017 the Bitcoin network was running 5,500,000,000,000,000,000 (5.5×1018, or 5.5 quintillion) hashes per second, or 3.3×1021 (3.3 sextillion) per ten minutes.
The 3.3 sextillion calculations are thrown away, because the only point of all this technical rigmarole is to show that you can waste electricity faster than everyone else.
Obviously, the competition gets viciously Darwinian very quickly. Mining rapidly converges on 1 BTC costing 1 BTC to generate. The ensuing evolutionary arms race, as miners desperately try for enough of an edge to turn a profit, is such that Bitcoin’s power usage is on the order of the entire power consumption of Ireland.7
This electricity is literally wasted for the sake of decentralisation; the power cost to confirm the transactions and add them to the blockchain is around $10-20 per transaction. That’s not imaginary money – those are actual dollars, or these days mostly Chinese yuan, coming from people buying the new coins and going to pay for the electricity. An ordinary centralised database could calculate an equally tamper-evident block of transactions on a 2007 smartphone running off USB power. Even if Bitcoin could replace conventional currencies, it would be an ecological disaster.