Assume i have the address of a contract, and now i would like to retrieve the information for its creation transaction. I used getCode(), but return bytecode for the contract, which is different. If i could get the hash of the creation transaction, i could easily retrieve its information.

Any idea of how to retrieve, at least, the hash of the transaction that created the contract, given only the address of the contract?.

1 Answer 1


Just get list of "normal" and "internal" transactions for contract address:



The very first transaction will most probably be the one that created the smart contract. See documentation for details.

Though it is possible that there were some ether transfer to contract's address before is was deployed.

  • Thanks.It helps me a lot. Although in some cases will not return the correct answer as you mentioned!
    – MWH
    Commented Apr 10, 2019 at 16:43
  • Although this solution is good! it seems it is very slow. do you know a better way to only get the first transaction. what start and end block params should be?
    – MWH
    Commented Apr 12, 2019 at 10:02
  • API supports paging, so you just need to use binary search to find the last non-empty page, I think. Commented Apr 12, 2019 at 10:04
  • 1
    Oh, API has parameter sort=asc, you may try to play with it :) Commented Apr 12, 2019 at 10:04
  • All you need is sort=asc&page=1&offset=1.
    – CherryDT
    Commented Aug 22, 2022 at 11:11

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.