8

Is it correct that any ethers or tokens sent to the address 0x0000000000000000000000000000000000000000 will be destroyed?

Or what is the best way of burning ethers / tokens?

  • I keep sending back a spam token and it keeps coming back to my wallet plus 1 ie 232,233,234. Each time I send it it keeps coming back.....how doe I burn this coin or contract drone keep spamming me? – Carol Apr 21 '18 at 19:27
12

According to Jeff Wilcke, the right way to burn ETH is to create a contract which immediately self destructs and sends to its own address, or just send ether to his deployed contract which does it all for you:

https://etherscan.io/address/0xb69fba56b2e67e7dda61c8aa057886a8d1468575#code

Here's the code:

pragma solidity ^0.4.11;

contract Burner {
    uint256 public totalBurned;

    function Purge() public {
        // the caller of purge action receives 0.01% out of the
        // current balance.
        msg.sender.transfer(this.balance / 1000);
        assembly {
            mstore(0, 0x30ff)
            // transfer all funds to a new contract that will selfdestruct
            // and destroy all ether in the process.
            create(balance(address), 30, 2)
            pop
        }
    }

    function Burn() payable {
        totalBurned += msg.value;
    }
}

A simpler example without assembly is:

contract GetsBurned {

    function () payable {
    }

    function BurnMe () {
        // Selfdestruct and send eth to self, 
        selfdestruct(address(this));
    }
}

After calling BurnMe on the second example, you'll see that the address of the contract no longer has any balance or code. The ETH just vanishes!

4

In the case you need to destroy only tokens developed on Ethereum platform, this functionality may be embedded into the smart contract itself:

/**
 * @dev Burns a specific amount of tokens.
 * @param _value The amount of token to be burned.
 */
function burn(uint256 _value) public {
    require(_value > 0);
    require(_value <= balances[msg.sender]);
    // no need to require value <= totalSupply, since that would imply the
    // sender's balance is greater than the totalSupply, which *should* be an assertion failure

    address burner = msg.sender;
    balances[burner] = balances[burner].sub(_value);
    totalSupply = totalSupply.sub(_value);
    Burn(burner, _value);
}

Source - OpenZeppelin

You may want to embed some additional security check like verifying the address of the function caller if you develop your own centralized token.

1

Any address can work as long you can ensure that is impossible (or, better said, very improbable) to find the private key to it.

If for any reason you don't like 0x0000000000000000000000000000000000000000 as your burning address, you can accomplish the same thing by sending to any address with an obvious pattern, for example: 0x3737373737373737373737373737373737373737

  • 2
    There is no way to verify the private key was actually destroyed – Earlz Sep 18 '17 at 2:54

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.