I have a contract that holds hashes of files and different versions of those files inside a struct.

// Structure which holds information about an entry and the versions that entry contains.
struct Entry {
    mapping (uint8 => EntryVersion) hashVersions;

struct EntryVersion {
    bytes32 hash;
    bool published;


// objectIDs that map to entries.
mapping (uint => Entry) entryMap;

// Given a entry and a version, a hash of that entry is returned. 
function getEntry(uint entryID, uint8 version) public constant returns(bytes32 hashEntry, bool entryExists) {

    // If user doesn't have permissions, return blank and false.
    if ( !_hasPermissions() ) 
        return ("", false);

    // Fetch the current entry and its version hash.
    Entry currEntry = entryMap[entryID];

    // If entry and version were found return hash and true.
    return (currEntry.hashVersions[version].hash, currEntry.hashVersions[version].published);


When I deploy the contract from Remix, all goes well I get the entries correctly such as:

getEntry( 5,5 ) Value: "0x45323541374646313033463944314137354436313543383337423333323944390000000000000000000000000000000000000000000000000000000000000001" Decoded: bytes32 hashEntry:


bool entryExists:


But when I used GETH's Javascript console attached to parity, I get:

var sol_truebase = web3.eth.contract([{"constant":false,"inputs":[{"name":"entryID","type":"uint256"},{"name":"version","type":"uint8"},{"name":"entryHash","type":"bytes32"}],"name":"addEntry","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"_hasPermissions","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"entryID","type":"uint256"},{"name":"version","type":"uint8"}],"name":"getEntry","outputs":[{"name":"hashEntry","type":"bytes32"},{"name":"entryExists","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newAddress","type":"address"},{"name":"access","type":"bool"}],"name":"_setPermissions","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]);
var activeContract = sol_truebase.at("0x4c522cce483acd799617464083287eee2a31ea44")
["0x0000000000000000000000000000000000000000000000000000000000000000", false]

PS. This is on the Kovan Testnet, my block is up to date and I am used the archive pruning mode.

  • Could this because the account I'm calling from in GETH doesn't have permissions? If so, how do I change the caller account to the one with permissions? – Jacob Brown Jul 5 '17 at 20:02
  • I took away the permissions portion of the code and it works now. The question I have now is how do I change the default account caller in geth? – Jacob Brown Jul 5 '17 at 20:28

Your Answer

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

Browse other questions tagged or ask your own question.