I have a function that can retrive all data and one for retrive only not readed data. On Remix with JavaScrpit VM it's work, but on Remix with my private blockchain linked with web3 provider the function for the not readed data not work. Here the data struct:

    //defines a struct "Data"
struct Data {
    bytes32 id;
    string name;
    string otherInfo;
    uint sensorData;
    uint permission; 
    uint date;
    bool read;

The value read is correctly updated but the returned value is: - Photo

Here the function code:

/// @notice gets the unique ids of all pending data
/// @return an array of unique data ids
function getPendinData(address x) public returns (bytes32[] memory) {
    uint count = 0;  
    bytes32[] memory output;

    //get count of pending data  
    for (uint i = 0; i < data.length; i++) {
        if (data[i].read==false && rbac.hasRole(x,data[i].permission))  

    if (count > 0) {
        //collect up all the pending data and set read
        output = new bytes32[](count); 
        uint index = 0;
        for (uint i=0; i<data.length; i++) {
            if (data[i].read==false  && rbac.hasRole(x,data[i].permission) ) {
                data[i].read = true;
                output[index] = data[i].id;
        return output; 

        output = new bytes32[](0);
        return output;

The rbac is an entity for manage data access and it's correctly "linked" with this contract and tested (I've posted another question).

  • 1
    The returned value of a function which modifies the state can be fetched directly from the function call, only when it is called on-chain (i.e., from another function in this contract or in another contract). When called off-chain, what you get in return is a hash of the transaction. – goodvibration Apr 17 at 13:44

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.