8

If you check out the account 0xe358b3b9f29c67cb810c5184e6fde27d66ce036c you will see several incoming transactions with 100 Finney each. Yet the overall balance is 31 Finney. How is that possible?

If I imagined this were my account, and I were just confirming transactions with a block explorer, how could I figure out whether a transaction is really funding my account? Where did the 100 Finney go and why?

eth
  • 85,679
  • 53
  • 285
  • 406
q9f
  • 32,913
  • 47
  • 156
  • 395

2 Answers2

10

If you look at the VM trace, you can see that the 100 Finney transactions ran into Out-of-Gas exceptions. In the case of an exception, all value included in the transaction is returned to the sender.

To answer the second part of your question, I would use http://live.ether.camp as your block explorer, since it shows contract-produced transactions and errors.

To be clear, while contracts cannot initiate transactions, they can send ether to other addresses. Since these operations are not separate transactions but side-effects of the contract's execution, they are often not listed with the other transactions, creating confusion.

On the ether.camp explorer, these balance transfers are listed as "internal transactions", underneath the transaction that produced them. ether.camp internal transaction

On the etherchain explorer, they are listed as "contract invoked transactions", directly underneath the contract that initiated them. It is less clear that these are part of the transaction above, but if you click the parent transaction has, you will see "invoked" transactions listed etherchain contract initiated transaction

Tjaden Hess
  • 37,046
  • 10
  • 91
  • 118
  • vm trace, very cool! – q9f Jan 25 '16 at 20:36
  • 1
    Yes, I have always been impressed with the ether.camp explorer. – Tjaden Hess Jan 25 '16 at 20:41
  • While ether.camp is great at revealing out of gas exceptions for example, it does not actually recognize contract-initiated transactions. A contract-initiated transaction such as that coming from a contract-based wallet, as of now, is only displayed by Etherchain.org, as far as I know. In the case of the above Account, for instance, only Etherchain lists 7 transactions including 2 initiated by contracts: https://etherchain.org/account/0xe358b3b9f29c67cb810c5184e6fde27d66ce036c#txreceived The other block explorers list only 5. – KLmoney Jan 30 '16 at 05:37
  • That's not entirely true. If you look at the incoming transactions you'll see that #2 and 3 have "internal transactions." This is technically more correct, since they were not separate transactions but produced as a result of transactions 2 and 3 respectively. – Tjaden Hess Jan 30 '16 at 05:41
  • Yes, transactions #2 & #3 produced 1 internal transaction in the receiving contract-based wallet (created by transaction #1) as they completed with adequate gas. But all 5 transactions shown in ether.camp are from Externally Owned Accounts. Transactions initiated by a contract (contract-based wallet) would not show. – KLmoney Jan 30 '16 at 06:22
  • My wording in my answer was poor. There is no such thing as a "contract initiated" transaction. Every transaction is initiated by a real node, but contracts can produce subsequent transactions. The 7 shown on etherchain are the same 7 (5+2) shown on ether.camp, but the ones on ether.camp are displayed in a more technically correct, if less intuitive, way. I'll edit my answer for clarity. – Tjaden Hess Jan 30 '16 at 06:26
  • I think the edits are good but might be better in another Q&A because those transaction are no longer about OP's 100 Finney tx... so it can be confusing. – eth Jan 30 '16 at 12:04
  • Actually those are the transactions referenced in the original question – Tjaden Hess Jan 30 '16 at 16:28
5

The transaction ran Out of Gas, as can be seen on https://live.ether.camp/transaction/abddd676a2dc65dc4790463121bd77cafce4e0fb878d0b386556b055e0cae2d0/vmtrace#0

enter image description here

Here's the transaction where the 100 Finney was sent and it shows "Gas Limit" is 21000: https://live.ether.camp/transaction/abddd676a2dc65

contract invocation

So the user (0xbf27f..) specified that the transaction can consume up to 21000.

21000 gas is exactly what's required in Frontier, for a value transfer. You can see from here (deselect other filters except for "value transfer") that 21000 gas is enough to send any amounts of Ether.

So why did the transaction run Out of Gas?

Because the transaction was a contract invocation (see upper right of image)

Let's take a look at the receive address:0xe358b3b9f29c67cb810c5184e6fde27d66ce036c

enter image description here

See how it has code? Whenever a transaction is sent to an address with code, that code is invoked, starts getting executed and consuming the gas, just like a car consumes its fuel. If the gas is depleted before the transaction is able to complete, an Out of Gas exception is generated and basically everything the transaction did is undone. That's why the 100 Finney remains with the sender.

From the transaction if you click on "vmtrace", you will see the Out of Gas. This transaction didn't have enough gas to even do a single computation step, but if a little more gas provided, the vmtrace would should some computations being performed, until the point of Out of Gas.

Specifying more gas would prevent the issue. It is safe to specify more gas, because any unused gas remains with the sender.

For example, if 123456 gas was specified and the transaction only consumed 50000 gas, the remaining gas (73456) would remain with the sender.

eth
  • 85,679
  • 53
  • 285
  • 406