EthereumThe concept of embargoing in the digital asset management world consists of making an item private until a particular point in time. There are various reasons for doing this. Maybe only select users are allowed to view the material for a particular amount of time; there may be a paywall, whereby only paying customers may view information for a specified amount of time before it is opened up for free access, perhaps there is questionable material not yet validated and requires further review before becoming accessible, or it may be simply necessary or desired to release a number of items on a particular date and time.

Embargoing can be easily implemented programmatically; store the date an item can be viewed publicly and simply check that date against the current date and time. If the embargo until date is earlier than the current date and time, then the item can be viewed.

The Ethereum’s smart contract programming language, Solidity, doesn’t provide any mechanisms for date manipulation but we can easily replicate this using an unsigned integer or uint. We can then specify the date we want to embargo an item until using a Unix time stamp then compare the Unix time stamp against Ethereum’s block.timestamp which gives us the number of seconds since the Unix Epoch.

Implementing the Embargo

Our EmbargoedItem smart contract is a special type of Item contract and so we want our EmbargoedItem to have all the functionality that the Item contract has:

contract EmbargoedItem is Item {
...
}

To keep the initial implementation as simple as possible, we are only embargoing the file (or in the case of our EmbargoedItem smart contract the hash of the file). To do this, we’re going to check whether an embargo applies and, if it does, ensure that the file hash cannot be retrieved. To do this we’re going to use a modifier:

    function isEmbargoed() public view returns (bool) {
        if (until < block.timestamp) {
            return false;
        }

        return true;
    }

    modifier embargoed() {
        require(isEmbargoed() == true);
        _;
    }

    function getFileHash() public view embargoed returns (string) {
        return super.getFileHash();
    }

The date the embargo applies until is set when the contract is deployed:

function EmbargoedItem(string _fileHash, uint _until) Item(_fileHash) public {
        until = _until;
}

We set the until date and then hand over the rest of the set up to the inherited Item contract (since our EmbargoedItem contract is simply a type of Item contract).

And that’s it. Our EmbargoedItem will now only allow access to the file hash when the embargoing time period is up.

Taking Embargo Further

Embargoing is a great way to restrict access to your archived items for various reasons and smart contracts are ideal for implementing these policies in an objective, unbiased way. So far we have explored time-based embargoing but other, rules-based embargoes could be applied, which might require a particular rule be met before an item can be publicly available. And now with blockchain oracles, embargo lifting could be automated so that, for example, when an oracle determines that an item does not breach any type of copyright, that it can be made publicly available.

There is one issue with our current embargo implementation; if an Ethereum node could be manipulated by a malicious party, there could be the potential to stop an embargo from ever being lifted by manipulating the block timestamp. Therefore, it would be ideal if the owner of the embargoed item could manually lift an embargo by editing the smart contract directly. This and other ownership concerns will be addressed as the Ethereum-based archiving contracts evolve.

Do NOT follow this link or you will be banned from the site!