Questions tagged [selfdestruct]

opcode for deleting a contract, original opcode called SUICIDE

Filter by
Sorted by
Tagged with
42
votes
3answers
19k views

Why are selfdestructs used in contract programming?

I'm reading bits and pieces that selfdestructs within contracts are a good thing. Can someone explain what the benefits are of doing a contract selfdestruct when it comes to Ethereum programming? Is ...
19
votes
4answers
16k views

How can I return struct when function is called?

I'd like to return struct type User. However, when I tried the following getUser function, it returns an error. Is there any way that struct data would be returned from a function? Contract struct ...
11
votes
3answers
4k views

Contract's state after a Selfdestruct

What happens to the state of a smart contract when it is selfdestruct. Are the last state variables still visible on the blockchain afterwards?
7
votes
3answers
1k views

What is actually removed during a contract suicide, and why doesn't this cause the blockchain to change?

I'm trying to get my head around how contract suicides work, and what actually happens during them. I understand why we use them. This post states that when the SUICIDE opcode is executed, the data ...
3
votes
3answers
3k views

How to kill crowdsale contract?

I want to just simply kill this contract what code do i type into the get console to kill this contract so that the funds are returned to the owner which is me. Please let me know how you did it so I ...
4
votes
1answer
633 views

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?
2
votes
0answers
294 views

Upgrading the truffle Migrations contract

In the standard truffle migrations contract the purpose of the upgrade function is upgrade the Migrations contract itself by copying the last_completed_migration of the old Migrations contract to the ...
9
votes
1answer
264 views

How was the state-bloat attack that led to the EIP 150 hardfork performed?

I understand that SELFDESTRUCT and mispricing of opcodes allowed many empty accounts to be created cheaply as explained in Why were empty accounts allowed to be on the blockchain? The answer to that ...
3
votes
1answer
253 views

Should governance and token smart contracts be “unstoppable” or upgradeable? [closed]

Selfdestruct (aka suicide) functions stop contracts from functioning and clean up data on the blockchain. They can be used in upgrading contracts. Selfdestructing and upgradable contracts using a ...
0
votes
1answer
147 views

Explain the multi-sig wallet loss by deletion of “code”? [duplicate]

In recent news about the potential loss of 300M USD. Could someone please explain how it is possible to "kill" a number multi-sig wallets by removing code? As a programmer I fail to understand how ...
0
votes
0answers
521 views

“callback contain no result Error: Error: base fee exceeds gas limit” when call selfdestruct function (using Remix IDE)

I'm testing this simple contract. All the functions works well, but when I call the kill() function I'm getting this error: callback contain no result Error: Error: base fee exceeds gas limit I'm ...