0

I have seen two burnable ERC20-compatible token patterns:

  1. implement a burn function that decreases balances[msg.sender] and totalBalance
  2. Don't implement burn function but rather transfer tokens (that you want to burn) to 0x0 address and implement 'totalBalance()function astotalBalance - balances[0x0]`

Which one is preferred? Why would I choose one over the other?

1

They both seem equally as sound in terms of design and security, but decreasing the balance seems less expensive.

0

Don't implement burn function but rather transfer tokens (that you want to burn) to 0x0 address and implement 'totalBalance()function astotalBalance - balances[0x0]`

I'll not prefer 2nd one, there is a catch in this method. Let's assume in future some one created account address 0, then he will get access for all burn coins. Some of the people are following this process because its easy track who is burning coin's using https://etherscan.io or any block explorer. People are saying its not possible to create an account with 0x address.

implement a burn function that decreases balances[msg.sender] and totalBalance This is one of the best way to burn coins and your not transfer to any one account, i.e its actually burning coins from the chain(changes will happens from block).

So I'll recommend 1st one, we should not take any risk in Crypto world.

  • I don't think it's possible to "create" address 0x if you know how ethereum addresses are created. They are derived from your public key, and your public key is devices from your private key. I don't believe you can get a 0x0 public key from any private key. – Andrey Feb 16 '18 at 6:03
  • I know practically creating 0x is not possible now. But theoretically its possible. As per economics transfer is not burn. Thats a reason I'll recommend 1 st option. – Jitendra Kumar. Balla Feb 16 '18 at 6:07
  • You theoretically can end up with the address 0, because you could happen to find a private key whose corresponding public key's hash had 20 zeroes at the end, but the odds of this are astronomical (like so astronomical there's no real chance of it happening). But Ethereum may disallow this address anyway, given that it's hardwired as the to address of contract creation transactions. (My guess is the code doesn't bother with this case, since it's basically impossible anyway.) – user19510 Feb 16 '18 at 6:08
  • @JitendraKumar.Balla If you believe that creating the address 0 is not possible, why did you write "Let's assume in future some one created account address 0, then he will get access for all burn coins?" – user19510 Feb 16 '18 at 6:08
  • @smarx Updated comment. – Jitendra Kumar. Balla Feb 16 '18 at 6:10

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.