Bitcoin Internals: Spec And Protocol

As with our previous posts on Bitcoin, this blog post represents opinion, and is absolutely not investment advice. It is provided with absolutely no guarantees or recommendations whatsoever.

In 2010 or 2011, I bought a Bitcoin or two for around $40, and sold them in 2014 for around $1500. This is not financial advice, but even though I’ve personally had a great experience with Bitcoin, its glory days may be behind it. I no longer own any myselfThis is still not financial advice., and I’m going to explain some of its technical risks.

Bitcoin Has No Formal Specification

During his tenure as Bitcoin’s former lead developer, Gavin Andresen repeatedly argued that Bitcoin did not need a formal specification. In 1996, he wrote the spec for VRML, the virtual reality markup language, and he’s said that this experience taught him the dangers of writing a spec before the project was ready.

I haven’t investigated VRML in detail, but with Occulus Rift still not available to consumers in 2015, I’m willing to assume that writing a spec for a virtual reality markup language in 1996 was indeed premature. However, as of this writing, the total value of Bitcoin in worldwide circulation is over three billion dollars. If a $3B economy depends on your technology, it probably is mature enough to justify writing a spec.

Andresen’s answer has been that the implementation is the spec. The Ruby community runs on the same philosophy, which has been a source of controversy for language implementers. A technology without a formal specification is a good hiding place for bugs. Since Ruby powers a lot of web sites, there are financial incentives for malicious actors to discover, and keep secret, Ruby exploits. Since Ruby is written in C, which allows access to arbitrary memory locations, bugs and exploits are almost inevitable. Forty-four have been found.

The financial incentives to discover hacks and exploits, and to keep them secret, are all much stronger in the case of Bitcoin. Bitcoin’s written in C++, which also allows access to arbitrary memory locations. This “feature” of C and C++ is such a perpetual and inevitable goldmine of exploits and hacks that Mozilla’s Rust is designed around eliminating it. Although only 22 vulnerabilities have been found so far, the best estimate is that one out of every 16 or 17 Bitcoins is stolen. That’s because those same financial incentives motivate fraud and hacking Bitcoin exchanges.

Bitcoin Has No Absolute Protocol

If all this sounds a bit dark and cynical, I have a story of the Bitcoin community pulling together. In 2013, the new v0.8 Bitcoin release unintentionally forked the blockchain by breaking backwards compatibility, introducing new blocks which only some Bitcoin nodes were able to authenticate. (Others regarded the blocks as illegitimate.)

Bitcoin miners reverted to the previous version, and the largest exchange at the time suspended operations until the bug was fixed. (This was Mt. Gox, which later filed for bankruptcy after losing approximately $450M worth of Bitcoins, probably to hackers.) Although the incident resulted in no losses — except for any miners who unearthed a new block, only to have it reverted into nonexistence — it highlights some flaws in Bitcoin.

First, of course, backwards compatibility is very important if your technology relies first and foremost on maintaining immutable history. Bitcoin’s designed to continue furnishing new blocks until about 2140. So, if Bitcoin succeeds, the Bitcoin developers have at least 125 years of maintaining backwards compatibility ahead of them. Second, Bitcoin is not immune against the fact that no known solution exists for the Byzantine Generals’ Problem where only two-thirds or less of the network is trustworthy.

To quote an Ars Technica story on the hack, and a related price drop:

No single person or institution can order Bitcoin miners to abandon the 0.8 branch of the blockchain in favor of the 0.7 branch. Rather, the “winning” branch is effectively chosen by a majority vote of the network’s computing power. Bitcoin’s technical developers must convince a majority of the network’s miners to voluntarily downgrade their software. Fortunately, Bitcoin still enjoys a relatively tight-knit community, and its leaders say they are confident they can get the cooperation they need.

Bitcoin clients have to announce their protocol version immediately upon connecting to the network. In a tight-knit community, people use this transmission honestly, and everything works out fine.

Web browsers do something kind of similar: they send HTTP headers which are supposed to identify the browser and its version. But many user-agent strings are total lies. In a history of these deceptions, Nicholas Zakas wrote:

The history of the user-agent string is marked by browsers trying to convince user-agent sniffers that they are what they are not. Internet Explorer wants to be identified as Netscape 4; Konqueror and WebKit want to be identified as Firefox; Chrome wants to be identified as Safari.

Say a malicious actor wants to fork the blockchain. Last time this happened, prices plummeted, so this could be a good way to pick up Bitcoins cheaply, and then sell them at a profit once the market recovers. Or maybe they just want to destroy the currency for the hell of it.

So they create a Bitcoin client which occasionally fails to recognize valid blocks, or falsely approves invalid blocks. But their doctored Bitcoin nodes lie to the rest of the network and claim to implement some existing, valid version of the protocol. Eventually, the tight-knit community at the heart of Bitcoin will figure out what happened, but when they do, they’ve got to decide which fork of the blockchain to keep intact. That could be a very contentious problem.

So again, if Bitcoin succeeds, its community should remain at least somewhat tight-knit, for at least another 125 years. Or, alternatively, the banking bailouts of 2008 may be followed up by the Bitcoin bailouts of 2108.

To be fair, though, that’s not really necessary for Bitcoin to succeed. It’s only necessary for Bitcoin to succeed so well that it exhausts all of its mining “reserves.” I can’t really say what it would take for Bitcoin to succeed, and neither can anyone elseExcept Satoshi Nakomoto.. There’s too much speculation about its real intended purpose. Some people think it’s a libertarian plot to destroy all governments. I personally suspect an inspired hacker wanted to build something weird. (Note that these two interpretations do not necessarily exclude one another.)

Either way, Bitcoin has certainly succeeded at demonstrating the power and appeal of its core ideasAssuming for the sake of argument that proof-of-work is not one of those core ideas.. As the new foundation for a transglobal economy, it has alarming flaws. But it may still serve as the inspiration for more solid future implementations.

Still not investment advice.