4

I want to receive deployed contract address by transaction hash. Transcation example - 0x996a683acd59a2ad17461f76ce0f387a89a5ac257ec5d667556219c6acc7f45a.

As you can see this contract was deployed by the other contract (fabric) and when I look at the internal transaction - I see newly created contract address (https://etherscan.io/tx/0x996a683acd59a2ad17461f76ce0f387a89a5ac257ec5d667556219c6acc7f45a#internal)

I know that I can calculate new contract address by creator address and nonce (number of transaction from this address), but I have an array of transactions list and don't know number of transaction on the contract deployment time. So I want to get this address with JSON-RPC request if it's possible.

0

The way I usually do this is by emitting an event that includes the created contracts address. It actually looks like the contract you called (0xc0abbf630bc11aa4a48f2cb6735f22104eeaf3e2) does this in the very last transaction as the last topic https://etherscan.io/tx/0x996a683acd59a2ad17461f76ce0f387a89a5ac257ec5d667556219c6acc7f45a#eventlog. The source isn't verified though so I'm not completely sure if this is reliable.

Of course this doesn't work for contracts that don't already do this and you don't control. In those cases, you can use Parity's trace module, which can return all calls between contracts in a transaction, which includes creation of contracts.

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.