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 covers ERC7699, a proposal for attaching a reference that identifies what a payment is for to an ERC20 transfer.

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

I also cover a range of EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.

Overview

ERC7699 extends ERC20 token transfers to carry a payment reference. A payment reference is a short message or identifier that indicates what the transfer is paying for. Examples include invoice numbers, order numbers, and transaction purposes.

For background on ERC20, see the following article.

[ERC20] An Introduction to ERC20

With standard ERC20, users can transfer tokens using transfer or transferFrom, but there is no standardized way to attach a message or purpose to the transfer. As a result, looking at a blockchain transaction alone does not tell you which invoice it corresponds to or which order it pays for.

ERC7699 addresses this problem with minimal changes. It adds methods that accept a reference during a transfer without breaking existing ERC20 behavior, making it possible to associate transfers with business records such as orders and invoices.

This enables the following:

  • Users can transfer tokens while explicitly specifying what the payment is for.
  • Recipients, including merchants and service providers, can easily match transfers to orders or invoices.
  • Accounting and payment reconciliation (determining which invoice a received payment settles) become easier.

Beyond improving the user experience, this extension is intended to make token use in real-world business operations more practical.

Motivation

The main reason for proposing ERC7699 is that standard ERC20 lacks functionality needed for practical payments.

Current limitations

When making payments with standard ERC20 tokens, information such as the payment purpose or invoice number is not recorded on-chain by the transfer interface. Many projects therefore take one of the following approaches:

  • Associate transfers with orders off-chain, using a database or administration interface.
  • Implement a custom smart contract, such as a payment proxy.

Both approaches are feasible, but have drawbacks:

  • Implementation can become complex.
  • Specifications differ from project to project.
  • Without standardization, tools and services cannot handle these references in a uniform way.

Comparison with traditional financial systems

In traditional financial systems, such as bank transfers, payment references are commonplace. Representative examples include:

System Field Content
SWIFT MT103 Field 70 (Remittance Information) A description of the purpose, such as payment for INVOICE 998877
SWIFT MT103 Field 72 (Sender to Receiver Information) Additional information from the sender to the receiver
ISO 20022 (SEPA) RmtInf (Remittance Information) Payment purpose or invoice information

These mechanisms allow businesses and individuals to identify the transaction a payment relates to by examining the transfer data alone.

What ERC7699 aims to achieve

ERC7699 aims to bring the convenience of these traditional financial systems to decentralized finance (DeFi) and token transfers.

Adding payment references to ERC20 is expected to:

  • Turn token transfers from simple asset movements into payments with a defined purpose.
  • Make tokens easier to use in commercial transactions and invoicing.
  • Connect on-chain and off-chain information without unnecessary complexity.

ERC7699 is a practical extension designed to bridge the gap between blockchain technology and existing financial operations. The goal is to integrate token payments more naturally into everyday transactions.

How it works

Applicable contracts

ERC7699 is designed as an extension to token contracts that comply with ERC20.

An ERC20 contract that supports ERC7699 must therefore implement the interface described below.

Interface

ERC7699 adds the following interface.

js
// The EIP-165 identifier of this interface is 0x1522573a

interface IERC7699 {

function transfer(address to, uint256 amount, bytes calldata transferReference) external returns (bool);

function transferFrom(address from, address to, uint256 amount, bytes calldata transferReference) external returns (bool);

event TransferReference(bytes32 indexed loggedReference);

}

ERC165 interface identifier

The interface supports ERC165 and has the identifier 0x1522573a. External contracts and tools can use this identifier to determine dynamically whether a token supports ERC7699.

For background on ERC165, see the following article.

[ERC165] Checking Whether a Contract Supports a Specific Interface

Extensions to transfer / transferFrom

ERC7699 extends the ERC20 functions transfer and transferFrom.

Additional parameter

Both functions accept the following additional parameter:

  • transferReference
    • Its type is bytes.
    • It represents a reference for the transfer, such as a payment purpose or invoice number.

These functions perform the same transfer operation as standard ERC20, with the addition of recording a reference in an event.

Rules for emitting the TransferReference event

Basic rule

When transfer or transferFrom is called, a TransferReference event must be emitted in addition to the normal transfer operation, subject to the empty-reference exception described below.

js
event TransferReference(bytes32 indexed loggedReference);

This event records the reference associated with the transfer in a log.

Ordering relative to the ERC20 Transfer event
  • The TransferReference event must be emitted before the ERC20 Transfer event.
  • Implementations should emit the Transfer event immediately afterward where possible.

This ordering makes it easier for clients and indexers to associate the two events.

Relationship between loggedReference and transferReference

The value of loggedReference does not have to be identical to transferReference.

Permitted behavior

  • If transferReference is 32 bytes or fewer, it may be converted directly to bytes32 and logged.
  • If transferReference is longer or contains structured data, a hash or another derived value may be emitted as loggedReference.

Consumers must not assume that transferReference and loggedReference are identical. The derivation method is left to the contract developer.

Data that can be stored in loggedReference

The loggedReference field has type bytes32, with no restriction on its contents.

  • It can hold any 32 bytes of data.
  • Its meaning depends on the application and its operational rules.

Handling an empty transferReference

The transferReference parameter may be empty.

A special rule applies in this case:

  • If transferReference is empty, → the TransferReference event must not be emitted.

This reproduces the behavior of a normal ERC20 transfer. When a reference is not needed, the token can therefore be used in exactly the same way as an existing ERC20 token.

Length of transferReference and gas costs

The specification does not impose a length limit on transferReference.

However, users are encouraged to use short references for the following reasons:

  • A longer reference increases the size of calldata.
  • It increases gas costs.

Declaring the TransferReference event

The TransferReference event must not be declared anonymous.

This preserves the following properties:

  • The event signature is included in the log.
  • Filtering and indexed searches remain possible.

Handling a transfer amount of 0

Even when the transfer amount is 0, it must be handled like a normal transfer.

Although balances do not change, if transferReference is non-empty, the TransferReference event must still be emitted.

Rationale

Parameter name

The name transferReference was chosen for ERC7699 to align with the concept of a payment reference, commonly used in traditional finance (TradFi), including bank transfers.

In banking, it is standard practice to attach a reference identifying what a payment is for. Recipients can match incoming funds to a particular order or invoice, simplifying payment confirmation and bookkeeping. ERC7699 serves the same purpose, so the name transferReference makes its intended use immediately recognizable.

Using established financial terminology is also intended to make the ERC20 extension easier to understand and adopt.

Parameter type

In ERC7699, transferReference has type bytes.

The type bytes32 was initially considered for two reasons:

  • References are generally short, so a fixed-size type would naturally encourage short references.
  • If a longer reference were needed, it could be hashed with Keccak-256 (a hash function commonly used in Ethereum) to fit into bytes32.

Ultimately, a fixed bytes32 was judged too restrictive, and bytes was selected instead. The bytes type has no fixed length limit and can carry structured data directly.

Here, structured data means combining several pieces of information into a single byte sequence, such as a reference and a signature. Including a signature makes it possible to design a system in which the recipient performs additional verification.

Data emitted in the event

In ERC7699, the event field loggedReference has type bytes32.

The option of including bytes calldata directly in the event was also considered. However, because event subscription filters use indexed topics, the reference would not appear directly in the log as an indexed value; the resulting topic would be in bytes32 format.

In other words, making the event filterable ultimately results in a bytes32 topic. Defining loggedReference as bytes32 from the outset therefore aligns with actual log processing.

Furthermore, bytes32 allows unhashed, human-readable references to be stored directly in the log if they fit within 32 bytes. This can be more convenient for short invoice or order numbers.

Compatibility

ERC7699 is fully backward compatible with existing ERC20. Backward compatibility means that new features can be added without breaking existing mechanisms or usage patterns.

Why it can coexist with existing transfer / transferFrom functions

ERC7699 does not replace the existing ERC20 transfer / transferFrom functions. Instead, it adds overloads that accept a reference. Normal transfers remain available, and reference-bearing transfers can be used only when needed.

Impact on upgradeable ERC20 tokens

ERC7699 is also designed to be easy to integrate into existing upgradeable ERC20 tokens. The specification explains that the feature can be added without affecting the storage layout.

The storage layout defines which slots hold a contract's state variables. In an upgradeable design, changing this arrangement incorrectly risks corrupting existing data. Because ERC7699 does not require such a change, it can be added through an upgrade relatively easily.

Adoption by new ERC20 tokens

New ERC20 tokens can choose whether to support references according to their intended use. Rather than making the feature mandatory for all tokens, the extension allows only tokens that need payment references to implement it.

Summary of design decisions

Aspect ERC7699 decision Rationale
Additional parameter name transferReference Familiar terminology for bank payment references
Additional parameter type bytes Supports both short text and structured data
Event field type bytes32 Aligns with log filtering while allowing readable references of up to 32 bytes
Backward compatibility Fully compatible Enables gradual adoption without disrupting existing ERC20 operations

Reference implementation

IERC7699.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.8.4 <0.9.0;

import {ERC20} from "@openzeppelin/token/ERC20/ERC20.sol";

interface IERC7699 {
    /**
     * @notice Emitted when a non-empty `transferReference` is added to the `transfer` call.
     */
    event TransferReference(bytes32 indexed loggedReference);

    /**
     * @notice Moves `amount` tokens from the caller's account to `to` with `transferReference`.
     *
     * @dev Returns a boolean value indicating whether the operation succeeded.
     *
     * MUST emit this ERCS's {TransferReference} event followed by a corresponding {ERC20.Transfer} event
     * (to comply with ERC-20).
     */
    function transfer(address to, uint256 amount, bytes calldata transferReference) external returns (bool);

    /**
     * @notice Moves `amount` tokens from `from` to `to` with `transferReference` using the
     * allowance mechanism. `amount` is then deducted from the caller's allowance.
     *
     * @dev Returns a boolean value indicating whether the operation succeeded.
     *
     * MUST emit this ERCS's {TransferReference} event followed by a corresponding {ERC20.Transfer} event
     * (to comply with ERC-20).
     */
    function transferFrom(address from, address to, uint256 amount, bytes calldata transferReference)
        external
        returns (bool);
}

/**
 * @dev Implementation of the ERC20 transfer reference extension.
 */
contract ERC20TransferReference is ERC20, IERC7699 {
    constructor() ERC20("ERC20 Transfer Reference Example", "TXRE") {
        _mint(msg.sender, 987654321 * 1e18);
    }

    /**
     * @dev Emits `TransferReference` event with derived `loggedReference` data
     */
    function _logReference(bytes calldata transferReference) internal virtual {
        // MUST NOT emit when transferReference is empty
        if (transferReference.length > 0) {
            // Effectively extract first 32 bytes from transferReference calldata bytes
            // Note: This is the example. Derivation of the loggedReference is fully up to the implementation.
            // E.g. keccak hash of the whole transferReference, etc.
            bytes32 loggedReference;
            // solhint-disable-next-line no-inline-assembly
            assembly {
                loggedReference := calldataload(transferReference.offset)
            }

            emit TransferReference(loggedReference);
        }
    }

    /**
     * @notice A standard ERC20 token transfer with an optional transfer reference
     * @dev The underlying `transfer` function is assumed to handle the actual token transfer logic.
     * @param to The address of the recipient where the tokens will be sent.
     * @param amount The number of tokens to be transferred.
     * @param transferReference A bytes field to include a transfer reference, reference signature or other relevant
     * reference data.
     * @return A boolean indicating whether the transfer was successful.
     */
    function transfer(address to, uint256 amount, bytes calldata transferReference) public virtual returns (bool) {
        _logReference(transferReference);

        // ERC20.Transfer event is emitted immediately after TransferReference event
        return transfer(to, amount);
    }

    /**
     * @notice A delegated token transfer with an optional transfer reference
     * @dev Requires prior approval from the token owner. The underlying `transferFrom` function is assumed to handle
     * allowance and transfer logic.
     * @param from The address of the token owner who has authorized the transfer.
     * @param to The address of the recipient where the tokens will be sent.
     * @param amount The number of tokens to be transferred.
     * @param transferReference A bytes field to include a transfer reference, reference signature or other relevant
     * reference data.
     * @return A boolean indicating whether the transfer was successful.
     */
    function transferFrom(address from, address to, uint256 amount, bytes calldata transferReference)
        public
        virtual
        returns (bool)
    {
        _logReference(transferReference);

        // ERC20.Transfer event is emitted immediately after TransferReference event
        return transferFrom(from, to, amount);
    }
}

Security considerations

Privacy considerations

Privacy of reference data

Including a transfer reference in ERC7699 may expose sensitive information about a transaction or its participants. The important point is to treat the reference as information that will be recorded on-chain and made public.

Implementers and users must therefore consider whether a reference includes sensitive data. Examples include invoice numbers that reveal information about customers or transaction activity and references that disclose the purpose of a payment.

The specification suggests considering privacy-enhancing technologies, such as encryption, to protect reference data and reduce this risk. Here, encryption means avoiding readable plaintext references so that third parties cannot easily infer their contents.

Example: inferring meaning from public logs

If the value 0x20240002 is recorded in a log as a reference, observers may be able to infer its meaning.

In the specification's example, publishing this reference reveals that the payment relates to the recipient's second invoice in 2024. Even short references can therefore expose transaction context depending on the operational conventions used.

Tampering with and misuse of payment references

Reference validation is not standardized

ERC7699 does not define validation rules that require a reference to follow a particular format or contain a correct value. An attacker could therefore send tokens with a malicious reference and mislead users, merchants, or service providers.

Potential problems

The specification identifies two possible consequences of reference misuse:

Risk What can happen Impact on the beneficiary
Legal risks An attacker uses illicit funds and a reference to make the recipient appear involved or create the impression that the recipient participates in illicit activity, such as money laundering. Increased legal and compliance risks, suspicion, and potentially the need to respond to an investigation.
Disputes and refunds After a transfer, a user realizes they did not make the payment and requests a refund or raises a dispute. Increased administrative work and associated costs for the recipient.

Mitigation

The specification suggests that implementers consider the following approaches to reduce these risks:

  • Provide a way to identify the legitimate sender.
  • Consider a mechanism for generating unique, verifiable references.

Citation

Radek Svarz (@radeksvarz), "ERC-7699: ERC-20 Transfer Reference Extension [DRAFT]," Ethereum Improvement Proposals, no. 7699, April 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7699.

Conclusion

This article covered ERC7699, a proposal for attaching references that identify what a payment is for to ERC20 transfers. I hope you found it useful.

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

Twitter @cardene777

I also publish on the following platforms: