1

I want to know if calling selfdestruct clears/removes data from blockchain or it still remains there.

Looking at this link, CLICK HERE it says that data doesn't get removed. (first answer)

Looking at this link, CLICK HERE it says that it frees up the data. (first answer)

Question 1) So, which one is right ? Does the data get removed or not ? what gets removed exactly ?

Question 2) If I send the ether directly or transfer, to the contract that already used selfdestruct, will it return false and my ether coming back to me or ether will get burn ? if it burns and gets lost, then the idea that

" selfdestruct exists because no one can interact it with it anymore so that no dangerous thing could happen "

seems to be a little bit wrong...

1 Answer 1

1

The data gets removed from that block onwards. So the history of the blockchain is never touched. If you look at the blockchain before the block (in which the selfdestruct was called) you see the contract in its address. But if you look at the same address after that block there is no contract.

You can send Ethers to whichever address you wish and it will succeed (unless there's a contract which reverts the transaction) and the Ether will remain in that address. So you can send Ethers to an address which used to be a contract address and the Ethers are effectively burned as there can't be another contract at that address anymore.

Your note about "no dangerous thing could happen" is partially true, depending on the point of view. Calling a non-existent contract will leave the Ethers there but will return immediately. So in that sense it's dangerous to self-destruct a contract as any subsequent Ethers sent to it will get burned. But on the other hand the contract can't do any mischief (such as re-entrancy attacks) if it's being called as there is no contract anymore - although this probably doesn't give you much comfort if you lose your Ethers there. (Check https://ethereum.stackexchange.com/a/1436/31933 for details)

1
  • 1
    if crafted in prior, contracts deployed using create2 can potentially place a version of contract again back in that same address after selfdestruct and can also be with a logic that could make it behave differently while still using same bytecode as the earlier contract to retain same address for a given salt. Commented Jun 17, 2022 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.