Blockchain and open data: how could it work?
Stuart Harrison discusses the ODI Labs team’s foray into putting open data into a blockchain – and what would happen if they opened it up to miners
A rai stone in the village of Gachpar. Too large to move, these discs were used as currency, recorded in oral history, by the Yapese. Credit: Eric Guinther, CC BY-SA 3.0
If you work in the technology sector (which, if you’re reading this, you probably do), then you’ve most likely been swept up in a lot of hype and talk about blockchain. This immutable, distributed ledger technology will apparently change the world, allowing a revolutionised approach to share trading, smart contracts and provenance tracking, to name but a few things.
But what does this mean for open data? With 2016 just getting started, ODI Labs decided to use our first week back in the office to try to tease out the answers to this question.
Setting up a digital currency
Firstly, we needed to find a blockchain; not, as I should point out, the blockchain (which is the ledger that stores Bitcoin transactions) – we wanted something quick and dirty to experiment with, and we weren’t entirely convinced that storing data in the Bitcoin blockchain was the right solution.
We settled on Multichain, a Bitcoin-compatible blockchain, which builds on the main Bitcoin blockchain spec, but crucially adds support for things like metadata and custom assets, so we could mint our own digital currency.
We followed the detailed instructions and, within a morning, we were up and running, happily moving a new digital currency from one machine to another.
The next step was to build a Ruby client, which we found didn’t exist. As Multichain (and Bitcoin) exposes a JSON-RPC API, this was nice and easy. We also had some vague ideas that we might want to add some metadata that showed the state of a given URL at any time, so added in functionality for that too. You can see our code on GitHub and pull requests are, of course, welcome.
The blockchain meets the open data
So, we had a blockchain and a way of accessing that blockchain in a language we felt comfortable using, what next? After some thought, we cast our minds back to earlier last year, when Philip Potter from GDS wrote a fantastic blog post about guaranteeing the integrity of a register, describing technology that looked, for all intents and purposes, like a blockchain.
The example Philip used in this blog post was food safety inspections and, as I’ve got a long history in publishing and working with food safety data, we decided that we could use the existing open data to suck up the Food Standards Agency (FSA) ratings data and put it into our blockchain. That way, if people were unsure if a rating was genuine, they could look at our blockchain and see that it was the case. While a website can be hacked, and ratings altered, information on a blockchain cannot be deleted or altered, and can also be traced back to its originator.
We knocked up a quick script that uses the FSA API to get inspection data and import their premises ID into the blockchain, along with the inspection date and rating. The idea was to then run the script on a regular basis to get any new inspections.
The import seemed to work and we set out what we planned to do – put open data in a blockchain. But this raised more questions than answers.
Indexing, mining and the future of our blockchain
Firstly, how do we search for the correct record? At the moment, it seems like we have to go through each block in the chain and check the metadata. There are many solutions for searching and viewing the Bitcoin blockchain but these seem to just index the blockchain into a database that is better suited to the task of searching. How do you guarantee the integrity of that database?
Our blockchain currently only consists of two nodes, mining and sending fake currency to each other. The key to the integrity of blockchain technology is its decentralised nature. Once one person or organisation owns the majority of nodes in a blockchain network, this integrity breaks down.
Related to this, if we were to open up our blockchain to the wider public, how would we incentivise mining? With Bitcoin, once a miner adds new transactions to the blockchain, there is a fixed reward (currently 25 BTC, almost £7,500 in today’s exchange rate). As the size of the blockchain increases, so does the computational power required to add new blocks (a recent paper compared the electricity usage of the Bitcoin network to that of Ireland). As a result of this, and the rewards at stake, there are entire server farms devoted to Bitcoin mining.
Currently, our blockchain is a fraction of the size of the Bitcoin blockchain, and we might get a few well-intentioned people happy to mine for us for free. However, as the blockchain grows, mining will get harder, and the worthless currency our blockchain ‘rewards’ miners with won’t help miners cover the electricity bills the computation will end up costing them.
Obviously, this has been a pretty shallow dive into blockchain, looking at the art of the possible. We’re not ruling out blockchain technology yet, and in the coming weeks and months, we’ll be doing more detailed investigation, looking into alternative blockchain technologies like Ethereum, as well as smart contracts and the privacy implications of blockchain data storage. In the meantime, there may well be things we’ve missed or not considered. If that’s the case, please let us know in the comments.
This work was supported by Deutsche Bank and is part of ODI Labs’ work on data infrastructure. If you’re interested in supporting our R&D work on data infrastructure and blockchains, email [email protected].