Blog

Bitcoin Part 2 – Bitcoin Mining

This is part II of my series of blog posts on the topic cryptocurrencies. The first, introductory part can be found here.

Recap – Bitcoin = direct electronic transactions without intermediary

To recap, I explained the main idea behind the Bitcoin protocol, which allows electronic peer-to-peer transactions without an intermediary. In brief, the process works as follows:

  1. I own a certain amount of Bitcoin. This can be publicly verified, because every Bitcoin transaction since the very first one is entered into a public ledger called the block chain. So I can’t pretend to have more money than I have.
  2. I can send a certain amount of Bitcoin to a recipient, and I can’t cheat while doing that, because the transaction is publicly broadcast to all nodes in the network.
  3. I could simultaneously send out more Bitcoins than I have, but the network decides through a process that is a bit like voting (and in reality involves solving a complex math problem) called mining, which transactions are valid and which ones aren’t.
  4. The transactions that are chosen as valid are entered into the block chain, the public ledger, and become final. And once I’ve depleted my verifiable amount of Bitcoins, I can’t spend more than I have (or double-spending), because everybody knows that I’ve got nothing.

The two key elements in the Bitcoin process are the public ledger, the block chain and the “voting” process called mining, which is actually carried out by the computers forming the nodes of the network in form of solving a complex mathematical problem. I’ll discuss the block chain in the next post, here I’ll focus on mining.

Mining without Shoveling Coal

The key issue that the mining algorithm needs to solve is to ensure that the “voting”/confirmation process is such that nobody with bad intentions can influence it in their favor. And this is exactly what the mining process accomplishes.

Coal mining

Traditional form of mining (Picture donated by the company Eickhoff Engine Works and Iron Foundry, Bochum.)

Mining denotes the process by which a set of new transactions are confirmed and finalized by appending a record of these transactions to the block chain, the public ledger. It is also the process by which new bit”coins” are minted, thus the term “mining.” New Bitcoins are minted and transactions are confirmed in form of chunks of data, so-called “blocks,” that are appended to the block chain. The Bitcoin algorithm is such that new blocks are discovered roughly every 10 minutes.

Roughly, the process works as follows:

  1. The Bitcoin network consists of lots of active nodes on which the Bitcoin client is run. When a block is discovered it is added to the block chain, and every node in the network receives information about that new block within fractions of seconds. Roughly speaking, that block also contains a statement with the next computational problem that is to be solved in order to discover the next block.
  2. People send their as of yet unconfirmed transactions, that is, transaction proposals out into the network, along with a transaction fee. Naturally, because computer transmissions are happening in finite time, not every node will receive all these transactions in the same order. Therefore, the new potential additions to the ledger, the transaction proposals, will not be the same list for every node in the network.
  3. Meanwhile, the active Bitcoin nodes all start to compute the solution to the problem stated in step 1, whereby there is a certain randomness involved, so that not everybody computes the same thing. I will discuss the mathematical details in a separate blog post.
  4. After on average 10 minutes, one of the nodes discovers the solution to the problem in step 1 and broadcasts the solution to the network along with its particular copy of the new additions to the ledger.
  5. The rest of the nodes validate the solution and this particular copy of the new transaction proposals, thereby confirming the transactions that that particular node has received.
  6. After 100 nodes have confirmed that everything is in order, the lucky (and/or computationally powerful) node that found the solution collects the transaction fees mentioned in step 2, as well as gets a certain amount of newly minted Bitcoins (BTC). This is the incentive for the general public (the nodes) to participate in the network and go through the trouble of validating other people’s transactions.
  7. And we begin again with step 1.
Bitcoin mining

Bitcoin mining

Why do the miners need to solve a math problem?

The explanation above leaves many open questions, the one in the section header above among them. The math problem is there to insert a certain (but carefully designed) randomness into the process, such that nobody can predict which node will be the one to confirm the next block. This makes it much harder to rig the system. This process is referred to as proof of work. There is one way that the system can be unduly influenced, with a so-called 51% attack, see below.

But why is the algorithm such that a new block is found every 10 minutes, why not faster? If the process were significantly faster, the problem of a fork in the block chain, when multiple nodes discover a solution simultaneously, would be exacerbated. Occasionally it happens in the current scheme that two or more nodes discover a new block at the same time, but the timing of 10 minutes between blocks is enough to avoid a complete forking of the block chain, which would create two or more independent public ledgers. With the current scheme, these forks are usually discovered before a whole new chain can form and contain only one new block. These blocks are removed from the block chain by consensus and are called orphaned blocks.

Another question that arises is: If there are new Bitcoins minted with every block, doesn’t this automatically lead to inflation? No, because the amount of new Bitcoins created in every block halves every 210,000 blocks. At the time of writing (June 2015), 25 new BTC are minted with every block. By 2017, this will be halved to 12.5 BTC per block. The current number of BTC in circulation is shown in the following graph (Data source: Blockchain.info). Eventually, the amount of new BTC will go to 0 and the total amount of BTC will be capped at 21 million BTC. This will happen sometime in 2140, so not anytime soon. By that time, the miners will get only the transaction fees as reward. More info about the 21 million cap can be found here.

Number of BTC in circulation (Data source: Blockchain.info)

Number of BTC in circulation (Data source: Blockchain.info)

Then, the question arises: Couldn’t you buy so much computing power to completely overpower all the other nodes in the system, which would enable you to enter arbitrary amounts into the block chain, which you could confirm yourself and thereby making you infinitely rich? This is called a 51% attack and the Bitcoin equivalent of counterfeiting. In order to take over the Bitcoin network, you’d need at least 51% of the network’s computing power. However, this is increasingly unlikely, since veritable BTC mining farms have been built due to the speculative value of BTC, which at one time was over $1000 per BTC (see graph below, click to enlarge). At that time, it made economic sense to invest heavily in server farms such as the one shown below. However, because the difficulty of the mathematical problem to be solved in order to mine (mint) new blocks (coins) is algorithmically adjusted such that on average only every 10 minutes a new block is found, regardless of how much computing power is thrown at the problem, this arms race led to an exponential increase in the difficulty, as illustrated in the last graph below (click to enlarge). Thus, a 51% attack is unlikely, unless many miners pool together in so-called mining pools. In fact, this is what most people mining BTC do these days, because it is next to impossible for an average person who doesn’t own a supercomputer server farm to mine a block solo, thanks to the increase in difficulty.

BTC market capitalization in USD (Data source: Blockchain.info)

BTC market capitalization in USD (Data source: Blockchain.info)

BTC mining difficulty (Data source: blockchain.info)

BTC mining difficulty (Data source: blockchain.info)

This concludes part 2 of my Bitcoin blog series. Stay tuned for part 3, where I will discuss the public ledger, the block chain, and how to read the information contained therein in more detail.

Bitcoin Part 1 – Byzantine Generals and Pseudonyms or: What is Bitcoin?

In preparation for my upcoming presentation at the American Translators Association’s 56th conference in Miami with the title “Bitcoin and Other Cryptocurrencies – Illegal Money or a New Global Payment Option?,” I am going to write a series of blog posts on the topic. To anticipate the answer to the question in the title of the presentation: Bitcoin is both, or neither, depending on how you look at it.

Now, that’s not a very satisfying answer, so let’s start at the beginning:

What IS Bitcoin?

Actually, let’s go back even further: What is the IDEA behind Bitcoin?

The idea behind the Bitcoin protocol is to facilitate virtual transactions without a trusted intermediary.

When you send somebody money via traditional virtual channels (ACH, EFT, wire transfer, Paypal, etc.), there is always at least one trusted central party — your bank and the recipient’s bank, Paypal, etc. If you go somewhere in person and hand over cash, you don’t need an intermediary, assuming that both parties agree on the value of the printed paper called cash, because something actually changes hands verifiably and visibly. Bitcoin enables the electronic equivalent of such a transaction, it kind of makes virtual transactions verifiable and visible.

Cash exchange between A and B

Cash exchange between two people, A and B


Why do you need a trusted intermediary in traditional transactions?

Assume I have a virtual “monetary bill” (some sort of file) that is the equivalent of, say, 1000 Dollars. Now I can copy that virtual bill and send it to multiple somebodies to pay for something essentially simultaneously (because virtually), and by the time anybody notices that I initially only had 1000 Dollars, but sent out these 1000 Dollar bills to 1000 or 10000 or 100000 different people, I am long gone and sipping Pina Coladas in my private mansion on my own personal tropical island without extradition treaty.

Exchange of virtual money

Exchange of virtual money between two people, A and B

In other words, in order to facilitate a virtual transaction without a trusted central party, one needs to find a way to make sure that

  1. the sender really has the initial amount of money he or she claims to have,
  2. the sender really sends that amount of money, that is, the amount is actually removed from the sender’s possession,
  3. the sender sends the amount exactly once to exactly one other person in one transaction,
  4. the amount is really credited to the recipient, in the right amount, and only once.

If you hand over a printed bill, the above is obvious. In traditional virtual transactions, the trusted central party performs precisely the above steps. The question now is: How can the same be achieved without a central party and without all sorts of mayhem breaking loose thanks to crooks, hackers, and thieves? The Bitcoin protocol proposes to achieve just that.

What do Byzantine generals have to do with anything?

Nothing, really. It’s just that mathematicians and computer scientists love to illustrate their thought experiments with byzantine stories (pun intended). Physicists, on the other hand, love to give their creations of the mind whimsical names, such as quarks, wino, WIMP, etc. But I digress… Back to Byzantine generals, whereby here Byzantine refers to the ancient empire.

The problem, stated by Leslie Lamport, Robert Shostak, and Marshall Pease in a 1982 paper (this links to the actual original paper), is the following:

A group of Byzantine generals is planning to attack a city from various sides. Now, the generals have to ensure somehow that they are attacking at the same time, otherwise their attack plan would fall through. However, this is not easy, since this is taking place in ancient times, thus in an era before cell phones. Also, in case there are traitors among the generals, they have to make sure that the traitors can’t thwart the overall plan by disseminating false information through messengers. Since all communication is taking place via messenger, there are lots of potential problems with communication, traitors, etc. The aforementioned (and linked) paper discusses all sorts of scenarios and analyzes them.

The byzantine generals problem.

The Byzantine generals problem.

This is exactly the same problem I described above for the transmission of money without a trusted intermediary:
How can you ensure trust without a trusted party?

Satoshi Nakamoto to the rescue

Who the heck is Satoshi Nakamoto?
Nobody knows. It is the pseudonym of the author or group of authors of the 2009 paper that proposed the Bitcoin solution to the aforementioned Byzantine generals’ problem. You can read the paper here. The whole story about who might be behind the pseudonym would probably make for several thrilling novels, but I digress again.

In short, the proposed Bitcoin solution to the problem of building trust without a trusted party is to trust everybody by trusting nobody.

Ok, that probably sounds more complicated than it is. Back to the story with the virtual 1,000 Dollar bill above. Suppose I really send out that 1,000 Dollar bill 10,000 times. Then I would have made 10,000,000 Dollar out of 1,000. Not bad for a few mouse clicks. But, within the Bitcoin protocol, at the same time of sending out any one transaction, I also broadcast the fact that I made this transaction to everybody. Everybody in the network is aware that I sent 1,000 Dollars to somebody. I can do this 10,000 times simultaneously, no problem. But then everybody in the network knows that I sent the same 1,000 Dollars 10,000 times to 10,000 different people. And then everybody in the network “votes” on which one of the 10,000 transaction is actually valid. In other words, if I make 10,000 transactions, but only happen to have the money for 1 of these transactions, only 1 of these 10,000 transactions is validated by a sort of “voting” mechanism. This is called “mining” in cryptocurrency terminology, more about that in a later post. The transaction is then settled, I will have paid exactly 1,000 virtual Dollars (or BTC = Bitcoin) to exactly one recipient, the recipient will have received exactly 1,000 virtual Dollars exactly once, and the whole transaction is entered into a public ledger (the block chain), all without one trusted party.

In bullet points:

  1. I own a certain amount of Bitcoin. This can be publicly verified, because every Bitcoin transaction since the very first one (the so-called genesis block) is entered into a public ledger called the block chain. So I can’t pretend to have more money than I have.
  2. I can send a certain amount of Bitcoin to a recipient, and I can’t cheat while doing that, because the transaction is publicly broadcast to all nodes in the network.
  3. I could simultaneously send out more Bitcoins than I have, but the network decides through a process that is a bit like voting (and in reality involves solving a complex math problem) called mining, which transactions are valid and which ones aren’t.
  4. The transactions that are chosen as valid are entered into the block chain, the public ledger, and become final. And once I’ve depleted my verifiable amount of Bitcoins, I can’t spend more than I have, because everybody knows that I’ve got nothing.

Essentially, Bitcoin is really like electronic cash. Once you give a bill or a Bitcoin to somebody else, the transaction has irrefutably taken place. No intermediary required.

The mathematical implementation of this algorithm is described in the paper by Satoshi Nakamoto and is obviously not trivial (as mathematicians like to say), but that is the protocol in a nutshell. Everything else is just ornaments and epicycles around the basic idea, which is: Let the public decide which transactions are valid and which ones aren’t to avoid cheating.

Naturally, this public “voting process” has the potential to disrupt the banking industry, which relies on partly really old and thus not so hacker-proof transaction protocols. Wall Street and Silicon Valley venture capitalists have actually figured this out and are investing heavily in developing the protocol further (not in Bitcoin itself), while other banking institutions are not so happy. Letting the public decide which transactions are valid and which are not may also be an issue for not so democratic places on earth, which is why in said places cryptocurrencies have been declared completely illegal. In other places, such as the US, the legal situation is also not entirely clear, but for a different reason: There is a certain untraceability of crytpocurrencies, despite the public ledger, which makes it suitable for use in black markets and money laundering. And carrying around a virtual suitcase full of Bitcoins is a whole lot more inconspicuous than good old Al Capone with his suitcases full of cash. But law enforcement caught him in the end, so I think cyber-law enforcement will also catch up with cryptocurrency criminals.

Obviously, the question arises: How come criminals and drug smugglers love Bitcoin as a payment option on the dark web if there’s a public ledger? That’s because of the “crypto” part in the word cryptocurrencies. I’ll discuss this is a later post in this series, along with the mysterious “mining” operation mentioned above. The “voting”/mining part is actually much more complicated than I’ve described above. It’s not really as “democratic” as I’ve indicated above and involves a lot of computing power. But more on that in another post. I’ll also explain how to set up a wallet and how to actually transact Bitcoins. No shoveling of coal is involved. And I’ll also discuss altcoins such as Litecoin, Dogecoin, and Quatloo (yes, this cryptocurrency really exists).

However, as said in the previous paragraph, in some places cryptocurrencies are illegal, and in some places (such as California) the legal situation is in constant flux, so nothing you read here can be construed as legal or financial advice, simply because I’ve already got a full-time job and several intensive part-time hobbies, and trying to keep up with the legal situation in regards to cryptocurrencies is a full-time job in its own right.

Global Voices: We Are Working To Prevent Explosions – Spoken Word in East Africa

“The youth… are like time bombs. We are working to prevent explosions. If words are never let out, we’ll explode!” … Read the whole article on Global Voices.

I have just translated another article for the German edition of Global Voices, this time about art and freedom of expression in Africa. The translation can be found here: “Wir wollen Explosionen verhindern: Spoken-Word-Vorführungen in Ostafrika”.

Stark Photos Show Nepal’s Heritage Sites Before and After the Quake

Stark Photos Show Nepal’s Heritage Sites Before and After the Quake

The earthquake has left an indelible scar in Nepal. Despite the devastation and destruction, however, Nepalis haven’t lost their hopes to rebuild their historic monuments and sites. Full article on Global Voices.

I have just translated the above article about the devastation the recent earthquake left in Nepal for Global Voices into German. Link to my translation: Dramatische Bilder von Nepals Kulturgütern vor und nach dem Erdbeben . The article is now part of the Global Voices auf Deutsch dossier on the earthquake in Nepal, “Erdbeben in Nepal: Trauer, Angst und Wiederaufbau.”

Global Voices: Yemen’s Catastrophic Infographics Highlight Tragedy in Numbers

I just translated another post for Global Voices with the title “Yemen’s Catastrophic Infographics Highlight Tragedy in Numbers“.

Yemen in Numbers

Under the hashtag #YemenInNumbers, Yemeni student Ruba Aleryani has creatively presented Yemen’s catastrophe in eye catching and simple infographics. Noon Arabia shares this selection of tweets which highlight the tragedy. … Read more on Global Voices

Here is the link to my German translation, “Infografiken sagen mehr als tausend Worte über die menschlichen Tragödien im Jemen“.

Copyright protection

Evidently, some of my writings and thoughts on various topics on this blog seem to be worthy to be pirated and are posted elsewhere without my permission or knowledge or referring back to this website. So, unfortunately, I have had to take some drastic measures to protect my intellectual property and added a plug-in that prevents certain keyboard shortcuts and mouse click actions. You should still be able to download the linked (and secured) files, but you shouldn’t be able to copy and paste stuff anymore.

If you want to use the material on this site elsewhere, please shoot me a message, I’m happy to work out an agreement that won’t cost you an arm and a leg (meaning, with the proper attribution, you’ll likely be able to use the content for free).