Ethereum Archive – Ownership

EthereumAn important aspect of any archive is ownership; who was the original creator of a particular piece of knowledge. Ownership is also an important part of Ethereum contracts, because whoever owns the contract is often the only one who can manipulate its data. This is especially important when an Ethereum contract stores value. For example, only the contract’s owner should be able to alter the number of tokens the contract manages and only the owner can transfer ownership if the contract can be exchanged.

The KnowledgeArc.Network ethereum-based archive should store information about the contract’s owner and should also manage the exchange of ownership if the need arises.

Before digging in deeper, all code is available on the KnowledgeArc.Network Github. Also, until this is marked as stable and the documentation says otherwise, keep all KnowledgeArc.Network Ethereum contracts on a testnet.

Implementing Ownership

Ethereum’s ecosystem has been developing for some time. There are now a number of third party libraries which deal with various aspects of smart contracts; tokens, maths functions, crowdsales and so on. These libraries are often well tested with many of the costly mistakes and bugs shaken out.

The Open Zeppelin contract library is a well-known repository of contracts, interfaces and libraries. Using Open Zeppelin (or similar) allows us to focus on solving real problems rather than deal with the intricacies of smart contract management.

One frequently used Open Zeppelin contract is Ownable. Ownable provides simple ownership management and verification. It can also handle the transfer of ownership to another wallet address. With Ownable, we can easily limit access to particular contract methods to the current owner.

import "";
import "";

contract Item is Ownable, RBACWithAdmin {

Firstly, there is an assumption that you understand how inheritance works, both in Ethereum and also as a feature of object-oriented programming in general.

Secondly, you’ll notice that we inherit both the Ownable contract, which now allows us to manage Item ownership, but that we have also implemented the role based access library, RBAC. We’ll get to this shortly.

So, with the Item contract inheriting Ownable, an item archived on Ethereum is now owned by a particular address and that address can transfer ownership to another if the need arises.

Role-based Access

The Open Zeppelin library also provides a number of role management contracts. This allows the contract’s owner (or other admins if authorized) to carry out specific functionality which is available externally but should not be executed by just anyone. For example, we probably only want to allow administrators to add or edit fields to our Item contract.

    function addField(string _name, string _value) onlyAdmin public {
        Field memory field = Field(_name, _value);

    function editField(string _name, string _value) onlyAdmin public {
        uint key = findFieldKeyByName(_name);

        Field memory field = Field(_name, _value);
        fields[key] = field;

Notice the onlyAdmin modifier? This will attach a requirement to both these methods that only addresses with admin access can call these two methods successfully. Anyone else who attempts to call them will fail.

Role-based access isn’t limited to administrators; we could add all kinds of roles, for example, an auditor role whose job it is to validate the data in the contract.

Further Thoughts

Ownership and access control opens up a number of new possibilities for our archiving contracts. For example, we could extend the ownership transfer to include a sale price, remunerating the seller for the knowledge they are releasing ownership of. We could also implement different types of role-based access so that multiple users could manipulate various parts of the contract, delegating responsibilities normally associated with the owner.

There may also be use cases where an archived item is owned by multiple owners, requiring some kind of multi-signature implementation.

Another use case may involve the owner relinquishing control after a particular amount of time. Maybe the owner can change the contents of the contract for the first 12 months of the contract’s existence, but, after 12 months has expired, the contract is locked up and made available, untouched, in the public domain for the rest of its life.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *