0

I am trying to do document verification through blockchain. The way I'm trying to do this is by digitally signing a document, and storing its hash on the blockchain. Now I'm trying to create a feature for revoking a document. How can this be achieved? For example: if Bob has been issued a driving licence by the government which has put his licence on a public blockchain, but is caught drunk driving and the government decides to revoke his licence. what would be a way to achieve this functionality so that when someone queries his licence they see the signature as invalid? or is there a different method I can use to achieve the same functionality?

0

As I see it you can simply store some extra data along with the hash. At its simplest it could be a boolean representing whether the original document is still valid.

Here's a very simplified example:

pragma solidity ^0.5.5;

contract Revoke {

    mapping(string => bool) validities;

    function store(string memory hash) public {
        validities[hash] = true;
    }

    function revoke(string memory hash) public {
        validities[hash] = false;
    }

    function isValid(string memory hash) public view returns (bool) {
        return validities[hash];
    }
}
|improve this answer|||||
  • I had a similar idea at first but isn't the data on a blockchain supposed to be immutable? So, If I change this variable, would this not be a new transaction? so if someone checks the hash at the block, it will not change and the signature would still be valid and the change of variable would be on a different block. – Vardhan Gupta Mar 28 '19 at 16:55
  • Basically whenever someone checks the blockchain they check the latest block. Yes, all data is immutable so they can see the history if they want but the present state is what matters. That's one of the main ideas of blockchains. – Lauri Peltonen Mar 28 '19 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.