I have a smart contract that is exposing a list of addresses:

contract AddressBook {

    uint public val = 1000;
    address[] public addresses;


Then I do truffle compile && truffle migrate --reset After that, I run truffle console.

In the console, I bind the contract to a variable:


Now when I run:


It gives me back the proper result.

But when I run:


It responds with:

Error: Invalid number of arguments to Solidity function

I don't know why. Please help.

2 Answers 2


Actually the addresses variable is an array, so when you make a call use an element index number to access it.



  • It gives an error: Error: Error: VM Exception while executing eth_call: invalid opcode Oct 23, 2017 at 12:12
  • Please check updated answer Oct 23, 2017 at 16:48
  • I am still getting the same error. Oct 23, 2017 at 17:52
  • which client are you using Oct 23, 2017 at 18:18
  • Truffle v3.4.11 (core: 3.4.11) Solidity v0.4.15 (solc-js) TestRPC v4.1.3 (ganache-core: 1.1.3) Oct 24, 2017 at 9:25

Try deleting the build folder and run

truffle migrate --reset --compile-all

I had the same issue, the compiled code is corrupted. It works for the first time only and the subsequent compile corrupts the build. Hope it helps.

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.