For eg, in the PancakePair of CAKE/WBNB, the creator's address and transaction hash of the contact creation (which contains the timestamp of the pair's creation) can be found on the top right of this page (under More info): https://bscscan.com/address/0x0eD7e52944161450477ee417DE9Cd3a859b14fD0

My question is, is it possible to obtain the transaction hash of the contact creation (or the date of creation of pair), by preferably using the web3 library, if not any other api?

It is mentioned in the following question, that we can find the contract creation timestamp if we have the transaction hash that created the contact: How to find contract creation block time with web3?

But my question is, how can we find the transaction hash that created a contract, just by having the contact's address?

1 Answer 1


PancakeSwap, like other Uniswap v2 clones, posts PairCreated event every time a new pair is added. The creation date is the timestamp when the block containing this event, and its transaction, was is mined.

To reverse lookup contract addresses to the events, you need to

  • build your local database or index of all the events
  • ask BSC node to get all logs of the events using a filter condition for PairCreated
  • Then you can look up transaction hash from the event data returned by JSON-RPC

Here is an example Python and Web3.py script that scans all the pairs, including their creation timestamps and tx hashes for a local index.

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.