A blockchain distributed ledger as an API: Proof of concept

Edward Burton
6 min readDec 15, 2017

1. Introduction

My last post on A blockchain integrated API as the ultimate source of data generated a fantastic response. It is clearly a concept and an idea that interests many people, but there was also some very strong feedback from people that didn’t understand ‘why’ this use of technology could be useful; especially with relation to websites.

Ask me!
The chances of everyone losing their blockchain are slim. Consensus we can cover in another blog :)

There were also posters who took on the blockchain post in the spirit in which it was intended.

Very true

Given the interest in the topic I’ve expanded on the previous post and have built a proof of concept web platform.

2. What I have built:

I have built an Angular 5 application using a blockchain distributed ledger as its primary datasource (in fact apart from hard-code there is no other datasource for the site). The underlying blockchain is open to developers, meaning that anyone is capable of connecting to the blockchain, creating and stamping their passport and then using a unique transaction id (txid) to verify the data.

Every member of this blockchain has a copy of the same data and can verify that the information being used is not corrupted and accurate. I’ve built a simple ‘developer passport’ for people interested in blockchain. By connecting to my open chain, developers can display a date-stamped passport to prove that they have uploaded data to the blockchain. As they will have a unique TXID after uploading the data, they can always use this ID as a gateway to their passport. Then, they simply lookup the TXID and can show the passport as and when required (to employers etc).

The reason that this is an improvement on a traditional database is that we can be sure that the data in the blockchain cannot be altered or corrupted. So as blockchain development explodes (as is likely to happen in the next 1–3 years), this passport with its time-stamp can be used to show that the developer has been interested in the technology for a certain amount of time, and that the developer has a base competency.

Next year, when the developer is negotiating his/her 7 figure salary, there can be no real embellishment over the extent of their interest.

“I’ve been interested in blockchains since the very beginning, probably 2004”, says the dev.

“Well”, replies the interviewer, “according to our incorruptible data source you can only prove your interest as of 3 days ago.”

The value of blockchain is in its trustlessness, all have access to the data, so there can be no debate about the validity of the data. That’s why I’ve built a prototype to simply allow developers to stamp their ‘interest / base competency’ in blockchain. Once we have a blockchain of developers each adding their grain of information to the chain, we have a really valuable bank and reference of data far superior and more secure to a normal database.

You can see the simple prototype I’m hosting here: https://block.engineer/ I’m planning to expand on this in all sorts of ways over the coming months.

3. How do we build it:

  • Multichain.com software to build blockchain
  • Multichain node library integrated with a simple express.js server to communicate with the blockchain
  • Angular 5 as the front-end sending and receiving requests to the express server

Multichain.com provides a tool to easily create your blockchains and store JSON data within them. We use the tool at multichain.com to create our own private blockchain, then open up the permissions to allow new servers to connect to the blockchain. Each server could theoretically have its own permissions, user (and stamp) with the blockchain. However, for this simple prototype we are just using one stream, and allowing anyone to join the chain (an unusual use case for a private blockchain).

We use simple express.js servers using the multichain nodeJS library https://github.com/scoin/multichain-node to post and receive data from our blockchains. We can have a theoretically unlimited amount of ‘clients’ accessing and using the blockchain. Angular 5 is the frontend and in this example does some simple data validation before posting to the blockchain. I’ve put the Angular 5 application on github here:

https://github.com/Ejb503/block.engineer/tree/master/src/app

4. Under the hood

This is what a blockchain item looks like once it has been retrieved via our multichain-node library and imported into Angular 5.

It’s a blockchain! But it’s a JSON. I love it…

The confusing jargon of blockchain can now be easily accessible via JSONs. These screenshots will be familiar to many web developers, which is why we are in exciting times as the bridge between blockchain and web has never been so short.

5. The mechanics

To join the blockchain it is really as simple as:

  1. Downloading multichain and following instructions here:

https://www.multichain.com/developers/multichain-2-0-preview-releases/

2. Using this command to connect to the node:

multichaind engineer@172.31.19.118:2903 -daemon

3. Inputting your wallet address here on https://block.engineer/:

4. Posting your JSON to stream ‘engineers’ on the blockchain using multichain-node library (or the library of your choice).

5. Looking up the txid for your post here on https://block.engineer/:

You now have your blockchain passport living immortally in https://block.engineer, and when you talk to that hiring manager in 5 years, you can prove trustlessly that you really really were interested in blockchain from the beginning.

6. Technical walkthrough

All the code for the angular app is available on github. I’m going to write up a technical walkthrough / point by point guide to join the chain shortly, so if you might be interested in that please let me know in the comments. If you are going to be brave and try to post to the chain without the walkthrough, for the passport to show up on the front end your data structure will have to be as follows:

{
data : {
json : {
'exp_block' : '6 months',
'exp_dev' : '7 years',
'location' : 'Valencia, Spain',
'linkedIn' : 'https://www.linkedin.com/in/edjburton/',
'contact' : 'ejb503@gmail.com',
'forHire' : true
}
},
keys : ['YOUR NAME'], // need this to link up data later
};

** Further Reading **

I strongly recommend anyone looking to get more of an understanding on this topic to read the following presentation by Dr Gideon Greenspan who is the founder of multichain.com, the software I have used to build this blockchain: https://www.slideshare.net/coinspark/understanding-private-blockchains

COVID-19 Blockchain response ->

In these difficult times we’ve published a POC system for a blockchain distributed system to provide data feeds and implement a traffic light system, follow the blogs here: https://medium.com/@ed_burton/a-blockchain-covid-response-system-poc-889d9b74786e

--

--