I'm delving into smart contracts more, and i've copy/pasted the example "Improved Token - Full Coin Node" from https://www.ethereum.org/token. (I'd post it here it but it breaks the code formatting when i do and i have no clue how to fix it....sorry)

I'm very confused on a few things. Certain functions, such as Buy, Sell, and Freeze Account to name a few, do not work at all and throw the error

"The contract won't allow this transaction to be executed"


"If you submit this transaction, it will consume all the gas provided".

From my understanding, the only way to send ETH to this address is via a payable function (the "Buy" function, in my case).

I'm unsure as to what is going wrong. Another thread on here posited that it has to do with this part of the "Buy" function :

_transfer(this, msg.sender, amount);

If anyone could point me in the right direction to understand what I am doing wrong here, I would be very appreciative.

1 Answer 1


Edit: Same solution as this: [Sample Token contracts dont work - "The contract won't allow this transaction to be executed"

  • So, I figured out the issue. The "payable" function is called buy(). I assumed that the contract would automatically select the payable function when sending ether, but it looks like you need the catch-all payable function, instead of a named one, to receive arbitrary ether payments. Once I removed the function name, it all worked! Commented Jan 13, 2018 at 18:32

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.