0

Once a contract is no longer valid (eg after calling selfdestruct on it), one can still call functions on it although the contract won't behave as expected. In javascript, how can one check if the contract has been destructed before performing a transaction?

3

You can call getCode (web3.eth.getCode(address)). The call will return 0x if it selfdestruct'd. Note that this isn't a positive way to know it selfdestruct'd, it'll also return 0x if it's an EOA or the contract was created with no code.

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.