I have a very simple Solidity contract:

contract AccessManager {

    mapping(address => bool) public registry;

    function grantAccess(address assetAddr) {
        registry[assetAddr] = true;

    function isAuthorized(address assetAddr) constant returns (bool) {
        return registry[assetAddr];

Logic is simple: whenever I call grantAccess(...) method an address (passed as an method argument) has to be added to mapping with "true" value.

The problem is that this simple code does not work. After I send a transaction to execute grantAccess("0x.....") method, I call isAuthorized("0x....) method and it always returns "false". I've tried it with Chrome extension called "Sol" and with .NET Etherum API. The result is always same: isAuthorized(...) contract method returns "false" no matter what I do.

Here is how I call contact methods in Sol extension:

AccessManager Sol

I think the problem is in passing string as an address argument but I have another contract where I do a similar thing and it works just fine.

Did somebody experience similar issues?

  • Comments are not for extended discussion; this conversation has been moved to chat. :-)
    – Afr
    Aug 31 '16 at 18:40
  • I cannot reconstruct your issue. I copy pasted your exact code into ethereum.github.io/browser-solidity/#version=0.3.6 and can correctly set and get access rights (try, e.g. copy pasting the address of the contract itself and surround by "" to make sure you have a valid address).
    – SCBuergel
    Aug 31 '16 at 19:39
  • Hi Sebastian! We solved this issue already. The solution was described in comments. Unfortunately @5chdn moved all comments to chat and now this information "de facto" is deleted because nobody reads chats :D Long story short: this is a bug in chrome extension that is based on browser-solidity. It does not decode servers answer correctly. Latest version of browser-solidity does it correctly. Sep 2 '16 at 9:00
  • @VolodymyrUsarskyy Please don't place your answer in your question's post or comments (or chat :P). It's totally okay to answer your own question. This will help users in the future who may face the same problems. Thanks!
    – Afr
    Sep 2 '16 at 9:03
  • Actually, this wasn't a real solution to my problem. We've just discovered that Chrome extension contains a bug :) But I posted whole story as an answer, so everyone can see what was done. Thx! Sep 2 '16 at 9:27

Did you run your code locally or in memory(VM) or into the blockchain? I tried your code it seems working (0=false before granting access and 1=true after)

enter image description here

Try to add an event to your grantaccess function;

  event ev(bool is_granted)
  function grantAccess(address assetAddr) {
        registry[assetAddr] = true;
  • Hi Badr! Thx for your input. The issue was solved and the solution was described in comments. Unfortunately comments were moved to chat :( Long story short: I think, this is a bug in chrome extension that is based on browser-solidity. It does not decode servers answer correctly. Latest version of browser-solidity does it as expected. Event is present in original code and was fired as expected but "Sol" extension kept showing wrong results (which was really confusing). Sep 2 '16 at 9:04

As the comments that described the solution were moved to chat, and since that time already two people spent time on my (resolved) issue, I will write short summary of what happened as an answer.


  1. the problem was observed in "Sol" Chrome extension that is based on browser-solidity
  2. I was able to reproduce this bug only when working on private blockchain. In "local (virtual) blockchain" mode everything worked as expected.

Originally, my code contained event that was fired after grantAccess(...) contract method was called. As I never had any issues with "Sol" chrome extension, this gave me false impression that my changes were somehow rolled back after method execution was finished.

After @kobigurk tested my code in latest version of browser-solidity, it became obvious that the problem lies in "Sol" chrome extension and not in the contract itself. By some reason, "Sol" extension cannot correctly decode an answer received from the server and constantly shows default return value ("false" for bool type, "0" for uint). I tested same contract but with "uint" as return type from "grantAccess" method and always received "0". Which means that last byte is somehow ignored.

So, the solution is simple: clone latest "browser-solidity"s source code and use it instead of "Sol" chrome extension.

Thx everyone who spent time trying to help me!

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.