1

I want to programmatically get the age of a contract or token on the ethereum blockchain. Is there a reliable way to do this with the etherscan api?

3
  • Yes, via http://api.etherscan.io/api?module=account&action=txlist&address=<YourTokenAddress>&apikey=<YourApiKey> Sep 8, 2020 at 15:25
  • The genesis block number of your token contract should be at the blockNumber field of first entry, provided that the to field of that entry is empty (otherwise, the token contract was created on-chain (i.e., from a function in another contract), in which case, I'm not so sure how you could obtain it via Etherscan API). Sep 8, 2020 at 15:27
  • @goodvibration Thanks, will try this!
    – Megan
    Sep 8, 2020 at 16:01

1 Answer 1

1

Yes, via:

http://api.etherscan.io/api?module=account&action=txlist&address=<XXX>&apikey=<YYY>

Where XXX is your token address, and YYY is your Etherscan API key.

The genesis block number of your token contract should be at the blockNumber field of the first entry, provided that the to field of that entry is empty.

Otherwise, the token contract was created on-chain (i.e., from a function in another contract), in which case, I'm not so sure how you could obtain it via Etherscan API.

1
  • How do I do it manually? Apr 3 at 23:01

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.