0

I created a solidity file which store all details in blockchain(ganachi-desktop application). Details was mapped with 'id' which is an alphanumeric number (eg: US644563496).Now I need to display all 'ID' from blockchain. But during compilation I'm getting error 'UnimplementedFeatureError: Nested dynamic arrays not implemented here.'

pragma solidity ^0.4.4;

contract Register{

 struct Details{
    bytes id;
    string name;
    string age;
   string country;
 }
 mapping (bytes => Details) DetailsTable;

bytes[] uid;

 function saveBondToBC(bytes id,string name,string age,string country) payable returns(bool success){

DetailsTable[id].id = id;
DetailsTable[id].name = name;
DetailsTable[id].age = age;
DetailsTable[id].country = country;
return true;

}


function insertID(bytes id) payable returns(bool success){

uid.push(id);
return true;

}

function getAllID() public returns(bytes[]){

    return uid;

}

}

When I removed function getAllID(),it compiled and 'id' was push into array. How to fetch all data from byte[] uid?

2

UnimplementedFeatureError: Nested dynamic arrays not implemented here

This error tells you that Solidity cannot deal with dynamic 2D arrays. The feature has not been implemented yet.

Details was mapped with 'id' which is an alphanumeric number (eg: US644563496)

If you aleady know how many characters your IDs are going to have or what their maximum length will be you can define the length of the bytes object. See also the Documentation.

A workaround for you might therefore be to just replace bytes with bytes32 for example. When I test this in Remix it doesn't throw an error.

Hope it helpls.

  • Thanks, when I changed the datatype to bytes32..It Worked! – angelmaria Feb 5 '18 at 11:32

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.