In my test I would like to get the block or block number of when the contract was deployed.
const instance = await MyContract.deployed() const contractDeploymentBlockNumber = await instance.?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
truffle develop > migrate
It returns the transaction hash for a specific object, i.e.
So, you can get the block number for that contract deployment using
const txBlock = await Migrations.web3.eth.getTransaction('0x95aadab5fdd4c06dbf0e27601bd3a4c2da2ea244a7506189864f4465351fe3dc'); console.log(txBlock.blockNumber);