Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provable Burn: ERC20 Extension #661

Closed
alex-miller-0 opened this issue Jul 2, 2017 · 6 comments
Closed

Provable Burn: ERC20 Extension #661

alex-miller-0 opened this issue Jul 2, 2017 · 6 comments
Labels

Comments

@alex-miller-0
Copy link

alex-miller-0 commented Jul 2, 2017

Title

EIP: 661
Title: Provable Burn of ERC20 Tokens
Author: Alex Miller
Created: 2017-07-01
Version: 3

Specification

A provableBurn function is added to an ERC20 token such that the owner of this token may sign a message to burn a certain number of tokens. This is an extension of ERC20 using the proposed provable_ standard from #662 .

function provable_burn(bytes32[3] sig, uint256 value) returns (bool) {
  // ABI definition of this function
  bytes32 word = 0xc1644b1f;
  address signer = ecrecover(msg, uint8(data[2]), data[0], data[1]); 
  uint nonce = nonces[signer];
  bytes32 msg = sha3(sha3(uint(value)), bytes4(word), address(this), uint(nonce));
  
  // Replay protection
  if (played[signer][msg] == true) { return false; }      
  
  // Update state variables
  played[signer][msg] = true;
  nonces[signer] += 1;

  // Burn tokens
  balances[owner] = safeSub(balances[owner], value);
  supply = safeSub(supply, value);
  Transfer(owner, 0, value);

  return true;
}

No tokens are moved during the burn. Rather, the number of atomic token units burned is simply subtracted both from the user's balance and from the total supply.

Rationale

Some token systems may desire to have users burn some number of tokens to unlock certain rewards. This uses the event emission proposed in #621, namely transfer to the zero address and requires the owner of the tokens to sign a message that proves the desire to burn them.

Per #662, calling of provable_burn may be outsourced with a signed message and played by any actor with the message. This includes a contract that might require this provable burn to happen before initiating an internal mechanism.

@alexvandesande
Copy link

alexvandesande commented Jul 3, 2017

Mmm I see two things happening here:

  1. A function to burn tokens. This is indeed useful, as it's more deliberate than sending to a unretrivable address. Actually @evertonfraga added that to the ethereum.org/token example, after he added a trigger preventing accidentally sending to the zeroth address

  2. Ability to execute token actions via signing messages. This is very useful too, but it could be extended to all other functions: move tokens, approve transactions, etc just by signing so the user doesn't need to pay gas

In my opinion these can be discussed separately

@alex-miller-0
Copy link
Author

@alexvandesande Thanks for the comments. I opened a new EIP for the more abstract set of provable functions.

Please consider this EIP a discussion of the burn function proposed.

@vessenes
Copy link

I like this, but I'd like to recommend there be an optional metadata section here - we are working on a number of mechanisms which would like to attach some sort of data to a burn function. Happy to work up a proposed bit of code if desired.

@jpantunes
Copy link

I like this and I wanted to contribute with a suggestion for an alternative way of assuring replay protection:
// Replay protection
require(played[signer][msg] == false);

@github-actions
Copy link

github-actions bot commented Jan 2, 2022

There has been no activity on this issue for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

@github-actions github-actions bot added the stale label Jan 2, 2022
@github-actions
Copy link

This issue was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants