0

I am currently learning how to create contracts on how everything works. I am using the Ethereum Wallet which allows me to deploy contracts. I created there 2 accounts.

I created a small contract:

contract Math{
    function Math(){}

    function addition(uint256 a, uint256b) returns (uint256){
        return a+b;
    }
}

I deploy this contract with the main account in the ethereum wallet, the first in the picture. Accounts

As soon it is deploy I call the function using the main account. This works perfectly.

Now I would like to do the same with Account2 but it is not working. After some time it just tells me that it can't execute the function and that's it. What am I doing wrong? I am fiddling on this since 2 days :(

Call function

Here you see how I call the function in the ethereum wallet. First I pick the main account and after that I pick Account2. And in the last picture I captures the terminal output for Account2.

enter image description here

  • What do you mean by not working? It will be easier to tell if you can post the what exactly is not working? Any errors? – Prashant Prabhakar Singh Jun 21 '17 at 20:22
  • All I get is that the contract could not be executed. I will try to capture it. – Donut Jun 21 '17 at 20:23
  • I have tried replicating the scenario. I didn't find any errors, I was able to call addition function from any account having ethers in it. Please verify, if you have sufficient ethers in account 2 and if you are providing sufficient gas. Also do not forget to use latest ethereum wallet always. – Prashant Prabhakar Singh Jun 21 '17 at 20:30
  • I can assure that both account have more than 2 ETH and each transaction picks a decent amount of gas to execute it. I guess I will try to download the Ether Wallet again and see if I am able to do something about it. You simply created 2 accounts and it all worked? – Donut Jun 21 '17 at 20:35
  • 1
    If you make addition const then you do not have to pay because it doesn't modify contract state. – Ismael Jun 22 '17 at 4:34
0

Ok, everything works now and I have no clue why. I installed everything from scratch and now I am able to call functions using Account 2. I have no idea why it has not worked earlier...

Thanks anyways :)

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.