1

By calling these two rpc calls, I can track if a transaction invokes more message calls. Yet when I tried this two rpc calls, i get different result on this transaction. (https://etherscan.io/tx/0xebc237c2f49a4e0189a8aefae5d452beb9b99817b1b3bb09e74aa0dae53b45f8)

Response from {"method":"trace_rawTransaction","params":["0xf8642784b2d05e00832dc6c094a152bcaf9abe5b7e39c133480e6f3049570ead0e808026a02cc790bd1fb18d186e0f427ac330f7bb16075cae8b0a1e3b0496fda123175ee8a03ce2585c7c0aca79f53e83177e840e06674e63cc91242af9af89a8fef504ea6a",["trace"]],"id":1,"jsonrpc":"2.0"}:

{"jsonrpc":"2.0","result":{"output":"0x","stateDiff":null,"trace":[{"action":{"callType":"call","from":"0x0232f3fb870334c2bc6de5c02d1a5c42ae7c06cd","gas":"0x2d74b8","input":"0x","to":"0xa152bcaf9abe5b7e39c133480e6f3049570ead0e","value":"0x0"},"result":{"gasUsed":"0x25ce2d","output":"0x"},"subtraces":21,"traceAddress":[],"type":"call"},{"action":{"from":"0xa152bcaf9abe5b7e39c133480e6f3049570ead0e","gas":"0x2c4305","init":"0x608060405234801561001057600080fd5b5060405173d1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b9081906000908181818181875af15050604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038516935063a9059cbb9250329184916370a08231916024808201926020929091908290030181600087803b1580156100a757600080fd5b505af11580156100bb573d6000803e3d6000fd5b505050506040513d60208110156100d157600080fd5b5051604080517c010000000000000000000000000000000000000000000000000000000063ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561013957600080fd5b505af115801561014d573d6000803e3d6000fd5b505050506040513d602081101561016357600080fd5b5073175e8ca2a7ad4f205688a6896daa572733e0b6e19050ff00","value":"0x0"},"result":{"address":"0xee6e981fb5d7e658da30023d21aa77f67314b58e","code":"0x","gasUsed":"0x14f25"},"subtraces":4,"traceAddress":[0],"type":"create"},{"action":{"callType":"call","from":"0xee6e981fb5d7e658da30023d21aa77f67314b58e","gas":"0x2b8ef4","input":"0x","to":"0xd1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b","value":"0x0"},"result":{"gasUsed":"0xf0f1","output":"0x"},"subtraces":0,"traceAddress":[0,0],"type":"call"},{"action":{"callType":"call","from":"0xee6e981fb5d7e658da30023d21aa77f67314b58e","gas":"0x2a9b78","input":"0x70a08231000000000000000000000000ee6e981fb5d7e658da30023d21aa77f67314b58e","to":"0xd1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b","value":"0x0"},"result":{"gasUsed":"0x363","output":"0x0000000000000000000000000000000000000000000001fd01199b77b0d47398"},"subtraces":0,"traceAddress":[0,1],"type":"call"},{"action":{"callType":"call","from":"0xee6e981fb5d7e658da30023d21aa77f67314b58e","gas":"0x2a9199","input":"0xa9059cbb0000000000000000000000000232f3fb870334c2bc6de5c02d1a5c42ae7c06cd0000000000000000000000000000000000000000000001fd01199b77b0d47398","to":"0xd1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b","value":"0x0"},"result":{"gasUsed":"0x36e0","output":"0x0000000000000000000000000000000000000000000000000000000000000001"},"subtraces":0,"traceAddress":[0,2],"type":"call"},{"action":{"address":"0xee6e981fb5d7e658da30023d21aa77f67314b58e","balance":"0x0","refundAddress":"0x175e8ca2a7ad4f205688a6896daa572733e0b6e1"},"result":null,"subtraces":0,"traceAddress":[0,3],"type":"suicide"} ... ],"vmTrace":null},"id":1}

Response from '{"method":"trace_replayTransaction","params":["0xebc237c2f49a4e0189a8aefae5d452beb9b99817b1b3bb09e74aa0dae53b45f8",["trace"]],"id":1,"jsonrpc":"2.0"}':

{"jsonrpc":"2.0","result":{"output":"0x","stateDiff":null,"trace":[{"action":{"callType":"call","from":"0x0232f3fb870334c2bc6de5c02d1a5c42ae7c06cd","gas":"0x2d74b8","input":"0x","to":"0xa152bcaf9abe5b7e39c133480e6f3049570ead0e","value":"0x0"},"result":{"gasUsed":"0x25ce2d","output":"0x"},"subtraces":21,"traceAddress":[],"type":"call"},{"action":{"from":"0xa152bcaf9abe5b7e39c133480e6f3049570ead0e","gas":"0x2c4305","init":"0x608060405234801561001057600080fd5b5060405173d1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b9081906000908181818181875af15050604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038516935063a9059cbb9250329184916370a08231916024808201926020929091908290030181600087803b1580156100a757600080fd5b505af11580156100bb573d6000803e3d6000fd5b505050506040513d60208110156100d157600080fd5b5051604080517c010000000000000000000000000000000000000000000000000000000063ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561013957600080fd5b505af115801561014d573d6000803e3d6000fd5b505050506040513d602081101561016357600080fd5b5073175e8ca2a7ad4f205688a6896daa572733e0b6e19050ff00","value":"0x0"},"result":{"address":"0xf1df9ae84c01ba555edcd54553cc08e5ba21eb2d","code":"0x","gasUsed":"0x14f25"},"subtraces":4,"traceAddress":[0],"type":"create"},{"action":{"callType":"call","from":"0xf1df9ae84c01ba555edcd54553cc08e5ba21eb2d","gas":"0x2b8ef4","input":"0x","to":"0xd1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b","value":"0x0"},"result":{"gasUsed":"0xf0f1","output":"0x"},"subtraces":0,"traceAddress":[0,0],"type":"call"},{"action":{"callType":"call","from":"0xf1df9ae84c01ba555edcd54553cc08e5ba21eb2d","gas":"0x2a9b78","input":"0x70a08231000000000000000000000000f1df9ae84c01ba555edcd54553cc08e5ba21eb2d","to":"0xd1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b","value":"0x0"},"result":{"gasUsed":"0x363","output":"0x00000000000000000000000000000000000000000000020ab14c4bd560e4af37"},"subtraces":0,"traceAddress":[0,1],"type":"call"},{"action":{"callType":"call","from":"0xf1df9ae84c01ba555edcd54553cc08e5ba21eb2d","gas":"0x2a9199","input":"0xa9059cbb0000000000000000000000000232f3fb870334c2bc6de5c02d1a5c42ae7c06cd00000000000000000000000000000000000000000000020ab14c4bd560e4af37","to":"0xd1f1c5ff90fb6f3b0d57f5f6ad4aaf7400f4b39b","value":"0x0"},"result":{"gasUsed":"0x36e0","output":"0x0000000000000000000000000000000000000000000000000000000000000001"},"subtraces":0,"traceAddress":[0,2],"type":"call"},{"action":{"address":"0xf1df9ae84c01ba555edcd54553cc08e5ba21eb2d","balance":"0x0","refundAddress":"0x175e8ca2a7ad4f205688a6896daa572733e0b6e1"},"result":null,"subtraces":0,"traceAddress":[0,3],"type":"suicide"}],"vmTrace":null},"id":1}

Why we get two different contract address results in create actions? (one the contract addr is: 0xee6e981fb5d7e658da30023d21aa77f67314b58e the other is: 0xf1df9ae84c01ba555edcd54553cc08e5ba21eb2d)

I tried to understand the diff of these two calls, yet on the wiki there is limited explanation. Can someone help me to explain these two calls?

Thanks for the help in advanced!

2
  • To clarify, you are submitting the same contract creation transaction twice, and you are asking why the generated contract addresses are different? Commented Oct 17, 2018 at 20:28
  • @ShawnTabrizi thanks for the help :) No. I tried to trace this historic transaction using trace function rpc calls from parity. And i got two different result from this past tx. Only one of the result matches the tx shown in etherscan(i provided the link above). So i am thinking why i have to two different contract address. Commented Oct 18, 2018 at 7:53

1 Answer 1

4

This behaviour is admittedly a little weird, but is kind of explained in the wiki, and can be verified by looking at the code.

https://wiki.parity.io/JSONRPC-trace-module#the-ad-hoc-tracing-api

through providing raw, signed, transaction data as when using eth_sendRawTransaction (see trace_rawTransaction) or simply a transaction hash for a previously mined transaction (see trace_replayTransaction)

Basically, trace_replayTransaction is, as you've noticed, the call that actually performs a previous transaction exactly, by providing the transaction hash of the past transaction.

In contrast, trace_rawTransaction (and trace_call,) behave as if you are performing a new transaction at the provided block, but for your use case of a contract creation, this might not mean that the transaction occurs at the same index in the block as it had during the previous execution, resulting in a different contract address.

You can see in the code:

https://github.com/paritytech/parity-ethereum/blob/1f18dbb17c5366af0cb324bf19ade483ed760266/rpc/src/v1/impls/traces.rs#L139

that raw_transaction performs a client.call whereas replay_transaction performs a client.replay

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.