Am trying to write small application which will be able to find Contract deployment transaction with only input parameter - contract address. The application should be able to search entire net.,i,e say Rinkeby and should exactly find deployed transaction hash. This is applicable for any given contract address in rinkeby. I do not want to search with events or logs. Specifically am looking for how to find all the transactions with "0x0" as target programmatically?
I found the answer myself- Its pretty simple infact:
- Search for all the transaction from 0 to LatestBlock
- Get transactions in each block and loop through transactions one by one.
- Get Transaction receipt in each transaction and check whether its deployment transaction ['to' = '0x0'] and if so, get contract address.
- If given contract address matched input address, hurray we found the deployed transaction.