Proof of existence, integrity, and ownership contract
Let's write a Solidity contract that can prove file ownership without revealing the actual file. It can prove that the file existed at a particular time and finally check for document integrity.
We will achieve proof of ownership by storing the hash of the file and the owner's name as pairs. We will achieve proof of existence by storing the hash of the file and the block timestamp as pairs. Finally, storing the hash itself proves the file integrity; that is, if the file was modified, then its hash will change and the contract won't be able to find any such file, therefore proving that the file was modified.
Here is the code for the smart contract to achieve all this:
contract Proof { struct FileDetails { uint timestamp; string owner; } mapping (string => FileDetails) files; event logFileAddedStatus(bool status, uint timestamp, string owner, string fileHash); //this is used to store the...