Trying to understand bitcoins

In a 2008 paper, a Japanese programmer, Satoshi Nakamoto, introduced an alternate form of currency that he called bitcoins. His justifications were the problems plaguing contemporary digital commerce. In Nakamoto’s words:

Completely non-reversible transactions are not really possible, since financial institutions cannot avoid mediating disputes. The cost of mediation increases transaction costs, limiting the minimum practical transaction size and cutting off the possibility for small casual transactions, and there is a broader cost in the loss of ability to make non-reversible payments for nonreversible services.

With the possibility of reversal, the need for trust spreads.

Merchants must be wary of their customers, hassling them for more information than they would otherwise need. A certain percentage of fraud is accepted as unavoidable. These costs and payment uncertainties can be avoided in person by using physical currency, but no mechanism exists to make payments over a communications channel without a trusted party.

Nakamoto’s solution was a purely digital currency – the bitcoin – that would let transacting parties remain anonymous, keep transactions very secure, and eliminate redundant fees. Unlike conventional currencies such as the rupee or the dollar, it would also be impervious to government interference. And it would accomplish all this by “being material” only on the world wide web.

Contrary to popular opinion, bitcoins don’t already exist, waiting to be found, etc. Bitcoins are created when a particular kind of transaction happens – not between two people, but between two people and a system that can be thought of as a bitcoin client. It exists on the world wide web, too.

When you login through your client and start looking for a bitcoin, you’re given a bit of information – like your location on the web, a time, a date, an index number, etc. – called a mandatory string. You then proceed to encrypt the string using an algorithm called the SHA-256. Doing this would require a computer or processor called the miner.

A legacy in the string

On the miner, an encryption algorithm performs mathematical and logical operations on it that distorts all information that would’ve been visible at first glance. For instance, if the mandatory string reads like thecopernican.28052013.1921681011, post-encryption with SHA-256 it would read 2aa003e47246e54f439873516cb1b2d61af8def752fe883c22886c39ce430563.

In the case of bitcoins, the mandatory string consists of a collection of all the mandatory strings that have been used by users before it. So, encrypting it would mean you’re encrypting the attempts of all those who have come before you, maintaining a sort of legacy called the blockchain.

After this first step, when you manage to encrypt the mandatory string in a specific way – such as such that the first four digits are zero, say – as determined by the system, you’ve hit your jackpot… almost.

This jackpot is a block of 50 bitcoins, and you can’t immediately own it. Because you’ve performed an encryption that could just as well have been staged, you’ve to wait for confirmation. That is, another user who’s out there looking for bitcoins must have encrypted another bit of mandatory string the exact same way. The odds are against you, but you’ve to wait for it to happen or you won’t get your bitcoins.

Once another user lands up on your block, then your block is confirmed and it’s split between you – the miner – and the confirmers, with you getting the lion’s share.

Proof of work, and its denial

This establishes proof of work in getting to the coins, and implies a consensus among miners that your discovery was legitimate. And you don’t even need to reveal your identity for the grant of legitimacy. But of course, the number of confirmations necessary to consummate a “dig” varies – from six to some appropriate number.

If, somehow, you possess more than 50 per cent of the bitcoin-mining community’s encrypting power, then you can perform the mining as well as the confirmation. That is, you will be able to establish your own blockchain as you are the consensus, and generate blocks faster than the rest of the network. Over time, your legacy will be longer than the original, making it the dominant chain for the system.

Similarly, if you have transferred your bitcoins to another person, you will also be able to reverse the transaction. As stated in a paper by Meni Rosenfeld: “… if the sender [of coins] would be able, after receiving [a] product, to broadcast a conflicting transaction sending the same coin back to himself,” the concept of bitcoins will be undermined.

Greed is accounted for

Even after you’ve landed your first block, you’re going to keep looking for more blocks. And because there are only 21 million bitcoins that the system has been programmed to allow, finding each block must increase the difficulty of finding subsequent blocks.

Why must it? Because if all the 21 million were equally difficult to find, then they’d all have been found by now. The currency would neither have had time to accrue a community of its users nor the time needed to attain a stable value that can be useful when transacting. Another way to look at it is because bitcoins have no central issuing authority, like RBI for the rupee, regulating the value of the currency after letting it become monopolised would be difficult.

The coin doesn’t have an intrinsic value but provides value to transactions. The only other form of currency – the one issued by governments – represents value that can be ascertained by government-approved institutions like banks. This shows itself as a processing fee when you’re wiring money between two accounts, for instance.

A bitcoin’s veracity, however, is proven just like the its mining: by user confirmation.

What goes around comes around

If A wants to transfer bitcoins to B, the process is:

  1. A informs B.
  2. B creates a block that comes with a cryptographic key pair: a private key that is retained by B and apublic key that everyone knows.
  3. A tells the bitcoin client, software that mediates the transaction, that he’d like to transfer 10 bitcoins to B’s block.
  4. The client transfers 10 bitcoins to the new block.
  5. The block can be accessed only with the private key, which now rests with B, and the public key, which other miners use to verify the transaction.

Since there is no intervening ‘authority’ like a bank that ratifies the transaction but other miners themselves, the processing fee is eliminated. Moreover, because of the minimal resources necessary to start and finish a transaction, there is no minimum size of transaction for it to be economically feasible. And last: a transaction is always (remarkably!) secure.

God in the machine

While the bitcoin client can be used on any computer, special hardware is necessary for a machine to repeatedly encrypt – a.k.a. hash – a given string until it arrives at a block. Every time an unsatisfactory hash is generated that’s rejected by the system, a random number is affixed to the mandatory string and then hashed again for a different result. Each such result is called a nonce.

Because only a uniquely defined nonce – such as starting with a few zeroes, etc. – is acceptable, the mining rig must be able to hash at least millions of times each second in order to yield any considerable results. Commercially available rigs hash much faster than this, though.

The Avalon ASIC miner costs $9,750 for an at-least-60 billion hashes per second (GH/s) unit; the BFL Jalapeno 50-GH/s miner comes at $2,499. Note, however, that Avalon accepts only bitcoins as payment these days, and BFL haven’t shipped their product for quite some time now.

The electronic architecture behind such miners is either the application-specific integrated circuit (ASIC) or the advanced field programmable gate array (FPGA), both of which are made to run the SHA-256 algorithm. ASICs are integrated circiuts customised for a particular application. FPGAs are ASICs that are customisable even after manufacturing.

Because of the tremendous interest in bitcoins, and crypto-currencies in general, its economic impact is best measured not just by its present value – a whopping $130 per bitcoin – but also the mining-rig industry, their power consumption, ‘bitcoin bubbles‘, and the rise of other crypto-currencies that take an even more sophisticated approach to mitigating the pains of internet commerce.

This post first appeared, as written by me, in The Copernican science blog on May 31, 2013.