[Ethereum] How to find contract creation block time with web3


Is it possible to find out in which block a contract was created using web3?

Best Answer

If you have the transaction hash that created the contract, do a web3.eth.getTransactionReceipt(*hash*). The resulting object will contain a blockNumber.

You can make sure that this is the creation hash by checking whether contractAddress in the object is populated with your contract's address (to should be empty).

Related Topic