Blockchain as an Architectural Element
Blockchain is an intriguing new technology that builds upon well understood technologies to create a genuinely novel option for distributed data storage and processing. Crypto-currencies like Bitcoin, Ethereum and Litecoin are the best known applications of blockchain technology, but its impact seems likely to extend well beyond this rather narrow area.
A blockchain is a highly replicated peer-to-peer data storage system, which uses cryptographic security to allow the content of the storage to be verified as being correct and prevents any of the participants in the peer-to-peer network from changing the data once it is agreed between the participants (you would need more than half – 51% – of the participants to agree to change the data). The result is an append-only database, a copy of which is held at each participant node, and which allows the participants in the network to cooperate even if they don’t know each other’s real-world identities or trust each other very much.
The other interesting aspect of most blockchain implementations is the ability to store and run code in the blockchain – so called “smart contracts”. Smart contracts are provided by the blockchain implementation so the details vary (Hyperledger uses Go, Bitcoin uses a deliberately primitive stack based language, while Ethereum provides a rich but proprietary language called Solidity). The idea behind them all is the same though – a smart contract is triggered in response to a change in the data in the blockchain (normally a new transaction arriving) or by an external call, and the contract code executes simultaneously on all of the peer nodes in the network, normally reading some data from the blockchain and then writing new entries to the blockchain as its output. So it can do things like close contracts when values are exchanged, cancel contracts if conditions are not met, transfer assets between parties (such as payments) or keep track of the identity and ownership of something valuable (like a piece of art work).
While a fairly new technology, these features of the technology are already being used by a wide range of startups and larger firms, in applications as diverse as financial transaction processing (Epephyte, Nasdaq, Digital Asset Holdings), securities clearing (UBS, ASX), identity management (uport, Blockstack, Civic), public record keeping registers (Swedish Land Registry, Estonian health records, Delaware public archives) and the tracking and supply-chain lineage of valuable commodities like shipping containers, diamonds and fine art (Maersk, Ever Ledger and Provenance.org).
Of course, none of these powerful features come for free, there is always a tradeoff, and in the case of blockchain technology a big one is the unusual architectural characteristics that a blockchain brings with it.
One of the most important characteristics to bear in mind is the time it takes to achieve “consensus” for new entries being added to a blockchain. This makes the blockchain an eventually consistent database and “eventually” really can be quite a long time! The new block has to be copied across the blockchain network and verified by enough peers in the network for you to have confidence that it will be generally accepted. This process can take from seconds to many minutes depending on the blockchain and how busy it is. The speed of this process (and other technical constraints like blocksize) also limit the throughput of most blockchains to 10s of transactions per second, which limit the applications they can be used for (although there is a lot of work going on at present to remove this constraint).
It is also worth bearing in mind that while we often refer to a blockchain as a “database” it is really much more like a huge append-only log file, because it doesn’t have a query processor or a query language. The only way to get data out of a blockchain is to retrieve entries by their ID or to programmatically scan parts of the blockchain looking for specific entries. Quite a limitation if you want to find blockchain transactions (records) by some other criteria. The other aspect of blockchain that some new users find surprising is that everything written to the blockchain is publicly visible. This naturally follows from its peer-to-peer nature, but it means that you need to be careful what you write there – particularly given that it can never be changed due to the append-only nature of the technology!
Finally, blockchain technology is an emerging area and so it’s moving pretty fast. There is a lot going on and things are changing quickly, but today, things like developer tools, operational utilities and documentation are often quite immature and a degree of persistence and patience is required to develop applications that involve blockchain technology!
In summary Blockchain brings us some really interesting new options for distributed computing, and it looks like it is here to stay, so while using it can be quite difficult at first, this is a great time to learn more and work out how to apply blockchain to real problems.