Questions tagged [selfdestruct]

opcode for deleting a contract, original opcode called SUICIDE

SELFDESTRUCT is the EVM opcode for deleting a contract. It was originally called SUICIDE but has been implemented in both Solidity and Serpent in EIP6.

112 questions
7
votes
1 answer

how can a contract destroy other contract (suicide accounts)?

I learnt from the yellowpaper that at the end of a contract execution, there could be a list of suicide accounts that will be removed. my question is, why and how would one smart contract remove other accounts (smart contracts). for example, I…
Bill Yan
  • 213
  • 2
  • 5
4
votes
1 answer

How to suicide existing contract?

Is there any way to suicide contract which was never designed for that? If so what will happen with ethers that this contract is holding?
gkucmierz
  • 773
  • 2
  • 8
  • 15
2
votes
2 answers

is selfdestruct a good practice?

A contract after selfdestruct cannot manage transactions, and as such any ether sent to it is lost. Wouldn't be better to switch to a contract defined state "dismissed" and reject any ether sent by mistake when in such a state?
Davide C
  • 896
  • 1
  • 9
  • 22
1
vote
1 answer

What happens when a suicide operation transfer remaining funds to it’s own contract address?

equivalent solidity code : suicide(this); Does the operation succeeds at not transferring the balances while still erasing the code ? Or is contract’s code destroyed only after sending balances which means a recursion infinite loop can occur if the…
user2284570
  • 1,008
  • 1
  • 12
  • 30
1
vote
1 answer

Does a selfdestruct affect child contracts?

Say, I create a smart contract A and this contract creates another smart contract B. If I call selfdestruct on A, will this affect in any way contract B? Or can I still call functions on B after A is killed? I found this example on…
hefeleal
  • 147
  • 1
  • 10
1
vote
0 answers

Self destruction

I am also newer to solidity. It appears there is a self destruction option for solidity. If I use that, it seems I also would be eligible to receive some gas as a refund for freeing up space in the blockchain. Can anyone explain me how this has…
1
vote
1 answer

send tx with smartcontract and self destruction

help me, I want to create a smart contract with the function send internal tx then self destruct like this example this hash address polygon txhash
M Akhtar
  • 11
  • 2
0
votes
0 answers

Can I selfdestruct a smart contract without the selfdestruct function being implemented?

is it possible to selfdestruct a smart contract which I have deployed even though the selfdestruct(address) function is not implemented in the code? Thank you
0
votes
1 answer

Where can I find the source code for selfdestruct()?

I'm trying to look into the Ethereum repository but I can't find a file for the functions. I want to know how selfdestruct() is implemented, but I also would like to look at other functions.
Jossie Calderon
  • 792
  • 1
  • 8
  • 14
0
votes
1 answer

Redeploy a smart contract on the same address

How can I redeploy a different smart contract on the same address after selfdestruct()? I know that with CREATE2 I can place a smart contract on a specific address. But after I remove the source code from that address through selfdestruct() how can…
OrionN
  • 23
  • 4