Questions tagged [selfdestruct]

opcode for deleting a contract, original opcode called SUICIDE

Filter by
Sorted by
Tagged with
0
votes
1answer
29 views

Does self-destruct() delete contracts data from the storage as well?

Destroying two contracts: (1) contract A with 1 integer variable stored in it and (2) contract B with 100 integer variables stored in it, would result in the same amount of refund: 24000 gas. So does ...
3
votes
2answers
223 views

Gas refunds via “Self-destruct” prior to a revert()

In a transaction that eventually calls revert(), if prior to the revert we have SELFDESTRUCT some contracts and thus received a gas refund, does the gas refund also get reverted?
0
votes
0answers
10 views

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

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
2
votes
1answer
74 views

how to call “selfdestruct” if not written in contract, as documentation says its possible

as mentioned in documentation "Even if a contract’s code does not contain a call to selfdestruct, it can still perform that operation using delegatecall or callcode." so my question is how ...
2
votes
1answer
116 views

Destroy smart contract and collect its funds

I'm quite new at smart contracts/Solidity, which I'm learning for a postgraduate course. In one of the assignments, we have to implement a short example of dutch auction (wiki link). Now my question ...
2
votes
1answer
30 views

Why can I call contract methods containing a selfdestruct multiple times?

The following code is part of a Smart Contract I'm working with: [...] function noComplain() allowed(receiver, stage.keyRevealed) public { selfdestruct(sender); } // function ...
1
vote
1answer
37 views

Receiving error while getting state variable value after using selfdestruct method “Error: Returned values aren't valid, did it run Out of Gas?”

I am using selfdestruct method and passing the payable address to it but receiving the following error when trying to get the value of a state variable : "Error: Returned values aren't valid, did it ...
1
vote
1answer
116 views

How do you know if a contract is destroyed?

I'm using web3.py to interact with contracts. I was wondering, after calling a function with selfdestruct or suicide(address), how do I find out that the contract is in fact dead?
0
votes
1answer
31 views

how to disable a contract by changing some internal state which causes all functions to revert?

In official documentation of Solidity about Self-destruct instruction is written: If you want to deactivate your contracts, you should instead disable them by changing some internal state which ...
1
vote
1answer
45 views

Solidity - selfdestruct doesnt work!

I implemented selfdestruct(), also it showed succeeded on Etherscan. Afterwards, I still am able to send transactions to the contract. Can you tell me why? Doesn't selfdestruct() delete the contract ...
1
vote
1answer
112 views

How to kill a contract in ethereum?

I'm trying to kill this contract /** *Submitted for verification at Etherscan.io on 2016-08-31 */ //sol Wallet // Multi-sig, daily-limited account proxy/wallet. // @authors: // Gav Wood <g@...
2
votes
1answer
119 views

How dangerous is to use tx.origin to check if msg.sender is some address? (details below…)

Let's say: function transfer() public payable { require(tx.origin == 0xb2930B35844a230f00E51431aCAe96Fe543a0347); msg.sender.call.value(1 ether)(); } Ignore the address above I just copied it ...
0
votes
1answer
44 views

Is there a case in which selfdestruct is more “powerful” than throw or revert?

Example in this scenario I guess selfdestruct will never get called (also: contract A isn't so important by the way just focus on B onward): in Contract A: address contractb = 0x....; function ...
1
vote
1answer
115 views

Issue with selfdestruct() getting an error

main contract function which calls my secondary contract function gameOver(uint _matchId)public payable onlyOwner returns(bool) { Match my_match = Match(matchTracker[_matchId]); bool success ...
0
votes
0answers
73 views

How can I call selfdestruct when it is located in a constructor and not in the ABI of my contract?

I am reading some tutorials and while planning to deploy test contract on ropsten I have something like this: pragma solidity 0.5.1; contract destroy { constructor(address payable receiver) ...
1
vote
1answer
45 views

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 ...
2
votes
1answer
62 views

After a suicide operation, is contract’s nonce reset to 0?

Simple question, but I couldn’t find the answer in the yellow paper. Is it reset to 0 or is it kept at the latest value before destruction ?
0
votes
3answers
152 views

Self-destructing NFT (ERC-721) token [closed]

What I want to achieve is self-destructing token. For example I'd like to have some updatable TTL value assigned to my token. If TTL is reached the token should be auto-burned. What are the best ...
2
votes
2answers
67 views

Can you selfdestruct a contract more than once?

I read the Contract's state after a selfdestruct thread, but it doesn't answer the question whether you can selfdestruct multiple times.
0
votes
2answers
102 views

Self Destruct Design pattern - Loss of funds issue

I was exploring on self destruct design pattern for a time bound smart contract. So my contract should not accept any further state change after a certain given time period. While working on that I ...
3
votes
3answers
485 views

“Self-destruct” use cases?

According to solidity.readthedocs.io (Link) here is the definition of Self-destruct: "Definition: The only way to remove code from the blockchain is when a contract at that address performs the ...
0
votes
1answer
106 views

Check if contract is destructed

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 ...
2
votes
1answer
2k views

Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested

function endSuply() public { require(msg.sender == admin,"only admin can end the token sale"); require(tokenContract.transfer(admin, tokenContract.balanceOf(address(this))),"balance not ...
2
votes
1answer
279 views

How can I call contract method that suicide and continue execution?

Can I call another contract that eventually will call selfdestruct, and keep executing my function? For example, say I have two contracts as follows: contract Destructor { address owner; ...
0
votes
2answers
526 views

Self Destruct Transaction

how to make transaction like THIS TRANSACTION anyone can help me how to build it
1
vote
1answer
273 views

contract kill function

as per ethereum docs Even if a contract’s code does not contain a call to selfdestruct, it can still perform that operation using delegatecall or callcode. is this real? 1.if it is then even if ...
2
votes
2answers
197 views

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 ...
4
votes
2answers
176 views

Understanding the formal description of a transaction and its associated refunds

Excerpt from page 8 of the yellow paper: I fully understand that contracts can self-destruct and, when that happens, according to this thread, all the balance is refunded to the address specified as ...
1
vote
0answers
52 views

How can I see the transactions which move funds from a destroyed contract?

I got this external account from which I called a function of this contract which subsequently called selfdestruct and sent all the funds to the caller. Where can I see the tx making this transfer? ...
1
vote
1answer
191 views

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 ...
1
vote
1answer
708 views

Smart Contract storage

I was about to create my first smart contract which I came across these questions: Where exactly the contract code gets stored, I read that it kind of stores in blockchain so does that mean every ...
1
vote
2answers
55 views

Do events get emitted when calling selfdestruct()?

Are event emitted when a contract calls selfdestruct?
1
vote
1answer
678 views

How selfdestruct() works?

I'm wondering about how selfdestruct() actually works. Does it actually delete contract codes from the storage? Or just delete the contract address from state trie? If just deleting the contract ...
0
votes
2answers
217 views

Mocha test at kill() function

How to test with Mocha and Chai that a call at the kill() function of a Smart Contract (i.e., which does the selfdestruct) has gone right?
0
votes
1answer
292 views

converting “now” to “day”?

Consider we need to determine an expiry date for a contract such that after this date the contract will be destroyed as follows: uint256 public expiryDate; constructor(uint256 duration) ...
1
vote
1answer
855 views

Solidity - selfdestruct

I'm just wondering what would happen if I don't put a selfdestrut() method in my smart contract. As I read from the Solidity documentation (Self-destruct): Even if a contract’s code does not ...
0
votes
1answer
53 views

Since ERC token names, symbols cannot be reserved, anyone recommend selfdestruct/suicide method call?

As we know contracts are unique .. has anyone 'reserved' a token name/ symbol before final deployment, by putting a suicide by owner method.. so this dummy can be 'removed' just before the same token ...
0
votes
1answer
97 views

Is it possible to run out of gas in a method before reaching the self-destruct call?

I'd like to implement a self-destruct method for a smart contract that pools money from people as a last resort. Before calling self-destruct, I'd like to refund all the money to the users and send ...
0
votes
0answers
345 views

SelfDestruct: Base fee exceeds gas limit

Using ganache-cli (ganache-core v2.1.0, cli v6.1.0) ganache-cli --blockTime 300 --account="0xC87509A1C067BBDE78BEB793E6FA76530B6382A4C0241E5E4A9EC0A0F44DC0D3,100000000000000000000" -p 9545 -l 6000000 ...
4
votes
1answer
1k views

What happens after selfdestruct is called?

https://ropsten.etherscan.io/address/0xf825d3b3d06a4b46379a3c276df7f26abd055463 After selfdestruct call was made, all the balance was transferred to the deployer of the contract. Why are withdraw ...
1
vote
1answer
436 views

Why does selfdestruct() have an address requirement?

Why must selfdestruct take the contract's original msg.sender argument? Isn't the idea that it 'self' destructs?
4
votes
2answers
159 views

Calculate how much space can be saved after self-destructing a contract

I want to do some brief analysis to quantify how much one could free when self-destructing a contract. How could I calculate how much space can nodes save when selfdestructing a given contract? I ...
1
vote
1answer
320 views

Does SUICIDE also free up stored hashes? [duplicate]

Here's a contract: pragma solidity ^0.4.19; contract StoreAndFree { mapping(int=>int) myStore; function StoreAndFree() public { for (int i=1; i<100; i++) { myStore[...
0
votes
0answers
63 views

Question on selfdestruct/suicide operation to a multi-sig address

I am writing a very simple contract that does the following: accepts ETH allows the transfer of ownerships logs events suicides when goal is met I tested it successfully with a regular account and I ...
3
votes
0answers
329 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 ...
1
vote
1answer
89 views

Kamikaze contracts

Compiling a simple contract on Remix with the most recent nightly I get the following warning "Use of selfdestruct can block calling contracts unexpectedly. Be especially careful if this ...
0
votes
1answer
30 views

Short of running one's own node, how can I see the code of suicided contracts?

I'm interested in looking at the code in instances of the Parity Multisig wallet attacks, but the contracts have self-destructed. How can I get ahold of the exact bytecode that was executed in a given ...
0
votes
1answer
79 views

What happens to old contracts?

Say the makers of a contract all die so no one left has a stake in or knows or cares about that contract. Say the contract never calls self-destruct on itself. What happens to this old, unused ...
2
votes
1answer
310 views

Overriding Solidity selfdestruct

I create a contract and implement a cleanup function like this modifier ownerOnly { if(msg.sender != owner) revert(); _; } function cleanup() public ownerOnly { if(!canDelete()) { //...
0
votes
1answer
175 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 ...