Tony Marston's Blog About software development, PHP and OOP

Blockchain for Blockheads

Posted on 24th June 2018 by Tony Marston

Amended on 1st September 2018

Introduction
What is blockchain?
Aren't Bitcoin and Blockchain the same thing?
What are the main types of blockchain?
Can blockchain be used for more than financial transactions?
Will a blockchain database replace a relational database?
Will blockchain replace ERP applications?
Isn't the blockchain slow?
References
Amendment History
Comments

Introduction

Ever since I added blockchain capabilities into an ERP application (refer to Adding Blockchain to an ERP System for details) I have been monitoring the internet to see how others are dealing with this opportunity, and I am quite amazed at what I have read. Some think that blockchain is nothing but bitcoin, some don't understand how blockchain can be used outside the cryptocurrency field, some think that a blockchain database will replace the relational database, while others think that blockchain will totally replace an ERP system. This tells me that a lot of people are still in the dark about what blockchain is and how it can be used.

I recently had a conversation with someone from the academic world who thought that integrating blockchain into business applications such as ERP systems would involve nothing more than the transfer of financial data, and that conversation prompted me to write this article in the hope that I can shine a light into the darkness. I shall stick to high level facts and avoid the low level details.

What is blockchain?

Here is the most simplest of definitions that excludes any techy buzzwords:

Blockchain is a tamper-proof system for logging messages chronologically. A message sent to one node in a blockchain network will be replicated across all nodes in that network.

Here are some deeper explanations:

Aren't Bitcoin and Blockchain the same thing?

No. Bitcoin is an implementation of Blockchain, but it is not the only implementation. It would be like saying "chalk is a rock, therefore all rocks are chalk". Bitcoin, and all other crypto-currencies, are distinguished by the contents of the messages that they pass between nodes, such as "Take X amount of funds from account Y and put in into account Z".

There may be other implementations out there, but their capabilities will be limited by the structure of the messages that they send and receive.

What are the main types of blockchain?

Blockchains fall into two major categories:

Can blockchain be used for more than financial transactions?

Most certainly. A lot of people read the term distributed ledger in the description of blockchain and automatically associate the word "ledger" with an accounting system, which then leads them to believe that blockchain can only be used by accounting or financial systems. The correct term should be "distributed message store" as each node maintains its own copy of every message sent across that blockchain.

Notice that I did not use the term distributed database as the data store at each node is nowhere as sophisticated as a fully-fledged relational database (RDBMS). All it does is store packets of information without knowing the contents of each package.

Will a blockchain database replace a relational database?

Definitely not. A relational database holds data which is arranged into tables and columns with primary keys, unique keys, indexes and relationships. Its associated application allows particular pieces of information to be inserted, viewed and modified in sophisticated ways. A blockchain data store has no structure apart from a chain of blocks each of which holds a message. Each message holds a packet of data, but the structure of that data is unknown to the blockchain. It is therefore not possible to query the contents of a blockchain data store in the same way that you can query the contents of a relational database.

Will blockchain replace ERP applications?

Definitely not. ERP applications will continue to exist either with or without blockchain technology. However, if an organisation wishes to exchange information with other organisations it can utilise a blockchain in order to perform this exchange in a more secure manner. It can create a private blockchain, invite specific organisations to become nodes, then exchange information with those nodes sure in the knowledge that no-one can break into that blockchain and either read private messages or send bad messages of their own.

The type of information which can be exchanged is unlimited. The Multichain software allows messages of up to 64MB in size with no particular format, which means that I can send whatever data I want in whatever format I want. I can send text files or I can send binary files such as images, videos, spreadsheets or PDF documents. The GM-X ERP application has a relational database containing hundreds of tables coupled with thousands of web forms which allow an enormous volume and variety of data to be input, maintained and viewed. Each discrete set of data can be considered as an electronic document where each document, be it a Purchase Order, Sales Order, Shipment, Invoice or Inventory item, consists of data which is held in one or more records in one or more tables in that relational database. A relational database is infinitely customisable, therefore the number and type of electronic document that it may hold is also infinite.

The blockchain data store, on the other hand, is not infinitely customisable and it can only deal with things called messages. It has no concept of columns, tables and relationships, just packets of information known as messages. It is up to the external application to extract the data for a particular document, such as 'Purchase Order #27' or 'Invoice #301' or 'Shipment #1024', put that data into a single message, then send that message to the local blockchain software which will then send it to all the other nodes in the network.

If the message does not have a fixed structure then how can the receiving node possibly process it? The structure of each message is not known to the blockchain software, but it is (or should be) known to the external software which both constructs and deconstructs each message. The trick is to use a message format which can preserve the structure of the data as it resides in the application database with its tables, columns and relationships, so that when the data is deconstructed by the receiving node it is able to put that data into the correct columns of the correct tables in its own database. Fortunately such a format has existed for decades, and it is called XML. Although each XML document is a file containing human-readable text, it is possible to embed binary data into this text using a method of binary-to-text encoding. It is therefore possible for an XML document to contain an image as well as metadata which describes that image. That image could be a picture of an item, or a document that contains someone's signature. The possibilities are endless.

Isn't the blockchain slow?

Some people are under the illusion that all blockchains are limited to a throughput of just 7 transactions per second, which is rather slow. This is nothing but a myth which is answered in Is Blockchain's Capacity Limited To 7 Transactions per Second?

References

Amendment History

01 Sep 2018 Added Isn't the blockchain slow?

counter