Connected Data Store : Create a Connected Data Store : Create and implement a data structure similar to a blockchain based on the below requirements.
- Each data store object should have:
- Index: Unique identifier for the object.
- Data: Maximum of 1024 bytes of characters.
- Prev Hash: Hash of the previous data store object.
- Current Hash: Hash generated based on cryptographic algorithm using Index, Data, and Prev Hash.
- The first block should have 0000 as the Prev Hash.
- Define the data store object structure with the specified properties.
- Implement a method to generate the hash of a data store object based on the cryptographic algorithm and input parameters.
- Create the initial block with 0000 as the Prev Hash.
- A data store object is considered correct if its hash follows a specified pattern (e.g., first 4 digits are zero).
- Addition of a Correction Value field in the object.
- The Correction Value should be calculated in such a way that when combined with other fields, it produces a hash with the specified pattern.
- Ability to find a particular object's Correction Value.
- Update the object's hash based on the new Correction Value.
- Updating any field in a data store object should trigger a recalculation of the hash.
- Recalculation should propagate to further connected data store objects.
- Add a Correction Value field to the data store object.
- Implement a method to calculate the Correction Value for an object to meet the specified hash pattern.
- Update the hash of the object based on the new Correction Value.
- Implement a function to find a particular object's Correction Value and update its hash.
- Ensure that updating any field triggers hash recalculation and cascades to connected data store objects.
The solution can be created on any tech stack. Create a fork of this repository and build your solution on the fork and share the forked repository address over email in the stipulated time.