Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ERC7837, a proposal for an ERC20-like fungible token called DIFF that mints new tokens on transfer without reducing the sender's balance.

This article translates, summarizes, and expands on the specification below.

I have also written about other EIPs.

Overview

ERC7837 introduces a type of fungible token called Diffusive Tokens (DIFF). Unlike conventional ERC20 tokens, sending DIFF tokens does not decrease the sender's balance. Instead, new tokens are minted to the recipient, increasing the total supply.

Supply cannot grow without limit under a given cap. The issuer sets a maximum supply, and issuance may increase only within that limit. When initiating a transfer, the sender must also pay a fee in the native currency (such as ETH). The fee accrues to the contract owner (issuer), providing a potential revenue stream. Token holders can also voluntarily burn their tokens to reduce the total supply.

DIFF is therefore more than a mechanism for sending and receiving tokens. Its supply changes dynamically, and its token model incorporates economic incentives.

Motivation

Conventional ERC20 tokens have a fixed supply or a supply managed through the contract. Transfers move ownership of existing units. DIFF models the diffusion of value by expanding supply when tokens are transferred.

For example, tokenizing product distribution or the delivery of digital goods could allow more flexible distribution models through dynamic supply adjustments. Suppose a company issues tokens representing a product and enables users to transact with them. With DIFF, each transfer can mint additional units, expanding their circulation.

A fee on each transfer can also discourage repeated transfers solely to increase supply. A maximum supply limits issuance, although a cap does not by itself guarantee price stability or prevent inflation while supply remains below the cap.

Practical use cases

The DIFF mechanism could be applied in several situations.

One is the tokenization of real-world assets. Consider products available in limited quantities, such as smartphones or limited-edition merchandise. A manufacturer could create DIFF tokens representing a batch of 1,000 iPhone 15 units. Receiving a token could represent a reservation or a claim to a physical product. A holder could then burn the token when redeeming it for the actual item. The issuer would also need to enforce inventory and redemption accounting outside or alongside the token contract so that repeat minting after burns cannot create more claims than available stock.

Transfer fees can also be used to design incentives. Charging a fee whenever tokens are sent discourages unnecessary transfers and encourages users to submit transactions that serve a purpose. The issuer receives these fees as revenue and can use them to fund ongoing operations.

By dynamically managing token supply and combining distribution with economic incentives, DIFF offers a different way to structure a token economy.

Specification

Terminology

DIFF token

A special type of fungible token whose units are minted upon transfer. With traditional ERC20, the sender's balance decreases while the recipient's balance increases. With DIFF, the sender's balance remains unchanged and newly minted tokens are credited to the recipient.

Maximum supply (Max Supply)

The upper limit on the token's outstanding supply. The issuer sets this value, and the total supply cannot exceed the cap. This prevents unbounded supply growth under an unchanged limit.

Transfer Fee

A fee incurred whenever tokens are sent. The sender pays it in the native currency, such as ETH. The total fee is calculated as transferFee * amount. The transaction fails if the sender does not provide sufficient ETH.

Burn

The permanent destruction of token units. A holder can burn an amount of tokens from their balance, reducing both that balance and the total supply. This can be used to adjust supply or as part of a process for redeeming tokens for the goods or services they represent.

Data structures

DIFF tokens have variables for the current total supply (totalSupply) and the maximum supply (maxSupply).

  • totalSupply
    • The total amount of tokens currently outstanding.
    • Increases when tokens are transferred and decreases when tokens are burned.
  • maxSupply
    • The supply cap. New issuance cannot cause the total supply to exceed this value.

The transferFee variable records the fee per token unit transferred, expressed in the smallest denomination of the native currency (for ETH, wei). The contract owner (owner) controls the configuration and updates of this fee.

Token behavior

The defining feature of DIFF tokens is that new tokens are minted on transfer. A conventional ERC20 transfer decreases the sender's balance and increases the recipient's balance. DIFF behaves differently.

When A sends tokens to B, A's balance remains unchanged while new tokens are minted to B. At the same time, totalSupply increases by the amount sent. The transaction reverts if this would cause totalSupply to exceed maxSupply.

A transfer also requires payment in the native currency equal to the amount transferred multiplied by transferFee. If msg.value (the ETH supplied with the call) is insufficient, the transaction fails. This creates an economic disincentive against repeatedly minting new tokens through transfers.

Tokens may also be burned. Holders can burn tokens up to their balance, reducing both their holdings and totalSupply. Burning can increase scarcity and support redemption of tokens for particular goods or services when the associated redemption system is implemented.

Interface and administrative functions

DIFF adopts familiar ERC20 function signatures, including balanceOf and transfer, while redefining transfer behavior. This is not an ordinary Solidity override of ERC20's nonpayable transfer function, because the DIFF transfer function is payable.

  • balanceOf(address account)
    • Retrieves the token balance of the specified address.
  • transfer(address to, uint256 amount)
    • Sends amount token units to the specified address.
    • Unlike a conventional ERC20 transfer, it leaves the sender's balance unchanged and mints new tokens to the recipient.
    • Requires msg.value >= transferFee * amount.
  • burn(uint256 amount)
    • Burns the specified amount of tokens.
    • Reduces the holder's balance and totalSupply.

Administrative functions are restricted to the administrator (token issuer).

  • setMaxSupply(uint256 newMax)
    • Updates the maximum supply.
  • setTransferFee(uint256 newFee)
    • Updates the fee charged on transfers.
  • withdrawFees(address payable recipient)
    • Sends accumulated fees to the specified recipient.

Event design

DIFF tokens emit events when specific actions occur.

  • Transfer(address indexed from, address indexed to, uint256 amount)

When transfer executes, new tokens are minted to the address specified by to. Unlike a conventional ERC20 mint event, the DIFF event identifies the sender in from instead of using the zero address.

  • Burn(address indexed burner, uint256 amount)

Emitted when tokens are burned.

  • FeeUpdated(uint256 newFee)

Emitted when transferFee is updated.

  • MaxSupplyUpdated(uint256 newMaxSupply)

Emitted when maxSupply is updated.

Compatibility with ERC20

As described above, DIFF mints new units on transfer without reducing the sending address's balance.

Fungibility

DIFF tokens are fungible, like ERC20 tokens. They can also represent fractional units and support decimal precision in the same way as conventional ERC20 tokens.

Balances and transfers

The DIFF balanceOf function reports the amount held by a specified address, just as in ERC20. However, transfer and transferFrom have substantially different behavior.

In a conventional ERC20, executing transfer reduces the sender's balance and increases the recipient's balance. DIFF leaves the sender's balance unchanged and mints new units to the recipient. For example, if A sends 100 DIFF tokens to B, A's balance stays the same and B's balance increases by 100. The totalSupply also increases by 100. The transaction fails if the new supply would exceed maxSupply.

Approvals

DIFF also defines an optional compatibility interface with the familiar ERC20 functions approve and transferFrom. Under conventional ERC20, approve grants another address permission to spend tokens on the owner's behalf, and transferFrom uses that permission to move tokens. The DIFF mechanism is different because the sender's balance does not decrease.

For example, after approve(spender, 100) in a conventional ERC20, spender can use transferFrom to send up to 100 tokens to another party. In DIFF, a call to transferFrom instead mints new tokens to to without reducing the balance of the source address. The allowance therefore authorizes issuance rather than spending existing token units.

Scope of ERC20 compatibility

The familiar function signatures can help DIFF integrate with existing wallets and contracts. However, the differences in transfer behavior require careful handling by ERC20-based applications.

The compatibility is partial: ordinary ERC20 tools may fail to supply the required native-currency fee or may assume that a transfer debits the sender. The optional approval interface and altered event semantics also require explicit support.

Economic differences

Although DIFF resembles ERC20 at the interface level, its economic model is fundamentally different. Conventional ERC20 supply may be fixed or controlled through issuance and burning. DIFF automatically increases supply through transfers, requiring a different approach to supply management. Care is needed when combining DIFF with conventional ERC20-based liquidity provision or token reward mechanisms.

Transfer fees also affect DIFF circulation. Conventional ERC20 transfers typically incur network gas fees, whereas DIFF imposes an additional native-currency charge (such as ETH). Frequent transfers therefore face an additional economic cost. This discourages unnecessary transfers while generating revenue for the issuer.

Additional details

DIFF is designed to increase token supply on transfer. Because unlimited issuance would make inflation difficult to control, the maximum supply (maxSupply) limits supply expansion under the configured cap.

A burn mechanism also makes it possible to remove tokens from circulation when appropriate. This allows supply reduction and token redemption (redeem) mechanisms to be built for specific purposes. For example, tokens linked to real-world assets (RWAs) could be burned as part of an exchange for physical goods or services.

Another characteristic of DIFF is that the issuer (owner) can adjust the fee and maximum supply. Changing fees in response to market conditions can influence token circulation and economic incentives. If circulation grows too quickly, the issuer could raise the fee to discourage unnecessary transactions. Conversely, lowering the fee could encourage wider distribution.

Reference implementation

DiffusiveToken.sol
contract DiffusiveToken {
  // -----------------------------------------
  // State Variables
  // -----------------------------------------

  string public name;
  string public symbol;
  uint8 public decimals;

  uint256 public totalSupply;
  uint256 public maxSupply;
  uint256 public transferFee; // Fee per token transferred in wei

  address public owner;

  // -----------------------------------------
  // Events
  // -----------------------------------------

  event Transfer(address indexed from, address indexed to, uint256 amount);
  event Burn(address indexed burner, uint256 amount);
  event FeeUpdated(uint256 newFee);
  event MaxSupplyUpdated(uint256 newMaxSupply);
  event Approval(address indexed owner, address indexed spender, uint256 value);

  // -----------------------------------------
  // Modifiers
  // -----------------------------------------

  modifier onlyOwner() {
      require(msg.sender == owner, "DiffusiveToken: caller is not the owner");
      _;
  }

  // -----------------------------------------
  // Constructor
  // -----------------------------------------

  /**
   * @dev Constructor sets the initial parameters for the Diffusive Token.
   * @param _name Token name
   * @param _symbol Token symbol
   * @param _decimals Decimal places
   * @param _maxSupply The max supply of tokens that can ever exist
   * @param _transferFee Initial fee per token transferred in wei
   */
  constructor(
      string memory _name,
      string memory _symbol,
      uint8 _decimals,
      uint256 _maxSupply,
      uint256 _transferFee
  ) {
      name = _name;
      symbol = _symbol;
      decimals = _decimals;
      maxSupply = _maxSupply;
      transferFee = _transferFee;
      owner = msg.sender;
      totalSupply = 0; // Initially, no tokens are minted
  }

  // -----------------------------------------
  // External and Public Functions
  // -----------------------------------------

  /**
   * @notice Returns the token balance of the given address.
   * @param account The address to query
   */
  function balanceOf(address account) external view returns (uint256) {
      return balances[account];
  }

  /**
   * @notice Transfers `amount` tokens to address `to`, minting new tokens in the process.
   * @dev Requires payment of native currency: transferFee * amount.
   * @param to Recipient address
   * @param amount Number of tokens to transfer
   * @return True if successful
   */
  function transfer(address to, uint256 amount) external payable returns (bool) {
      require(to != address(0), "DiffusiveToken: transfer to zero address");
      require(amount > 0, "DiffusiveToken: amount must be greater than zero");

      uint256 requiredFee = transferFee * amount;
      require(msg.value >= requiredFee, "DiffusiveToken: insufficient fee");

      // Check max supply limit
      require(totalSupply + amount <= maxSupply, "DiffusiveToken: would exceed max supply");

      // Mint new tokens to `to`
      balances[to] += amount;
      totalSupply += amount;

      emit Transfer(msg.sender, to, amount);
      return true;
  }

  /**
   * @notice Burns `amount` tokens from the caller's balance, decreasing total supply.
   * @param amount The number of tokens to burn
   */
  function burn(uint256 amount) external {
      require(amount > 0, "DiffusiveToken: burn amount must be greater than zero");
      require(balances[msg.sender] >= amount, "DiffusiveToken: insufficient balance");

      balances[msg.sender] -= amount;
      totalSupply -= amount;

      emit Burn(msg.sender, amount);
  }

  /**
   * @notice Approves `spender` to transfer up to `amount` tokens on behalf of `msg.sender`.
   * @param spender The address authorized to spend
   * @param amount The max amount they can spend
   */
  function approve(address spender, uint256 amount) external returns (bool) {
      require(spender != address(0), "DiffusiveToken: approve to zero address");
      allowances[msg.sender][spender] = amount;
      emit Approval(msg.sender, spender, amount);
      return true;
  }

  /**
   * @notice Returns the current allowance of `spender` for `owner`.
   * @param _owner The owner of the tokens
   * @param _spender The address allowed to spend the tokens
   */
  function allowance(address _owner, address _spender) external view returns (uint256) {
      return allowances[_owner][_spender];
  }

  /**
   * @notice Transfers `amount` tokens from `from` to `to` using the allowance mechanism.
   * @dev The `from` account does not lose tokens; this still mints to `to`.
   * @param from The address from which the allowance has been given
   * @param to The recipient address
   * @param amount The number of tokens to transfer (mint)
   */
  function transferFrom(address from, address to, uint256 amount) external payable returns (bool) {
      require(to != address(0), "DiffusiveToken: transfer to zero address");
      require(amount > 0, "DiffusiveToken: amount must be greater than zero");

      uint256 allowed = allowances[from][msg.sender];
      require(allowed >= amount, "DiffusiveToken: allowance exceeded");

      // Deduct from allowance
      allowances[from][msg.sender] = allowed - amount;

      uint256 requiredFee = transferFee * amount;
      require(msg.value >= requiredFee, "DiffusiveToken: insufficient fee");

      // Check max supply
      require(totalSupply + amount <= maxSupply, "DiffusiveToken: would exceed max supply");

      // Mint tokens to `to`
      balances[to] += amount;
      totalSupply += amount;

      emit Transfer(from, to, amount);
      return true;
  }

  // -----------------------------------------
  // Owner Functions
  // -----------------------------------------

  /**
   * @notice Updates the maximum supply of tokens. Must be >= current totalSupply.
   * @param newMaxSupply The new maximum supply
   */
  function setMaxSupply(uint256 newMaxSupply) external onlyOwner {
      require(newMaxSupply >= totalSupply, "DiffusiveToken: new max < current supply");
      maxSupply = newMaxSupply;
      emit MaxSupplyUpdated(newMaxSupply);
  }

  /**
   * @notice Updates the per-token transfer fee.
   * @param newFee The new fee in wei per token transferred
   */
  function setTransferFee(uint256 newFee) external onlyOwner {
      transferFee = newFee;
      emit FeeUpdated(newFee);
  }

  /**
   * @notice Allows the owner to withdraw accumulated native currency fees.
   * @param recipient The address that will receive the withdrawn fees
   */
  function withdrawFees(address payable recipient) external onlyOwner {
      require(recipient != address(0), "DiffusiveToken: withdraw to zero address");
      uint256 balance = address(this).balance;
      (bool success, ) = recipient.call{value: balance}("");
      require(success, "DiffusiveToken: withdrawal failed");
  }

  // -----------------------------------------
  // Fallback and Receive
  // -----------------------------------------

  // Allows the contract to receive Ether.
  receive() external payable {}
}

Security

Reentrancy protection

Token transfers incur fees that ultimately belong to the contract owner. Sending funds to an external address, including withdrawing accumulated fees, can introduce a reentrancy risk. A reentrancy attack occurs when an external contract receiving funds unexpectedly calls back into the DIFF contract before the original operation finishes, potentially allowing an unauthorized withdrawal.

The Checks-Effects-Interactions pattern is an important defense. It orders operations as follows.

  1. Check whether the operation is valid (Checks).
  2. Update the necessary state (Effects).
  3. Interact with external addresses, for example by sending funds (Interactions).

Following this order helps prevent unauthorized withdrawals if a malicious contract attempts to reenter during an operation. OpenZeppelin's ReentrancyGuard can also prevent nested reentrant calls to protected functions. It does not prohibit multiple sequential calls within the same transaction.

Preventing overflow and underflow

Integer overflow (exceeding the maximum representable value) and underflow (going below zero for an unsigned integer) can introduce vulnerabilities. Solidity 0.8 and later revert by default when arithmetic overflows or underflows, outside an unchecked block.

Calculations such as enforcing maxSupply or computing transfer fees should use explicit validation where necessary to prevent unintended numerical operations.

Managing contract funds

DIFF requires callers to pay fees when transferring tokens. Each transaction must therefore verify that sufficient native currency (such as ETH) was supplied and revert if the amount is insufficient.

Specifically, the transaction must be rejected if msg.value is less than transferFee * amount. This prevents transactions with insufficient fees from succeeding and avoids unexpected contract behavior. When withdrawing collected fees from the contract to the owner or designated recipient, the payment logic must also be managed carefully to avoid unintentionally losing funds.

Enforcing access control

The transferFee and maxSupply variables are central to the token's economic model. Because they substantially affect circulation and incentives, access control must prevent unauthorized changes.

Only the issuer (owner) should be permitted to update these variables. An onlyOwner modifier is one way to prevent non-administrative accounts from modifying them. Without appropriate controls, anyone could set fees to zero or continually increase the supply cap.

Concentrating too much authority in the owner also introduces risk. A multisignature account can be used when appropriate so that significant changes require approval from multiple administrators.

References

James Savechives (@jamesavechives), "ERC-7837: Diffusive Tokens [DRAFT]," Ethereum Improvement Proposals, no. 7837, December 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7837.

The citation above preserves the original article's historical attribution and draft designation. The specification is now listed as Final.

Conclusion

This article examined ERC7837, a standard for ERC20-like fungible tokens called DIFF that mint new units on transfer without reducing the sender's balance.

If you have questions, feel free to contact me via Twitter direct message.

Twitter @cardene777

I also write on the following platforms.

https://chaldene.net/