Writing a backend service for securing a directory by recording hashes in the blockchain

The /api/hashwrite service performs the very important task of calculating the hash of each individual file in a directory, the hash of the last modified time of all the files in the directory, and the hash of the file tree of the directory, and then storing them in the blockchain. It takes the directory path as an input parameter.

The following are the steps that are carried out by the service:

  1. Extract the directory path to be secured from the request body.
  2. Call the walkDir function to list all the files in the directory.
  3. Iterate through all the files in the directory, calculate the hash for each file, and call the bWrite method to write the hash to ...

Get Blockchain Development for Finance Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.