I wonder, is it possible to create Access Control List and change user rights by smart-contract in private blockchain? Can I set up the security policy by smart-contract?


Yes of course you can. By using modifiers and heavily using msg.sender a strong ACL can be set up. Example is

pragma solidity ^0.4.0;
contract SecondaryContract {
    bool public contractStatus = false;
    address public adminAddress;
    mapping (address => ACL) listOfAccountsWithCustomACL;
    struct ACL {
      string name;
      string somePermissions;

    function SecondaryContract() {
      adminAddress = msg.sender;
      contractStatus = true;

    // Modifier functions to set up first layer of ACL
    modifier onlyBy(address _account){
       if (msg.sender != _account) throw;

   modifier onlyIfActive() {
     if (contractStatus) throw;

   modifier onlyByCreator(){
      if (msg.sender != adminAddress) throw;

   modifier onlyAfter(uint _time) {
      if (now < _time) throw;

   modifier onlyBefore(uint _time) {
     if (now > _time) throw;
    function Foo() onlyBy(someTrustAddress){
      // Can be called by a list of addresses specified

    function Bar() onlyByCreator(){
      // Can be called ONLY by the person that initialized this contract

    function Zam() onlyIfActive() {
      // Can only be called in the contractStatus is true

    // Deactivates the contract which prevents Zam from being called
    // Only the origin creator of the smart contract can call this
    function deactivateContract() onlyByCreator {
      contractStatus = false;

In this msg.sender can belong to an account of a person holding a public private key pair or even a different smart contract itself that may have own ACL

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.