2

For some reasons I failed to google any way of listing all transactions involving my account, just as when you do 'bitcoin-cli listtransactions' in Bitcoin.

Is there any simple way to do what I want to do, without involving any external sites or any code snippets longer than 3-4 lines of code?

1

1 Answer 1

1

There's no good way to do this because of something called 'incoming internal message calls.'

If everything in the whole world were well programmed (i.e. every smart contract properly instrumented itself with events detailing where it's sending money, etc.) then accounting for this would be easy. You (the receiver) would simply have to listen for events mentioning your account address.

The scenario that causes the problems is when a contract is either incorrectly instrumented or purposefully silent about sending ether.

For example contract A may allow someone to send in an arbitrary Ethereum address, and it will forwards ether to that address (doesn't matter why it might do this, just that it does).

From the perspective of the sender, this is easy to account for because the transaction is on the blockchain and the address smart contract address is the to.

From the perspective of the receiver, this ether may appear to magically show up in their account. Because the transaction was sent to a smart contract (not the receiving address), and the ether was transferred "internally" to that transaction (and because the smart contract is poorly instrumented), there is no way (short of searching every single transaction on the chain) to know where that ether came from from the perspective of the receiver. You can monitor the balance of the receiving account at each block, and note where the balance changes, but you would have to be monitoring all the time or go back and look at past blocks.

Why would anyone do this? Money laundering? Hiding ether from authorities? Secret admirer?

This is a long winded way of explaining why the answer to your question is not as easy as it seems. It should be that easy, and if anyone knows of a way to handle this case, I'd be very interested to learn.

To me, the answer should be "Of course, here's the three lines of code." In reality, if you want to be fully accurate, it's way more complicated than that.

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.