Building the backend services

We need to build backend services that our frontend can access to write the hashes to the Fabric blockchain and read the hashes from the Fabric blockchain.

We'll be creating the Node.js utility using and building the following services:

  • /api/hashwrite: This endpoint exposes a service that is used for calculating the hash of all the artifacts in a directory root, the hash of the file path of all the artifacts, and the hash of the modified timestamp of all the artifacts then submitting them to the blockchain.
  • /api/hashread: This endpoint exposes a service that is used for re-calculating the hash of all the artifacts in a directory root, the hash of the file path of all the artifacts, and the hash of the modified timestamp of all the artifacts then verifying whether they match the hash values recorded in the blockchain. If there is a mismatch, then it indicates that one or more documents have been tampered with.

Let's start writing our Node.js utility.

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

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