1

Suppose you received 250 HELLOCoins and you want to burn them. Unfortunately, HELLOCoins uses OpenZeppelin ERC20 which implements the following function:

  function _transfer(address from, address to, uint256 value) internal {
        require(to != address(0));

        _balances[from] = _balances[from].sub(value);
        _balances[to] = _balances[to].add(value);
        emit Transfer(from, to, value);
    }

The require "to" to be different from 0x0 means that you can't send any ERC20 to 0x0, therefore not burn HELLOCoins.

Which of the following alternatives are better and would the second option ever work?

  1. Send to 0x0000000000000000000000000000000000000001 (the first address after 0x0. Does someone own this address? There is nothing on the internet about it)
  2. Create another smart contract which reads the ERC20 address of HELLOCoins. The smart contract calls a sendTo function which does not implement the "require(to != address(0))" part. I am skeptic this would work but I would like to know.
  3. Any other solution to burn HELLOCoins?
2

Option 1 seems like the simplest option, but Ethereum has "precompiles" (hardcoded smart contract like keccak256 etc.) at some of those low-numbered addresses. If you want to avoid those, you could pick a bigger address. If you just want the tokens inaccessible, it doesn't matter what address you pick, as long as no one has the private key. But if you want to convince other people that you don't have the private key, be sure to pick something that looks non-random, like 0xFFFFFF... or 0x00000000000000000000000000000000DEADBEEF.

Option 2 won't work.

Another alternative is to create a smart contract that can't call transfer, e.g. just contract BurnAddress { /* nothing here, so tokens can't be retrieved */ }. Deploy that and send the tokens there.

  • I looked into the Ethereum precompiles which I wasn't aware of. Is there a way these "precompiles" can affect tokens sent to a given address? – Cristian Jan 22 at 1:47
  • Nothing I can think of. It's probably fine to send your tokens to address 1. – smarx Jan 22 at 1:49

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.