Storing Data on Blockchain

Though we are experiencing crypto winter at the moment, with major coins devalued more than 80% in 2018, the underlying blockchain technology is still exciting. The blockchain provides a democratized trust, distributed and validation protocol that has already disrupted banking and financial services and is on the verge of overhauling other industries like healthcare, supply chain, HR and more.

Despite the hype and its promising future, blockchain still has its shortcomings, the issue of data storage is one of them. The transactions based on the POW consensus for bitcoin, Ethereum, and other cryptocurrencies are extremely slow and therefore not suitable for storage of large data. For example, the deployment of dApp Cryptokitties nearly crippled the Ethereum network

The main problem of storing data on a blockchain is the limitation of the amount of data we can store because of its protocol and the high transaction costs. As a matter of fact, a block in blockchain can store data from a few kilobytes to maybe a few megabytes. For example, the block size of the Bitcoin is only 1Mb. The block size limitation has a serious impact on the scalability of most cryptocurrencies and the bitcoin community is debating whether to increase the block size.

Another issue is the high cost of the transactions. Why is storing data on the blockchain so expensive? It is because the data has to be stored by every full node on the blockchain network. When storing data on the blockchain, we do pay the base price for the transaction itself plus an amount per byte we want to store. If smart contracts are involved, we also pay for the execution time of the smart contract. This is why even storing kilobytes of data on the blockchain can cost you a fortune.

Therefore, it is not viable to store large data files like images and videos on the blockchain. Is there a possible solution to solve the storage issue? Yes, there are quite a few solutions but the most promising one is IPFS.

What is IPFS?

IPFS or Interplanetary File System is an innovative open-source project created by the developers at Protocol Labs. It is a peer-to-peer filesharing system that aims to change the way information is distributed across a wide area network. IPFS has innovated some communication protocols and distributed systems and combine them to produce a unique file-sharing system.

The current HTTP client-server protocol is location-based addressing which faces some serious drawbacks. First of all, location-based addressing consumes a huge amount of bandwidth, and thus costs us a lot of money and time. On top of that, HTTP downloads a file from a single server at a time, which can be slow if the file is big. In addition, it faces single-point of failure. If the webserver is down or being hacked, you will encounter 404 Not Found error. Besides that, it also allows for powerful entities like the governments to block access to certain locations.

On the other hand, IPFS is a content-based addressing system. It is a decentralized way of storing files, similar to BitTorrent. In the IPFS network, every node stores a collection of hashed files. The user can refer to the files by their hashes. The process of storing a file on IPFS is by uploading the file to IPFS, store the file in the working directory, generate a hash for the file and his file will be available on the IPFS network. A user who wants to retrieve any of those files simply needs to call the hash of the file he or she wants. IPFS then search all the nodes in the network and deliver the file to the user when it is found.

IPFS will overcome the aforementioned HTTP weaknesses. As files are stored on the decentralized IPFS network, if a node is down, the files are still available on other nodes, therefore there is no single point of failure. Data transfer will be cheaper and faster as you can get the files from the nearest node. On top of that, it is almost impossible for the powerful entities to block access to the files as the network is decentralized.

The following figure shows the difference between the centralized client-server protocol(HTTP) and the peer-to-peer IPFS protocol.


 [Source: https://www.maxcdn.com/one/visual-glossary/interplanetary-file-system/]

Blockchain and IPFS

IPFS is the perfect match for the blockchain. As I have mentioned, the blockchain is inefficient in storing large amounts of data in a block because all the hashes need to be calculated and verified to preserve the integrity of the blockchain. Therefore, instead of storing data on the blockchain, we simply store the hash of the IPFS file. In this way, we only need to store a small amount of data that is required on the blockchain but get to enjoy the file storage and decentralized peer-to-peer properties of IPFS.

One of the real-world use cases of blockchain and IPFS is Nebulis. It is a new project exploring the concept of a distributed DNS that supposedly never fails under an overwhelming access request. Nebulis uses the Ethereum blockchain and the Interplanetary Filesystem (IPFS), a distributed alternative to HTTP, to register and resolve domain names. We shall see more integration of Blockchain and IPFS in the future.

References

Building the blockchain using JavaScript

The blockchain is a data structure that comprises blocks of data that are chained together using a cryptographic hash. In this article, we shall attempt to build a blockchain prototype using JavaScript. This is a bit technical for non-technical people but should be a piece of cake for computer nerds.

First of all, let’s examine the content of a block. A block consists mainly of the block header containing metadata and a list of transactions appended to the block header. The metadata includes the hash of the previous block, the hash of the block, timestamp, nonce, difficulty and block height. For more information, please refer to my earlier article Blockchain in a Nutshell.

Prior to writing the code, you need to install the following software:

  • Chocolatey
  • Visual Studio Code
  • node.js

The installations are based on Windows 10, but you can do the the same thing easily in Ubuntu. Chocolatey is a software management solution for Windows, Visual Studio Code is a streamlined code editor with support for development operations like debugging, task running and version control and Node.js is an open source server environment.

Let’s start writing the code using Visual Studio Code. The first line is

const SHA256 = require("crypto-js/sha256");

This code meas we are using the JavaScript library of crypto standards. We require the crypto-js library because the sha256 hash function is not available in JavaScript.The crypto module provides cryptographic functionality.

SHA-256 is a cryptographic hash algorithm. A cryptographic hash is a kind of ‘signature’ for a text or a data file. SHA-256 generates an unique 256-bit signature for a text.  SHA256 is always 256 bits long, equivalent to 32 bytes, or 64 bytes in an hexadecimal string format. In blockchain hash, we use hexadecimal string format, so it is 64 characters in length.

Next, we create the block using the following scripts:

class Block {
   constructor(index, timestamp, data, previousHash = '') {
       this.index = index;
       this.previousHash = previousHash;
       this.timestamp = timestamp;
       this.data = data;
       this.hash = this.calculateHash();
   }

The class Block comprises a constructor that initializes the properties of the block. Each block is given an index that tells us at what position the block sits on the chain. We also include a timestamp, some data to store in the block, the hash of the block and the hash of the previous block.

We also need to write a function calculateHash() that creates the hash, as follows:

 calculateHash() {
       return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();
   }
}

Finally, we write the script that creates the blockchain, as follows:

class Blockchain{
   constructor() {
       this.chain = [this.createGenesisBlock()];
   }

   createGenesisBlock() {
       return new Block(0, "01/01/2017", "Genesis block", "0");
   }

   getLatestBlock() {
       return this.chain[this.chain.length - 1];
   }

   addBlock(newBlock) {
       newBlock.previousHash = this.getLatestBlock().hash;
       newBlock.hash = newBlock.calculateHash();
       this.chain.push(newBlock);
   }
   

Notice that the class blockchain comprises a constructor that consists of a few functions, createGenesisBlock(),  getLatestBlock() and  addBlock(newBlock).

Save the file as myblkchain.js or any name you like.

Now, execute the file in the VS terminal using the following command

node myblkchain.js

The output is as follows:

Let’ examine the output. Notice that each block comprises the properties index, previous hash, data and hash.

The index for the Genesis is always 0 . Notice that the hash of the genesis block and the previous hash of the second block are the same. It is the same for other blocks.

References

HR Blockchain Use Cases

Blockchain is not just about cryptocurrencies but it can be applied in businesses. In this article, we shall explore its application in human resource management. HR Blockchain use cases have started to emerge and have the potential to disrupt traditional HR systems. Among them are ChronoBank.io, PEACOUNTS,and bitWAGE 

Let’s examine each one of them.

ChronoBank.io

This is an HR blockchain platform designed to improve the recruitment process as well as payroll. It claimed that it will disrupt the HR industry similar to how Uber has disrupted the taxi industry.

ChronoBank ecosystem comprises a hiring platform(LaborX), a decentralized exchange(TimeX), a multi-signature wallet(Chronowallet) and a cryptocurrency that is pegged to labor hours(Labor Hour token).

LaborX is their flagship global hiring platform that connects candidates to the companies. It features an industry first immutable reputation system and a crypto payment system based on smart contract. The reputation system allows faster screening of candidates therefore save time and cost in hiring the right candidates. In addition, the crypto payment system enables candidates to get paid on time.

Furthermore, it plans to use a stable coin as the crypto payment to eliminate volatility common in most cryptocurrencies. This coin is known as Labour-Hour tokens. These tokens are linked to average hourly wages in the host country and are backed by a real labor force from big recruitment and labor-hire companies. Labor is considered a tradeable resource so ChronoBank will tokenise this resource into the LH-Tokens.

PeaCounts

PeaCounts is a blockchain-based payroll system. PeaCounts claimed that their payroll system will revolutionize the way employees are paid by using blockchain to remove the trust-based elements of the payroll process. It ensures the employees will get paid as soon as the work is completed. On the other hand, the employer will pay just for the work completed.

It features a smart contract that can track an employee location and time spent on certain tasks. It also holds the PEA Tokens and release them to the employee upon completion of the tasks. This system ensures that the employee gets paid efficiently and fairly.

The PeaCount payroll system is a private blockchain created as a fork off the Bitcoin. It also implements the zk-Snarks protocol and a multi-access wallet to ensure security in payroll transactions.

bitWage

bitWage is a payroll and HR services platform designed for the digital age. Basically it is a global outsourcing platform that serves the freelancers who wish to seek jobs worldwide and employers who wish to hire remote workers .

The bitWage payroll system allows employers to pay their remote employees rapidly with low transactions. The employees have the option to receive their wages and salaries in any of twenty four fiat currencies, four cryptocurrencies , and four precious metals.

References

HR Digital Transformation-powered by Blockchain

Human resource management has undergone tremendous changes in recent years particularly with regards to digitalization of human resource.  The emergence of blockchain technology could further transform the world of HR. 

According to Griffiths(cited in Gale, 2018), blockchain has the potential to streamline a lot of inefficient work related to employee data verification. Blockchain can store a candidate education, certifications and work history in a single ledger, therefore it would take just minutes rather than days to verify the data. Besides that,  the data cannot be modified or hacked once they are stored in the blockchain, thus guarantee data security and trustworthiness.

In addition, blockchain has the potential impact on HR by allowing personal data to be owned by the individual rather than the organization(Mike, cited in Gale 2018).  Consequently, every employee could maintain control over their entire employment data,  including educational background, training, and work history. It also means that an individual work identity is more portable, it moves with the individual rather than stuck inside the former organization when an employee changes job.  

Besides that, blockchain could disrupt conventional HR processes with respect to financial transactions.  Blockchain could streamline payroll function significantly by allowing automated and direct payment based on smart contarcts,  without the need of a  third party such as a bank or other intermediaries. 

Recently,  PWC (2018)has identified a few areas where we can apply the blockchain technology in HR. The areas include talent sourcing and management, targeting productivity gains, cross-border payment and mobility and Fraud prevention, and cybersecurity and data protection.

Talent sourcing and management

Blockchain could have a major impact on talent sourcing and management. It allows employees to maintain and control access to a comprehensive, trustworthy blockchain-based record of their education, skills, training and workplace performance. By providing potential employers with access to their blockchain-based employment data,  companies would be able to match individuals to roles much more accurately and effectively.

Targeting productivity gains

Blockchain has the ability to better match people’s skills and performance to jobs.  Finding and recruiting the right talent is always problematic for business organizations, therefore by helping them do this more effectively and efficiently will surely boost their productivity. Besides that, blockchain can help to reduce the burden of data-intensive processes like payroll and VAT ,  allowing companies to focus more on  their core businesses.

Cross-border payments and mobility

Multinational companies could create their own blockchain-based corporate cryptocurrencies that they can use for cross-border payment across their global supply chains, without the need of third-parties for settlement and reconciliation. In the future, central banks may legalize this type of cryptocurrency and support convertibility into fiat currencies. In addition, blockchain could facilitate employees mobility across the border with respect to payroll adjustment, international expenses, and taxes.

Fraud prevention, cybersecurity and data protection

HR department usually needs to handle high-volume financial transactions and sensitive personal data,  therefore it is utmost important to prevent frauds as well as to safeguard the data. This is the area where blockchain could be extremely useful. Blockchain’s use of consensus to authenticate data can help to eliminate frauds.

Another issue that blockchain can help to overcome is cyber threats. Many SMEs are ill-prepared for cyber attacks and the results could be detrimental to their businesses. Blockchain could help ensure cybersecurity as the data are immutable and tamper-proof because it uses SHA-256 hashing cryptography.  

References

Creating a Self-Sustaining School Ecosystem with Blockchain

Abstract

The current school system is too structured, rigid, and inhibits creativity. The current school curriculum inadequately prepares the students to survive the fast-changing world of the 21st century. While schools need to comply with the national education policy to teach designated subjects, schools should include other programs that could help to resolve the aforementioned issue. Therefore, our school proposes building an ecosystem using blockchain technology where students can freely create and share their contents. We believe that the blockchain ecosystem will nurture young children in developing creative minds and entrepreneurial skills.

I have written this white paper for a hypothetical blockchain project. This blockchain project is to build a private blockchain ecosystem for an international school. 

First, we need to conduct a feasibility study before we start planning any blockchain project. Here, I am using a methodology called the CATWOE analysis. It can be applied to any new project.

CATWOE Analysis of  Building a Blockchain School

CATWOE is an acronym that stands for Customers – Actors – Transformation process – Worldview – Owners – Environmental constraints. It’s a simple analytical approach to find solutions to problems. The CATWOE Analysis makes it possible to identify problem areas, look at what an organization wants to achieve, and which solutions can influence the stakeholders. The analysis uses thought methodology from multiple perspectives. It is especially useful for an organization that wants to implement a new project that involves a drastic transformation process. The implementation of the blockchain technologies in a school curriculum qualifies for such transformation. Therefore, there is a need to understand the problems and try to find solutions before we proceed with the project implementation

C – Clients

They are the users and stakeholders of a system. In this case, they are the students, teachers, parents, the management staff, the education department, and others. They will benefit if the change is positive and the problems are solved. However, they may stand to lose or suffer if the change is negative and new problems are created. Therefore, we need to find out whether the blockchain technologies can solve current problems and bring positive changes in the school system. If the outcome could be negative or even damaging, we need to abort the project.

A-Actors

They are usually the employees within an organization, in this case, teachers and support staff. They are responsible for carrying out work and involved with the implementation of the blockchain system. Therefore, we need to conduct an inventory analysis to know their qualities, capabilities, and interests to get a clear picture of their impact on the organization. We may need to hire new employees or retrain the current ones to ensure competency with respect to blockchain implementation. We also need to conduct training for the employees.

T – Transformation Process

Transformation is the change that a system or process leads to. It’s the process in which input (including raw materials, man-hours, knowledge) is transformed by an organization into output (such as a final product or solution to a problem).

To implement the blockchain system, we need to know in advance what kinds of input requires and forecast what the end result (output) will be. Besides that,  we have to carefully consider the intermediate steps. In this case, the input is the blockchain technologies and the output could be a system that churns out an intelligent pool of young entrepreneurs that thrive on co-creating and co-sharing.

W – Worldview

Stakeholders often have different ideas and approaches to the same issue, with other conflicting interests. The goal of the CATWOE analysis is to make their different viewpoint explicit and try to achieve a methodology stand. In this project, we need to achieve consensus among the stakeholders that involve the students themselves, we don’t want to force the ideas on them. Besides that, some teachers might have fear in carrying out the transformation as they have to learn new technologies. Parents would be very concern about the implementation of the blockchain technologies because it will bring profound impacts on their children, either positively or negatively.

In addition, the government might want to regulate the project to ensure it complies with the national education policies and philosophies. On the other hand, business leaders may want to look for financial gains by sponsoring the project or they may refuse to support the project at all. Therefore, there is an urgent need to conduct surveys and research to figure out how to secure agreement from most stakeholders to implement the project.

O – Owners

This usually refers to the owner, entrepreneur or investor of an organisation, who wants to make changes and who decides whether a project should start or stop. As decision makers, they have the highest authorities.  Commitment and support from the aforementioned parties are important to ensure successful implementation of the blockchain project and also long term sustainability of the project.

E – Environmental Constraints

This is the actual environmental elements that may influence the organization and can limit or restrict the implementation of the blockchain technologies in the school system. Examples include political influence, ethical boundaries, regulations from the government, financial constraints and social factors. There is a need to work closely to overcome the constraints via negotiations and other means with the regulators and other parties

After conducted the CATWOE analysis, I have identified the following problems where most schools are facing.

Problems

  • The Current school system is too structured and too rigid, inhibiting creativity
  • The Curriculum methodology too centered on academics and examinations
  • Teacher-centered, lack of peer learning
  • The Administration is centralized and autocratic
  • Does not prepare children for the future
  • Lack of participation from stakeholders

The proposed solution

  • Create a self-perpetuating and self-sustaining ecosystem where students can create and share digital content. It can also include tangible things like arts and craft, scientific inventions, or intangible things like music, song, new ideas, games, and so on. These tangible assets can be digitized and shared among the students.
  • Not only they can share digital content, but they can also buy and sell them. It is akin to an autonomous economic system where students can self-fund their projects by trading their digital assets.
  • The latest technology that can power this system is blockchain, a subset of decentralized ledger technologies.
  • The ecosystem should be enlarged to include the actors of the system – the teachers, coaches, supporting staff and the administrators.
  • The ecosystem must also be connected to stakeholders, including the business owners (who can provide financial support and sponsorship), the government (who may want to regulate the activities in the system), parents (who are concerned with their children development), etc.
  • The ecosystem can be extended to include students from around the world in the future.

† The Architecture

  • Create a permissioned private blockchain platform for the students. The students can interact freely in their own close-loop decentralized and distributed ecosystem.
  • Content or assets can be created and tokenized and shared among the students. They can trade their assets using the tokens, creating a token economic system.
  • Develop APIs so that the stakeholders can interact with the blockchain. Administrators and teachers should be allowed to monitor and delete certain contents that are inappropriate like pornographic materials etc via the API. On the other hand, parents can monitor their children progress but may not be allowed to delete the contents or add comments. In addition, business owners and investors can monitor the progress of the project and provide support and advice if necessary (for example if the system crashed or stalled). In addition, regulators might want to monitor the blockchain for compliance.
  • Proposed using Ethereum Proof of Authority(PoA) protocol known as Clique. The benefits of using PoA are as follows:
    • Saves electricity power
    • Eliminates the need to invest into large numbers of ‘Miners’ servers
    • Increase the transaction speed tremendous compared to Proof-of-Work(PoW)
    • Better security since only members can access the network
  • The ecosystem can be hosted on a cloud server like AWS and Microsoft Azure but you can set up your own servers.  The conceptual model is illustrated in the figure below:

The Legal Framework

Obviously transforming a school into a blockchain school needs to obtain approval from the Ministry of Education. It has to comply with national education policies. Therefore, we need to design the blockchain platform as a new approach in teaching and learning, keeping content within the requirements of the curriculum imposed by the MOE.

**You may use my ideas to write a paper if you are embarking on a similar project, but prior consent from me is necessary.