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?.


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.

| improve this answer | |
  • Thanks.It helps me a lot. Although in some cases will not return the correct answer as you mentioned! – MWH Apr 10 '19 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 Apr 12 '19 at 10:02
  • API supports paging, so you just need to use binary search to find the last non-empty page, I think. – Mikhail Vladimirov Apr 12 '19 at 10:04
  • 1
    Oh, API has parameter sort=asc, you may try to play with it :) – Mikhail Vladimirov Apr 12 '19 at 10:04

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.