blockchain

What’s the big deal with blockchain? Part #1

I’ve just returned from the Blockchain Expo in London’s Olympia – a really well organised conference, with a great range of technical and business related talks and panels. But from speaking to some of my fellow software professionals, I became aware that even though they were aware of blockchain and the hype around it, they weren’t really aware of how it worked, or what it could be used for.

To fill this gap – and also to help me understand it more deeply – I’ve started to write a short series of posts. Because it’s quite a tricky topic – and that some people seem to use Blockchain and Bitcoin kind of interchangeably – I’ve written it in the style of a conversation which I think helps explain it a bit better.

So you’re just back from a conference, and you want to “blockchain all the things” now to “disrupt markets”?

Well, no. Though I understand why you’re cynical. It’s definitely getting a lot of hype. I’m not quite ready to “blockchain all the things” quite yet.

I’m not sure why I’d be interested in a technology that’s for Bitcoin.

It’s not just for Bitcoin, though the Bitcoin and Blockchain are often talked about together. Blockchain is a foundational technology, which solves a problem to allow Bitcoin to work. Bitcoin is an application of that technology.

OK – what is the problem that Blockchain solves for Bitcoin?

For that specific application, it solves the double-spending problem.  Since it’s so easy to copy things digitally, it’s rational to not trust that the digital coin being spent in one transaction isn’t being copied, and used over and over again – a bit like counterfeiting digital money. This problem isn’t really about how to stop copying bits and bytes – it’s fundamentally about how to facilitate trust between two parties.

(You can read more at https://en.wikipedia.org/wiki/Double-spending).

Blockchain is the technology that facilitates this trust by providing a reputable public ledger of activity detailing all transactions. You can receive a promise of receiving a valid bitcoin payment, and trust that you’ll receive a valid bitcoin token which has never been used before when the transaction completes.

I’ve used the word “trust” there three times, that was deliberate. Blockchain isn’t some kind of accountancy software – it solves a trust problem.

So let’s stay with the Bitcoin application for a minute – how does this Blockchain (or ledger) get generated?

The bitcoin network gathers all the transactions in a set period together into a list, called a block. Given it’s a list of transactions, you can think of it a bit like a bank statement. If you go to https://blockchain.info/, you can see transactions occurring in real time.

Now someone needs to go and verify that all the transactions in that block are valid. People aren’t going to just do this for free, so there’s a reward given to the first person who

  • Validates the transactions
  • Bundles these transactions into a block (which will be the next block on the chain of blocks…i.e. the blockchain).
  • Adds a reference to the previous period’s block of validated transactions (which is what links the chain together)
  • And finally solves a computationally difficult puzzle.

The reward is a number of bitcoins – it’s about 12.5BTC at the moment. This activity is called Bitcoin Mining, and the people who do this are called miners.

Woah – I understand validating the transactions, bundling them, and adding a reference to the previous block so you have a determined sequence. But what was that about a computationally difficult puzzle – why’s that a thing miners have to do?

This stops people cheating – this is the bit that makes people trust the blockchain contains real, unmodified information.

This puzzle makes it quite difficult to generate a single genuine block of transactions (miners really have to earn their money). It’s maybe not immediately obvious, but this makes it almost impossibly difficult to pick a historical block and start to dishonestly alter its contents (maybe to re-use a token). If you tried to do that, you’d have to re-generate all the blocks created in the chain since the one you want to modify, at the same time as other miners are trying to create new blocks as fast as they can to earn money.

This diagram (from http://spectrum.ieee.org/computing/networks/the-future-of-the-web-looks-a-lot-like-bitcoin) explains it nicely – except I would have titled it “Why You Can’t Cheat at Blockchain”

07olbitcoinf2-1435160570777

So is this a bit of an issue we need to be careful of – people conflating Bitcoin and Blockchain?

Yeah – Blockchain is a technology, Bitcoin is an application of that technology.

I think I understand the distinction now. So a blockchain is like a database where you can only insert and read data, but not update or delete data?

Kind of, yes. Not exactly like that, but if that metaphor helps, sure.

And obviously in order to start researching the next block to insert it, you need to have a copy of the most up-to-date version of this database?

Yes – you can think of it in terms of pulling the latest version, but the way it actually works is that the person who successfully creates (or “mines”) the latest block broadcasts this over a peer-to-peer network, and other miners on the network can validate it add it to the end of their own chains.

So this publically accessible blockchain solves a problem for a cryptocurrency. But I still don’t get how this can be used somewhere else.

Let’s go back to the fundamental problem that blockchain solves – it solves a trust problem. It allows two parties who are guaranteed to act in their own self-interest to transact without needing a trusted financial intermediary, because the blockchain won’t allow a dishonest user to cheat.

Just to say it again – blockchain solves the trust problem. It doesn’t need to just be for financial transactions. Any market where you need to hire (and pay) a trusted intermediary in order to carry out a transaction could be a candidate to use blockchain to eliminate the need for that intermediary.

Like…buying a house?

Exactly like that. If the title deed to land you own was stored on the blockchain, then a purchaser wouldn’t need to hire a solicitor to verify that you really were the owner. They’d know you had the right to sell this asset because there’d be a vast public ledger showing your ownership. And after you sold this land, you couldn’t sell it again because there’s a record of the transaction transferring ownership from you – if you tried to replay the transaction, a miner would see this transaction as invalid and reject it from the block.

One use case being cited frequently is how this could be used to stop corruption – where officials might modify title deeds held in a government controlled land registry to lay claim to land which isn’t theirs. Their ability to modify those deeds gives them a chance erase a history of land ownership that they don’t like, and then claim “You have never owned this land, it has always belonged to me”. But if these deeds were on an incorruptible public blockchain, that history could not be erased. Blockchain used in this way can actually uphold the rule of law.

I can see why people are getting excited.

Brilliant. Can I say “disrupt” yet?

Yes, but don’t overuse it.

You wouldn’t like technology conferences if you don’t like the word “disrupt”.

Let’s define “disrupting an industry” as specifically meaning “eliminating the need for an intermediate”. For example:

  • eBay disrupted the high-street by allowing sellers and buyers to directly engage – you didn’t need a high-street shop.
  • Amazon’s Kindle disrupted the book manufacturing industry (and delivery network) because it allowed you to get a book without needing physical delivery of a paper asset – you didn’t need paper or a courier.

Blockchain is threatening to disrupt a lot of industries where intermediates are needed to establish trust.

For example – blockchain applications could disrupt the estate agency business by eliminating the need for solicitors to charge fees for title verification.

OK you’ve said disrupt enough now. So if this is such an obvious efficiency, why are we not seeing this happen?

Next time see a house you’d like to buy, imagine that the seller says to you, “it’s ok you don’t need a solicitor – my deeds are on the public blockchain”, how likely are you to hire a solicitor anyway? I’d say right now you’re 100% likely to hire a solicitor.

And there’s no real motivation to change this model in the UK – there’s not really a problem to solve. The registry of land ownership works well, solicitors work well, and when things go wrong there are well understood paths to compensate those who are affected. It’s not likely we’ll see a blockchain based land registry in the UK soon.

Right, so this is all a bit theoretical and not really something to pay attention to?

Well, that’s definitely not quite right. Let’s see how Sweden manage it, because they’re putting their land registry on blockchain and it’s going live this March.

http://www.coindesk.com/swedens-blockchain-land-registry-begin-testing-march/

And Dubai are even more ambitious – they aim to have all government documents on blockchain by 2020.

http://gulfbusiness.com/dubai-use-bitcoin-database-technology-government-documents-2020/

Closer to home, the Royal Mint are offering a product called RMG this year, which will have asset ownership tracked on blockchain.

http://www.royalmint.com/RMG

There are a bunch of other use cases with live solutions – such as preventing conflict diamonds or stolen items entering the market (https://www.everledger.io/), and document certification (https://stampery.com/).

Actually those are pretty serious examples. I first thought that all this blockchain stuff still seemed too theoretical, but it seems to be gathering pace in the real world.

You’re not the only one thinking that.

The blockchain expo had a lot of solicitors and insurance agents attending, and they were incredibly keen to understand how this disruption would affect them.

To help understand what they’re thinking, remember how disruption has been observed to work (from https://techcrunch.com/2014/01/19/uber-and-disruption/ ):

disruption-cycle-copy

  1. Incumbents think the new tech is too theoretical and dismiss it.
  2. Suddenly they see evidence of the new technology and new players muscling them out of their traditional markets.
  3. They panic and try to adapt, but they’ve missed the boat.
  4. They stay around for a while, but slowly become an anachronism.

Think of Blackberry if you want a good example of this happening recently.

So whereas some at the conference were asking about whether regulation would stop the new technology from getting a foothold, more were trying to find out if they could adapt now and be one of the new players who exploit the new technology.

There was a definite sense at the conference that the audience believed that we’re observing this classic disruption cycle in progress now. The unknown is just when that sudden collapse of the old order is going to happen. Action from serious players like Sweden and Dubai encourages the market to think it’s going to happen sooner rather than later.

More soon. I hope this was useful to anyone starting to get to grips with what blockchain is and how it can change the world – next time I’ll write about Ethereum, Regulation, Public and Private/Consortium Blockchains, and can blockchains go wrong.

Web Development

Benchmarking your webpages for responsiveness, speed and security

Everyone knows that a website needs to be responsive, fast and secure – but how are your sites being tested? Are you doing it first, or leaving it to your users?

My next few posts are going to be a bit different to the ones I’ve done previously – I’m going to suggest a few links that might help give you a shortcut to solving some common issues. In this post I’ll share some links that enable you to benchmark your webpages. It’s always better for you to find the kind of problems these sites highlight (because if you don’t find these problems first, then it means your users are suffering).

I’ve often found these kind of sites to be really useful – occasionally they’ll flag something I’ve forgotten or not thought about, and I’ve found them most helpful when I’m auditing someone else’s site for snags.

Responsive Behaviour

Google have created an application to which rates your application for how it responds on different device types (mobile, tablet, desktop).

https://testmysite.thinkwithgoogle.com/

screenshot.1483378770.png

‘Mobile First’ is more than just testing for responsiveness – ideally sites today should be built to be Progressive Web Apps. If you don’t know what a Progressive Web App is, then check out the Wikipedia entry for a Progressive Web App.

Google have created a plugin for their Chrome browser called “Lighthouse” – this will test your website to see if it meets the basic criteria of a progressive web app. This isn’t strictly a benchmarking site (although the plugin runs in a browser) – it’ll give you a score out of 100 for how your site rates against their best practices.

https://developers.google.com/web/updates/2016/12/lighthouse-dbw

screenshot-1483379397

Build for speed

There are a few really good benchmarking sites to allow you to see if there’s any immediate room for improvement on your pages. If you’ve forgotten to compress your JavaScript or CSS, or if you’re not gzip-ing your response stream, these sites will spot it.

PageSpeed from Google: https://developers.google.com/speed/pagespeed/insights/

screenshot.1483379585.png

GTmetrix: https://gtmetrix.com/

screenshot.1483379678.png

Pingdom: https://tools.pingdom.com/

screenshot.1483379761.png

What about CSS?

I hate to say it, but sometimes CSS is treated like a poor relation when it comes to page optimisation. Just because we’ve minified the CSS and gzip-ed the stream doesn’t mean we’ve optimised it – there’s often lots of CSS classes which aren’t used or even have errors – the links below help you see if your CSS is bloated or has errors.

Parse CSS gives a nice minimal assessment and summary of the styles available to the page being tested, and is really useful as it provides a preview of these styles. The site doesn’t make any judgement on whether the CSS is good or bad – but you might find that a vast amount of the styles available to you actually aren’t needed.

 

screenshot.1483380493.png

If you want to read more about how to use this information to improve your site, check out CSS Purge at http://www.csspurge.com/. This gives a good explanation of why CSS bloat is damaging your site performance, and how to improve it.

Security checks

I’ve covered some of this in a previous post, but I’ll include the benchmarking sites that I like here again for completeness.

SecurityHeaders.io – this is a simple interface which checks if your site’s headers could be tuned be more secure against attack. It really helpfully links to explanations of jargon, and explains why it matters in plain English.

https://securityheaders.io

screenshot-1483379947

Also, High Tech Bridge also provide a site to do a similar test.

https://www.htbridge.com/websec/

screenshot.1483379844.png

Wrapping Up

I hope these links and tools are useful – they’ll maybe give you a new way of looking at your site, and might point you in the direction of making it better.