I am beginner in mapping.I work on Truffle and Ganache. I deploy the following contract:

pragma solidity ^0.5.12;
contract customerFinder{
    mapping(uint256 => address payable) public addressStorage;

    function filling(uint256 iden, address payable sender) public{

    function finder(uint256 id) public view returns(address payable){
       return addressStorage[id];

Ganache shows the storage of the contract:

enter image description here

After that, i run the filling() function by truffle:

enter image description here

And a new block created. But, i expect the contract's storage be changed and no change occurrs.

enter image description here

Is there any problem or my expectation is false?

  • It says next to the mapping "not supported yet". It seems ganache UI has not implemented a way to inspect mappings, but they work in the smart contract. – Ismael Feb 27 '20 at 4:05
  • What truffle version are you running? – DRP Feb 28 '20 at 15:12
  • Truffle version 5.1.8 – Alireza Mar 1 '20 at 13:13
  • I am also running into this problem. Not only are mappings not shown, but the entire storage-visualization seems to be broken. – Mike76 Mar 7 at 1:39

I tried your filling function, and it works perfectly on my side.

However, as your mapping is public, you can access it in the same way that I'm using your finder function.

On my side everything is ok, maybe Ganache is not displaying this output correctly, but I tried on Remix, and I'm able to retrieve the corresponding mapped address.


The mapping structure saves its index data as hash, not plain data. So no external party can see its values, even if you mention the mapping variable as public.

So the only way you can its values is to use a function such finder in your code.


Looks like it's a bug in ganache.

From: https://spectrum.chat/trufflesuite/ganache/mappings-wont-show-up~31d934cd-7015-4ac3-9d35-05b4737005a2

sadly Ganache UI doesn't support decoding mappings right now. This is something we're aware of and have in mind to add, but there's a few technical limitations we'd have to overcome for that to be possible.

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.