Laurent Knauss Software Engineer
match burning illustration

Burning tokens refers to the process of 'destroying tokens' and thereby reducing the total supply of said token. This is often done to manage inflation, control supply, or adjust the value.

In Solidity, this is typically implemented by transferring tokens to a special, unspendable address, the zero address (0x0).

Example: ERC20.sol Burn Function

In this contract, the function that is of interest here is the _burn function.

/**
 * @dev Destroys a value amount of tokens from account, lowering the total supply.
 * Relies on the internal '_update' function.
 */ 

function _burn(address account, uint256 value) internal {
    if (account == address(0)) {
        revert ERC20InvalidSender(address(0));
    }
    _update(account, address(0), value);
}

Key points of this function

  • address account: address from which tokens will be removed (i.e burned).
  • uint256 value: amount of tokens to be burned.
  • address(0): In Ethereum, the zero address is a special address used for purposes like burning or to signal the absence of an address. In the 'burn' function, the zero address is used to signal the removal of tokens from circulation.
  • if (account == address(0)) { revert ERC20InvalidSender(address(0)); }: This line checks if the account provided is the zero address. Burning tokens from the zero address is invalid because it makes no sense to remove tokens from an account that doesn't hold them. If the account is the zero address, the function reverts.
  • _update(account, address(0), value);: This is where the actual token burning occurs. The function effectively transfers the value amount of tokens from the account to the zero address. By transferring tokens to the zero address, they are destroyed because there is no private key associated with the zero address, meaning no one can ever recover or use those tokens again.

Why use the zero address?

  • No Ownership: The zero address is unowned, meaning that there is no private key that can sign transactions to spend tokens from this address. Therefore, any tokens sent to the zero address are effectively lost forever and cannot be recovered or spent by anyone, making it ideal for burning purposes.
  • Transparency: By using the zero address, the burning of tokens is completely transparent and verifiable on the blockchain. Anyone can look at the contract's logs and see that tokens have been transferred (as long as an event for the transfer has been emitted in the .sol file) to the zero address, confirming that those tokens were destroyed.
  • Standard Practice: Using the zero address to burn tokens is part of the ERC-20 standard and is recognized across the Ethereum ecosystem. Other developers, users, and blockchain tools understand that tokens transferred to the zero address are no longer part of the circulating supply, making this approach easy to follow and integrate into wallets, dApps, and analytics tools.
krugerrand coin illustration

From code to real-life - A brick-and-mortar scenario for a 'burn' function

Here is a scenario that demonstrates the concept of asset-backed NFTs and how they can be redeemed and burned to claim the underlying physical asset—in this case, let's take gold. Let's elaborate on how this works, particularly in the context of burning NFTs and the use of the zero address.

Asset-Backed NFTs

The NFT in this scenario represents ownership or entitlement to a tangible asset, like gold. Here's how the process would typically work:

  • Minting the NFT: Initially, a web3 company mints an NFT that is pegged to a specific quantity of gold—in our scenario, let's say 2 ounces. This NFT might contain metadata that specifies its backing in gold, including information like serial numbers, gold purity, or even information about where the gold is stored (in which LMBA vaults).
  • Buying the NFT: An online customer buys the NFT, either from the company website directly or on a secondary market like OpenSea. Upon buying, the NFT is transferred to the customer's wallet, and it serves as proof of ownership of the equivalent 2 ounces of gold.
  • Redeeming the Gold: Upon deciding to redeem the gold, our customer visits the company's physical store (e.g., a brick-and-mortar gold coin shop). At this point, the customer wants to exchange their NFT for the actual physical gold coins.
  • Burning the NFT: To claim the physical gold, the NFT needs to be burned. Burning the NFT involves sending it to the zero address (0x0) or using a burn function implemented in the NFT's smart contract. By burning the NFT, the company effectively removes it from circulation, making it unusable and ensuring that it cannot be resold or transferred.
    The Ethereum Zero Address & Token Burning | Laurent