How can it be possible: the same function in the same code, on MainNet can be called, and on TestNet when trying to launch through the same Ethereum Wallet, I get the message:

It seems this transaction will fail. If you submit it, it may consume all the gas you provide. Estimated fee consumption: The contract will not allow this transaction to be executed

And Ethereum Wallet shows the gas price on the Ropsten 5.271 ether per million gas:

enter image description here

Contract on TestNet https://ropsten.etherscan.io/address/0x47d55ec9E1d5DEb893D3943e6d84011E488b1A37#code, on MainNet https://etherscan.io/address/0x684282178b1d61164febcf9609ca195bef9a33b5#code The approveAndCall() function called was based on model from https://ethereum.org/token (in old version) And it seems to be no difference which address will be put to function as an argument.

I think the problem can be with the third argument of this function: 'bytes _extraData', as discussed on https://ethereum.stackexchange.com/a/11771/1964 and Remix in 'Analysis' also thinks it's not good:

Gas requirement of function Corporation.approveAndCall(address,uint256,bytes) unknown or not constant.

If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)"

Where can be a problem? How to make code working on MainNet work on Ropsten TestNet too? I would like to make possible for users to test contract on TestNet before starting to work on MainNet.

  • Can someone please explain in layman's language how to fix this error? Nov 23, 2017 at 19:35

1 Answer 1


I believe that is because in the MainNet contract compiler version is: v0.3.5 and on the TestNet it is: v0.4.8. The crucial change that makes the whole difference is(introduced in 0.4.0):

Contracts now throw if ... no function matches the signature.


Function call throws if target contract does not have code.

So in this case making approveAndCall to the simple address or contract without receive function defined, results in a throw for 0.4.8, while being ignored in 0.3.5. Consider deploying the same bytecode to get the same results.

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.