4

I’m a beginner in the Ethereum world and I’ve got some problems dealing with a SimpleStorage contract on my private testnet (http://solidity.readthedocs.io/en/latest/introduction-to-smart-contracts.html). In particular, if I create a contract instance and then call the set() function from the same node everything works. But if I call the set() function from another node of my private testnet by using the following commands:

> var instance = web3.eth.contract(abi).at(contractAddress);
> instance.set.sendTransaction(21, {from: web3.eth.accounts[0]});

the function does not seem to work. More precisely, by simply adding some event listeners, I can notice that the fallback function gets called instead. Could anyone tell me why? What am I doing wrong?

Any help appreciated.

  • Are you sure the ABI's correct? You'd see this behaviour if you're trying to call a function that doesn't exist, or has different formal parameters to the one you implemented. – Nick Johnson May 18 '16 at 15:53
  • That was actually the problem. Now it works perfectly. Thanks a lot! – AM122 May 18 '16 at 16:29
  • 1
    @AM122 Way to go adding an event listener. Since no one else knows what the mistake was in the ABI, you probably want to post the answer to your own question, then in a few days you can accept the answer. Posting own answer is fine here. – eth May 18 '16 at 19:38
  • There was a mistake in the abi definition of the input type (it was simply defined as 'uint' instead of 'uint256'). Thanks again – AM122 May 20 '16 at 8:58
  • @AM122 I meant to post in the big "your answer" box below, instead of this small box which is only for comments. Then in a couple of days, you can click checkmark on your answer. – eth May 23 '16 at 12:48
1

There was a mistake in the abi definition of the input type (it was simply defined as 'uint' instead of 'uint256').

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.