For debugging a smart contract, it would be helpful to see all entries of an Array or Mapping object in the smart contract.

When using Truffle, I can see individual elements of a public array with valid index i by running mycontract.myarray(i) but running mycontract.myarray() yields a BigNumber Error.

This question indicated that getting the full readout is not straightforward because the getter functions for mappings and arrays expect index keys. However, has anyone found a way to do this in geth or Truffle?

1 Answer 1



The abi is limited to a finite number (16, or 8 for strings) of values. See over here for some organizational patterns Are there well-solved and simple storage patterns for Solidity?.

You want the client side to do the iterating over the list so the cost per call remains constant.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.