Tamper-proof document storage using blockchain 

The consensus algorithm of blockchains makes it virtually impossible to alter any data once it is stored in the blockchain. The consensus algorithm of a blockchain is an elaborate mechanism that ensures that the data captured on all the nodes in the blockchain network (the participating computers or servers that store a copy of the blockchain ledger) is uniform. This means that the data stored on each node, as well as the sequence in which the data is organized, is the same throughout all the nodes in the network.

This also means that once data is written or captured in a blockchain, it is virtually immutable—that is, it cannot be modified as long as the blockchain network remains unchanged. If the recorded data on one of the nodes is altered, the consensus algorithm prevents the altered data from being written to the other nodes in the network, thereby maintaining the original data.

We will be using this property of blockchains to build a tamper-proof document management system. We'll build a software utility that captures and stores the following details in a private Hyperledger Fabric network:

  • The hash of each document in our document management system (document hash)
  • The hash of the file tree diagram of the entire document management system (file tree hash (FTH))
  • The hash of the last modified time (MTH) of all the documents we are monitoring

The utility will calculate the FTH and the last modified time hash (MTH) for our document storage system every 5 seconds. It'll then check whether the FTH and the last MTH match the original entry that was stored in the blockchain. If there is a mismatch, it means that one or more documents in our document storage have been modified, added, or removed. The utility will then throw a notification to the user. It will also calculate and validate the hash of each individual file in our document storage to identify the tampered files and display these to the user.

To build our utility and integrate it with the blockchain, we'll go through the following steps:

  1. Bring the Hyperledger Fabric sample first network online to create a test development network
  2. Deploy the chaincode DocsApp with the methods to capture and retrieve individual document hashes, the FTH, and the MTH, to and from the blockchain network. A chaincode is essentially the Hyperledger Fabric equivalent of a smart contract.
  3. Create a backend server in  Node.js that will use the Hyperledger Fabric SDK to make requests to the DocsApp chaincode to write new hash signatures and retrieve already written hash signatures.
  4. Create a DocsApp frontend in React that will allow the user to submit the directory path that is to be secured using the utility. This frontend will notify the user of the current status of the documents (tampered/not tampered) that are being captured using the utility. 

Broadly, our project will contain the following components:

  • The Hyperledger Fabric private network: We'll be using the default fabric first-network sample. It will contain the organizations,  org1 and org2. Each organization has two peers, peer0 and peer1. It also contains the orderer organization, orderer. The network will be using the solo consensus mechanism. The solo consensus mechanism runs a single orderer node that orders transactions. In an enterprise setup, you would probably want to spread the nodes across several departments and subdepartments in order to preserve their data.
  • The backend utility: This is used to calculate hashes, submit hashes to the blockchain ledger, and check hashes that have already been recorded to the blockchain.
  • React frontend: This allows the user to select a directory that will be protected and view the current status of the files that are being monitored by the application.

Let's start by setting up our Hyperledger Fabric network.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.187.233