2

I'm trying to send OMG tokens using MyEtherWallet's offline transaction and getting an error just like this one: 0x084284cb471d3b413ebbbcc5373f1108e3c084e57529f2cfaf8c490117c1a9d1

The gas limit there was 300k, which should be plenty. I say it should be plenty, because here's what appears to be a transaction just like the above which has succeeded: 0xcbd89114d75a6246ed8060dbd2b042240acc4dd35ed2a0e3e894a30982133503. Its "Gas used by txn" is only 22k.

Is there some way to find out where it failed?

See Geth DebugTrace. This also suggests that it only consumed a tiny bit of gas during execution and then failed.

Also, if it fails with so much gas remaining, why is it charging me full gas up to my limit?

0

Bad instruction is a generic error message, depending on the contract and transaction it can be anything. For example the error from tx 0x084284cb... was caused when trying to send more tokens (approx 1481) than the balance at that moment (around 820).

The current behavior of paying the full gas in case of an error was to discourage bad contracts attacking the network. But actually human mistakes are very common, so in the upcoming fork this kind of errors will not consume the full gas. But until then you have to set transaction gas to a reasonable value. A good wallet should set a good approximation.

  • That was the issue indeed. Do you mind sharing how you figured out that this was the problem? Is there some way to trace the contract execution in its Solidity source code? – Pavel Sep 16 '17 at 22:21
  • Etherscan shows the method name transfer, and it has the contract source. I also got the transfer amount 1481. Looking at the source (it appear to be based on OpenZeppelin, I've some experience with them) the only possible cause for a transfer to fail are 'insufficient balance', 'token paused', and 'short address attack protection'. Token paused is unlikely because it would have affected all transfers. There were other transactions so I 'reversed' them until the failed one the balance should have been 820 (far from 1400 even I've made a mistake). I didn't check for a short addres attack. – Ismael Sep 17 '17 at 4:16

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.