Explain like I’m five: Bitcoin

What’s bitcoin?
It’s a fungible unit of value exchange backed by computer processing power and cryptographic proof-of-work.

It’s a what now?
It’s kind of like money powered by computers.

What’s so special about that?
Bitcoin is the first viable form of electronic money that doesn’t require a trusted third-party to function.

There you go again with that fancy talk!
Okay. Let’s say you buy a book from Amazon with your credit card. What actually happens is that you give Amazon your credit card details and they ask your credit card company for some money. Some time later you pay your credit card company and your credit card company pays Amazon (minus a small fee). The credit card company acts as the trusted third party in the transaction. You don’t actually magically beam money from yourself to Amazon.

But what about cash?
Good question, I’m glad I asked me that. If you pay someone £5, it leaves your possession and enters theirs. The proof is obvious (they’re holding it). Thing is, it’s mighty inconvenient to sit on bundles of cash (not to mention the risk of theft). So most people give their money to a trusted third party to look after.

You’re talking about banks right?
Right! We trust the banks to keep our money safe. Technically we’re lending it to the bank (and the bank pays interest on the loan). The interest banks pay on deposits isn’t much because deposits are supposed to be kept safely away from risk. Less risk = less return. This works nearly 100% of the time.

Nearly 100%?
Ask anyone with a savings account in Cyprus about what happens the rest of the time.

That was a cheap shot.
Yeah, probably. But let’s say you have an indestructible, unbreachable safe and put all your money in there. 10 years later you take it out again. Do you have as much money as you put in?

Well, yeah. Right?
That depends on how you value money. In purely numerical terms yes you do. You put £1,000 away, you take the same £1,000 out again. But measured in terms of buying power, you might have a lot less. The decrease in the buying power of money is called inflation.

There you go again.
It’s simple. Inflation (usually expressed as a percentage) tells us how much the price of a typical basket of goods has increased. Or, viewed another way, how much the value of money has gone down. For example, 30 years ago a loaf of bread might have cost between 10-50p. Now you’ll pay around £1. Inflation innit?

So where does inflation come from?
Ah well. Where does money come from?

I asked first.
Money comes from the government. Pretty much every currency in the world is ‘fiat currency’. It exists by government decree. Which means the government has the power to magically create money from nothing.

Wish I could do that.
Sounds great right? But let’s imagine you and a few friends could create money from thin air. You magic up a few million and start spending it. You’re rich! But because you and all your friends are buying up everything in sight, the people selling those things might decide to raise prices as there seems to be all this demand. No problem, just create some more money. But anyone who can’t create money can’t compete. The cash in their wallets buys a little less each day. And the more things you buy with your free money, the less there are available to sell to everyone else and the higher the prices go as people start to compete for the limited supply of goods. And anyone trying to save their money sees it’s real value dwindle to nothing. Do it on a national scale and you get Zimbabwe, or Weimar Germany. (Look it up). Eventually you need wheelbarrows full of cash just to buy an apple.

What has any of this got to do with bitcoin?
Bitcoin was designed to solve the two problems we’ve just talked about. The need for trusted third parties and monetary inflation. The bitcoin algorithm uses cryptographic techniques to ensure that the recipient of a transaction can verify that it is genuine and to create new bitcoins at a predictable (and declining) rate. The maximum number of bitcoins that will ever be created is around 21 million. The last bitcoin will be created sometime around 2140.

But it’s all just data. Data can be copied!
Sure, if a bitcoin transaction was just some text saying “here’s 10 bitcoins”, then you could keep giving people the same 10 coins. Bitcoin is a little more complicated than that. In simple terms, every participant in the bitcoin network knows the history of every transaction, so they can check that the coins you give them haven’t already been given to someone else.

But doesn’t that mean everyone needs to trust everyone else to tell them the truth?
Not quite – it means that there needs to be an easy way to tell if you’re being lied to. This is where the cryptography comes in. Simply put, all recent transactions are broadcast to the network. Participants (known as miners – I’ll explain later) collect these transactions and try to put them into ‘blocks’. This is computationally expensive (it takes a computer a long time to do it). Miners have to keep guessing for a solution to a mathematical problem based on the transactions it’s trying to make into a block. It takes many millions of guesses on average. The first miner to succeed broadcasts the block to the network. The rest of them check the answer (which is really quick as they only have to try the winning guess to double-check it, not millions). If they agree they add the block to their list (called the block-chain) and go to work on trying to make the next block. And so on.

You haven’t explained why they’re called miners.
Each new block that is created contains a special transaction that gives the miner that made it some bitcoins as a reward for creating the block. Hence they’re ‘mining’ for bitcoins.

But how does that make it safe?
It’s very difficult to make blocks. Each new block builds on the one before it, so the more blocks that get created, the harder it would be for an evil miner to add a block with a fake transaction in it. Honest miners will always work on the longest block-chain they have, so the evil miner would have to control more than half of the computers in the network to be able to make evil blocks more quickly than the rest of the network could make honest blocks. The longer the block-chain gets, the harder it becomes for an evil miner to catch up.

You said bitcoin doesn’t have inflation, but miners can get new coins. Isn’t that the same thing?
The bitcoin network is very clever. It adjusts the mining difficulty so that a new block is made roughly every 10 minutes, no matter how many miners there are. Each new block has a reward, which is presently 25 bitcoins. So 25 new bitcoins are made every 10 minutes. Every 4 years the reward goes down by half. So in 4 years, the reward will be 12.5 bitcoins for each new block. Eventually the reward drops to such a small number of bitcoins that it rounds down to nothing. That will be in around 2140. This is what gives bitcoins their predictability. Nobody can magic more of them from thin air.

Awesome! Is that it?
Not really, but more detail will have to wait, or you can go read more at http://bitcoin.org.

The future of money

I heard about Bitcoin before it was cool. I read (well, skimmed) the paper. I thought, “that looks interesting” and went about my business.

2 years later and don’t I feel silly. I don’t know if Bitcoin will replace fiat money. I’m not sure Bitcoin has got it totally right (the 21 million BTC hard limit being the thing I’m most concerned about). But I do think that it has paved the way for a mechanism of exchange that fits the internet. Very exciting.

Satoshi Nakamoto I salute you.

The futility of humility

There’s been a lot of chatter within my network about the pursuit, and virtue of, humility. Usually framed as ‘humility vs arrogance’

I don’t find the term ‘humility’ especially helpful. It’s an abstract concept and, as such, very subjective. I think that a majority of the disagreements that have occurred are based in part on a lack of agreement about the definition of the term.

Humility is, in many religions and cultures, espoused as a virtue, something to aspire to. It can also be used in a negative way, to denigrate or (hah) humiliate someone who might be perceived as a threat to an authority figure. The ‘know your place’ (i.e. subordinate to me) put-down.

Googling for ‘humility’ gave me the following quote from http://www.newadvent.org/cathen/07543b.htm

The word humility signifies lowliness or submissiveness an it is derived from the Latin humilitas or, as St. Thomas says, from humus, i.e. the earth which is beneath us. As applied to persons and things it means that which is abject, ignoble, or of poor condition, as we ordinarily say, not worth much. Thus we say that a man is of humble birth or that a house is a humble dwelling. As restricted to persons, humility is understood also in the sense of afflictions or miseries, which may be inflicted by external agents, as when a man humiliates another by causing him pain or suffering. It is in this sense that others may bring about humiliations and subject us to them. Humility in a higher and ethical sense is that by which a man has a modest estimate of his own worth, and submits himself to others. According to this meaning no man can humiliate another, but only himself, and this he can do properly only when aided by Divine grace. We are treating here of humility in this sense, that is, of the virtue of humility.

Even in this single paragraph we have humility defined as being submissive, ignoble, of poor condition, not worth much, afflicted, miserable, being subject to pain and suffering. Who’d aspire to that??

Later on it talks about humility in a ‘higher sense’ as being modest and voluntarily submitting oneself to others. This is an improvement but still not something I really agree with. (The submitting oneself to others part is of course really useful if you’re a religious leader who wants to keep the flock docile). Make it a virtue to be aspired to and they’ll do it to themselves, yay!

But let’s assume a more modern definition: wikipedia defines humility thus:

Humility (adjectival form: humble) is the quality of being modest and respectful. Humility, in various interpretations, is widely seen as a virtue in many religious and philosophical traditions, being connected with notions of egolessness.

Being modest and respectful. Now we’re getting closer. Except… hmm, modest AND respectful. This is possibly why I take issue with the assertion that humility is a virtue (and, therefore, universally to be aspired to). Respectfulness I can totally get behind. I refute the notion that I must also be modest. In fact, if I tweet about how I’m seeking humility and why you should too, I’m really not being that modest, am I? So I’m not humble.

But I do strive to be respectful.

Now moving on to arrogance, which has been often mentioned as the only alternative option. Ie. you’re either humble or arrogant. There are no alternatives. And humility is good, so arrogance must be bad, right?

I’m running out of time to drill into it but my main dispute here is I don’t subscribe to the notion that arrogance is the inverse of humility, nor that they are context-free. I might be ‘humble’ when discussing hypnotherapy with my teacher, I’ve got about 20 days experience compared with his 15 years, it makes sense to be modest in that context. In the subject of software development I am definitely not humble. I also try to avoid being arrogant, but I am confident.

And I still strive to be respectful.

Enterprise Deployment

Every organisation I’ve developed software for held the belief that their deployment situation was special, unique and complicated. Most of them came up with convoluted release processes involving multiple manual steps, hundreds of configuration variables, shell scripts and workarounds.

The problem is primarily one of mindset. The presence of multiple applications at multiple versions and multiple environments on multiple machines can lead to a belief that it’s necessary to explicitly manage all of these axes as part of the deployment process.

I prefer a different metaphor: I always try to work as if the deployment artifact will be burned onto DVD and shipped all over the world. Treating software as a product like this makes it much easier to identify what is really part of the software and what must be configured as part of the installation process.

All of the environment/machine/etc specific information can be collapsed into configuration, eg. as a property file or command-line argument. Artificially separating them out leads to more complexity not less. It’s either part of the software (on the DVD) or it’s configuration. That’s it.

If I ruled the world

My next Java project would…

  • Be built with gradle
  • Use git for SCM
  • Check in deployable artifacts
  • Be an executable jar
  • Use JPA annotations for persistence

Would not…

  • Use maven
  • Use spring