4

I use Parity's trace facility extensively to help me account for all transactions on individual accounts. I've been able to get almost complete accuracy (off-chain) of account balances for each block, but I'm having trouble with suicide calls.

This contract...

pragma solidity 0.4;
contract BadIdea {
    address recipient;
    function BadIdea(address _r) { recipient = _r;  }
    function () payable {}
    function kill() { suicide(recipient); }
}

...which is admittedly ridiculous--it accepts money from anyone and sends it to recipient--helps me ask my question. The transaction of a 'kill' call to this contract looks something like this:

Transaction:
=============
{
    "date": "2017-03-15 20:43:44 UTC",
    "block": 3189912,
    "from": "0xb970..."
    "to": "0xd450aa..."
    "input": "0xdaf3450000000..."
    ....
}

and the trace generated by Parity looks like this:

Trace:
=============
{
    "blockHash":  "0x9ee74ad...",
    "blockNumber": 3189912,
    "subtraces": 0,
    "traceAddress": [],
    "transactionHash": "0x8324490c...",
    "transactionPosition": 7,
    "type": "suicide",
    "action": {
        "from": "0x0",
        "gas": 0,
        "to": "0x0",
        "value": 0
    },
    "result": {
        "gasUsed": 0
    }
}

The transaction tells us which contract is suiciding (the transaction's 'to' value), but I don't see any way (from the perspective of the trace alone) of finding out what address the balance of the contract was sent to.

Of course, we know that the value was sent to recipient, but because I want to account off-chain (and I want to do so totally ignorant of the source code), I need something that indicates which account received the balance from the suicide. It does not appear to be included in the trace.

Question: Is there any way to tell which account receives the value from a suiciding contract from the RPC retrieved transaction and/or trace data alone?

1

Let's take for example one of the DOS transactions. If you make this call to a synched, traces enabled parity node you will get some useful traces.

POST http://localhost:8545 HTTP/1.1
content-type: application/json

{
    "method": "trace_replayTransaction",
        "params":
    [
        "0x5816cb0c95789787803ba22bf73e5d1be8a1bc21ac8c91523ce128ac3bb7a157", 
        [
            "trace"
        ]
    ], 
    "id": 1, 
    "jsonrpc": "2.0"
}

In the traces array you will find

{
    "action": {
        "address": "0xb7e2330fb74da72b66e0c3ebe16218ad6d839fac",
        "balance": "0x1",
        "refundAddress": "0x70426f516a4f6b496c416b4161416153744c6255"
    },
    "result": null,
    "subtraces": 0,
    "traceAddress": [
        0,
        2,
        0
    ],
    "type": "suicide"
}

And you are interested in

"balance": "0x1"
"refundAddress": "0x70426f516a4f6b496c416b4161416153744c6255"

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.