I need to determine (programatically) that the contract correctly refunded value. Contract uses this command:


Of course, I can check balance before and after the transaction (and that works), but I was hoping I could inspect the transaction directly. Is this possible?

As this question shows, I am a bit confused where these "refund transactions" are written. Are they a part of original transaction?

2 Answers 2


Etherscan refers to these as "Internal transactions" and the terminology seems to have caught on. Searching for that term may help you discover other approaches.

Some solutions in descending order of personal preference:

  1. Ideally, the solidity method should be written such that it will either throw an exception (providing a failed status value) or succeed in transferring the funds. Then you would only have to verify the transaction status in the receipt.
  2. Inspect the contract for an event that will only be emitted with a successful transfer.
  3. Receive the funds into a contract you write that emits an event on receipt of funds, and monitor for that event.
  4. Mess around with transaction tracing, or monitor balance before and after the transaction. Both of these have subtleties, and are error-prone.
  • Thanks! Since I couldn't change the contract, I had to use option 4. I am now simply requesting debug info on a contract and looking for CALL or CALLCODE operations and reading the amount and address from them. It works surprisingly well.
    – johndodo
    Nov 27, 2017 at 12:19

Additionally to @carver's answer: In geth 1.8.x there are useful tracer scripts, which make it easier to query relevant "internal transactions". See https://github.com/ethereum/go-ethereum/pull/15516

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.