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 ERC2021, a proposal that lets token holders initiate payout requests on-chain and token operators process them.

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

I have also covered a range of other EIPs.

Overview

ERC2021 proposes an extension to ERC20 that allows token holders to request payouts from their own wallets. A smart contract receives the payout request along with a payout instruction string.

This makes the lifecycle of a payout, from the initial request to execution, traceable on-chain and visible as a decentralized process.

A token wallet holder or their representative initiates a payout by calling orderPayout or orderPayoutFrom on the smart contract. The caller supplies information identifying the payout destination as a payout instruction string. The operator (on the token issuer's side) uses this string as supplementary information when processing the actual payment.

Publishing payout instructions directly on-chain poses a security risk. The proposal therefore recommends supplying encrypted instructions or using another secure communication channel, such as private messaging or encrypted storage.

Actors

  • Token wallet holder An individual or company that can initiate payout requests from its own wallet.
  • Token contract owner or representative The organization or entity that issues and manages the token, reads payout requests, and processes them accordingly.
  • Orderer A person or entity authorized to initiate payout requests on behalf of the token wallet holder.

Motivation

Traditionally, token payouts have depended on procedures in centralized systems, requiring separate communication and processing to execute. ERC2021 moves the initiation of payout requests on-chain, offering the following benefits.

  • Payout initiation and progress become visible on-chain, making the process traceable.
  • Much of the token lifecycle, including issuance, burning, and transfers, can be handled in a decentralized manner.
  • Smart contracts handle the processing of payout instructions.

Payout Request Lifecycle and Status

Once a payout is requested, it passes through several steps and changes state. The status transitions at each stage are as follows.

  • Ordered When a request is initiated, the relevant tokens are temporarily placed on hold and preparations for the payout begin. The payout has not yet been executed.
  • InProcess The operator has begun processing the request. At this point, the requester (the orderer) can no longer cancel it.
  • FundsInSuspense Once the payout is ready for execution, the relevant tokens are moved to a temporary holding account (the suspense wallet).
  • Executed The operator makes the actual payment off-chain and burns the corresponding tokens from the suspense wallet. This completes the payout.
  • Rejected If the operator rejects the payout request, it enters this state and the held tokens are returned to the wallet holder.
  • Cancelled This state applies when the orderer withdraws the request. Cancellation is possible only before the request enters InProcess.

Security and Design Considerations

Writing plaintext payout instructions on-chain risks exposing sensitive information. The payout destination and detailed instructions should therefore be supplied using one of the following approaches.

  • Use an encrypted payout instruction string.
  • Communicate the instructions through a private channel agreed upon with the token operator in advance.
  • Design the smart contract so that it does not interpret the instructions themselves.

Specification

js
interface IPayoutable /* is ERC-20 */ {
    enum PayoutStatusCode {
        Nonexistent,
        Ordered,
        InProcess,
        FundsInSuspense,
        Executed,
        Rejected,
        Cancelled
    }
    function authorizePayoutOperator(address orderer) external returns (bool);
    function revokePayoutOperator(address orderer) external returns (bool);
    function orderPayout(string calldata operationId, uint256 value, string calldata instructions) external returns (bool);
    function orderPayoutFrom(string calldata operationId, address walletToBePaidOut, uint256 value, string calldata instructions) external returns (bool);
    function cancelPayout(string calldata operationId) external returns (bool);
    function processPayout(string calldata operationId) external returns (bool);
    function putFundsInSuspenseInPayout(string calldata operationId) external returns (bool);
    function executePayout(string calldata operationId) external returns (bool);
    function rejectPayout(string calldata operationId, string calldata reason) external returns (bool);

    function isPayoutOperatorFor(address walletToDebit, address orderer) external view returns (bool);
    function retrievePayoutData(string calldata operationId) external view returns (address walletToDebit, uint256 value, string memory instructions, PayoutStatusCode status);

    event PayoutOrdered(address indexed orderer, string indexed operationId, address indexed walletToDebit, uint256 value, string instructions);
    event PayoutInProcess(address indexed orderer, string indexed operationId);
    event PayoutFundsInSuspense(address indexed orderer, string indexed operationId);
    event PayoutExecuted(address indexed orderer, string indexed operationId);
    event PayoutRejected(address indexed orderer, string indexed operationId, string reason);
    event PayoutCancelled(address indexed orderer, string indexed operationId);
    event PayoutOperatorAuthorized(address indexed walletToBePaidOut, address indexed orderer);
    event PayoutOperatorRevoked(address indexed walletToBePaidOut, address indexed orderer);
}

Enum

PayoutStatusCode

javascript
enum PayoutStatusCode {
    Nonexistent,
    Ordered,
    InProcess,
    FundsInSuspense,
    Executed,
    Rejected,
    Cancelled
}

An enumeration representing the state of a payout request. It defines the possible statuses of a request. Each status indicates the progress of the payout process.

Parameters

  • Nonexistent
    • The request does not exist or is undefined.
  • Ordered
    • The payout request has been created.
  • InProcess
    • Processing has begun and cancellation is no longer possible.
  • FundsInSuspense
    • The tokens have been moved to a temporary holding account (the suspense wallet).
  • Executed
    • The payout is complete and the tokens have been burned.
  • Rejected
    • The payout request has been rejected.
  • Cancelled
    • The request has been cancelled.

Functions

authorizePayoutOperator

javascript
function authorizePayoutOperator(address orderer) external returns (bool);

Authorizes a payout orderer. The wallet owner grants the specified address permission to initiate payout requests.

Parameters

  • orderer
    • The address authorized to initiate payout requests on behalf of the holder.

Return value

  • bool
    • Whether authorization succeeded.

revokePayoutOperator

javascript
function revokePayoutOperator(address orderer) external returns (bool);

Revokes a payout orderer's authorization. The wallet owner withdraws permissions previously granted to an orderer.

Parameters

  • orderer
    • The address whose authorization is being revoked.

Return value

  • bool
    • Whether revocation succeeded.

orderPayout

javascript
function orderPayout(string calldata operationId, uint256 value, string calldata instructions) external returns (bool);

Creates a payout request from the caller's own wallet. The caller specifies a request ID when creating the request. The same ID cannot be reused.

Parameters

  • operationId
    • A unique identifier for the request.
  • value
    • The payout amount in token units.
  • instructions
    • Instructions for the payout, preferably an encrypted string.

Return value

  • bool
    • Whether the request was created successfully.

orderPayoutFrom

javascript
function orderPayoutFrom(string calldata operationId, address walletToBePaidOut, uint256 value, string calldata instructions) external returns (bool);

Creates a payout request on behalf of another wallet holder. An authorized orderer creates a payout request against another wallet.

Parameters

  • operationId
    • A unique identifier for the request.
  • walletToBePaidOut
    • The address of the wallet from which the payout is requested.
  • value
    • The payout amount in token units.
  • instructions
    • Payout instructions, preferably an encrypted string.

Return value

  • bool
    • Whether the request was created successfully.

cancelPayout

javascript
function cancelPayout(string calldata operationId) external returns (bool);

Cancels a payout request. The wallet holder or orderer can cancel the request while its status is Ordered. Cancellation is no longer possible once it transitions to InProcess.

Parameters

  • operationId
    • The ID of the payout request to cancel.

Return value

  • bool
    • Whether cancellation succeeded.

processPayout

javascript
function processPayout(string calldata operationId) external returns (bool);

Changes the status of a payout request to InProcess. The operator uses this function when accepting a request and beginning to process it. Once the status is InProcess, the request can no longer be cancelled.

Parameters

  • operationId
    • The ID of the payout request to move into processing.

Return value

  • bool
    • Whether the status change succeeded.

putFundsInSuspenseInPayout

javascript
function putFundsInSuspenseInPayout(string calldata operationId) external returns (bool);

Moves the tokens designated for payout into suspense. While the request is in the InProcess state, the operator transfers the relevant tokens to the suspense wallet. This enables subsequent execution through executePayout.

Parameters

  • operationId
    • The ID of the request whose funds are to be put into suspense.

Return value

  • bool
    • Whether the transfer succeeded.

executePayout

javascript
function executePayout(string calldata operationId) external returns (bool);

Executes a payout request and burns the tokens. The operator uses this function to finalize a payout. It burns the tokens in the suspense wallet and changes the request's status to Executed.

Parameters

  • operationId
    • The ID of the payout request to execute.

Return value

  • bool
    • Whether execution succeeded.

rejectPayout

javascript
function rejectPayout(string calldata operationId, string calldata reason) external returns (bool);

Rejects a payout request. The operator uses this function when declining a request. It changes the request's status to Rejected and includes a reason.

Parameters

  • operationId
    • The ID of the payout request to reject.
  • reason
    • The reason for rejection.
    • An ERC1066-compliant code is recommended.

Return value

  • bool
    • Whether rejection succeeded.

For more on ERC1066, see the following article.

[ERC1066] Retrieving Detailed Contract Execution Results

isPayoutOperatorFor

javascript
function isPayoutOperatorFor(address walletToDebit, address orderer) external view returns (bool);

Checks whether a particular address can act as a payout orderer. It checks whether orderer has permission to request payouts from walletToDebit.

Parameters

  • walletToDebit
    • The address of the wallet to be debited.
  • orderer
    • The address seeking to act as the payout orderer.

Return value

  • bool
    • Whether the address has the required permission.

retrievePayoutData

javascript
function retrievePayoutData(string calldata operationId) external view returns (address walletToDebit, uint256 value, string memory instructions, PayoutStatusCode status);

Retrieves all information associated with a payout request. The operator, token holder, or orderer can call this function to retrieve the details for a specified request ID.

Parameters

  • operationId
    • The ID of the payout request.

Return values

  • walletToDebit
    • The address of the wallet to be debited.
  • value
    • The payout amount.
  • instructions
    • The payout instruction string.
  • status
    • The current payout status (PayoutStatusCode).

Events

PayoutOrdered

javascript
event PayoutOrdered(
    address indexed orderer,
    string indexed operationId,
    address indexed walletToDebit,
    uint256 value,
    string instructions
);

Emitted when a payout request is created. The event is emitted when a wallet holder or orderer creates a request by calling orderPayout or orderPayoutFrom.

Parameters

  • orderer
    • The address that initiated the payout request.
  • operationId
    • A unique identifier for the request.
  • walletToDebit
    • The address of the wallet to be debited.
  • value
    • The quantity of tokens requested for payout.
  • instructions
    • Instructions such as the payout destination or route, usually in an encrypted string.

PayoutInProcess

javascript
event PayoutInProcess(
    address indexed orderer,
    string indexed operationId
);

Emitted when a payout request changes to InProcess. It indicates that the operator has called processPayout and started preparing the payout for execution. The request can no longer be cancelled at this stage.

Parameters

  • orderer
    • The address that initiated the request.
  • operationId
    • The ID of the payout request.

PayoutFundsInSuspense

javascript
event PayoutFundsInSuspense(
    address indexed orderer,
    string indexed operationId
);

Emitted when the tokens designated for payout are put into suspense. When the operator calls putFundsInSuspenseInPayout, the event indicates that the tokens have been temporarily moved to the suspense wallet.

Parameters

  • orderer
    • The address that initiated the payout request.
  • operationId
    • The ID of the payout request.

PayoutExecuted

javascript
event PayoutExecuted(
    address indexed orderer,
    string indexed operationId
);

Emitted when a payout request has been executed. The operator makes the off-chain payment and calls executePayout to burn the corresponding tokens and record completion. The event is emitted after the burn.

Parameters

  • orderer
    • The address that initiated the payout request.
  • operationId
    • The ID of the payout request.

PayoutRejected

javascript
event PayoutRejected(
    address indexed orderer,
    string indexed operationId,
    string reason
);

Emitted when a payout request is rejected. The operator calls rejectPayout to decline the payout, change the request's status to Rejected, and provide a reason.

Parameters

  • orderer
    • The address that initiated the request.
  • operationId
    • The ID of the payout request.
  • reason
    • The reason for rejection.
    • A code in the ERC1066 format may also be used.

PayoutCancelled

javascript
event PayoutCancelled(
    address indexed orderer,
    string indexed operationId
);

Emitted when a payout request is cancelled. It is emitted when the wallet holder or orderer calls cancelPayout to withdraw the payout request before the operator begins processing it.

Parameters

  • orderer
    • The address that initiated the request.
  • operationId
    • The ID of the payout request.

PayoutOperatorAuthorized

javascript
event PayoutOperatorAuthorized(
    address indexed walletToBePaidOut,
    address indexed orderer
);

Emitted when a payout orderer is authorized. The event is emitted when a wallet holder calls authorizePayoutOperator to grant a specific address permission to initiate payouts on the holder's behalf.

Parameters

  • walletToBePaidOut
    • The address of the relevant wallet.
  • orderer
    • The authorized orderer's address.

PayoutOperatorRevoked

javascript
event PayoutOperatorRevoked(
    address indexed walletToBePaidOut,
    address indexed orderer
);

Emitted when a payout orderer's permission is revoked. It indicates that revokePayoutOperator has been called to withdraw a previously authorized address's permission to act as an orderer.

Parameters

  • walletToBePaidOut
    • The address of the relevant wallet.
  • orderer
    • The address whose permission was revoked.

Additional Notes

The Role of the Token Operator

In ERC2021, the token holder initiates payout requests, but the token operator handles subsequent processing. The operator is responsible for updating the request status (Ordered, InProcess, Executed, and so on) to reflect the actual progress of the payout. In other words, the operator plays a central role in managing the payout lifecycle reliably.

Payout Instruction Format

The payout instruction, which describes the payout destination and processing details, has no mandatory format. Implementers and operators are free to define it, although established payment standards such as ISO 20022 are useful references in practice. Adopting a standard format can support future interoperability and integration with business systems.

Holding Tokens in Conjunction with EIP1996

When a payout request is initiated, the specified amount of tokens is not immediately debited from the user's balance. Instead, the tokens are placed on hold. This hold mechanism is based on ERC1996 and reserves the tokens until the actual payout takes place.

For more on ERC1996, see the following article.

[ERC1996] Holding Tokens for Future Transfers

The token contract owner or its representative (agent) supervises the hold. ERC2021 does not specify how this is implemented, but this entity typically acts as a predefined notary responsible for deciding whether the payout can proceed.

Designing and Managing operationId

One important component of ERC2021 is the operationId (operation ID). It uniquely identifies each payout request, and users can define their own IDs. The identifier has the following characteristics and recommended design practices.

  • operationId is a string rather than a more gas-efficient type such as bytes32.
    • This design choice makes IDs readable and traceable for humans.
  • An implementation may store the string directly on-chain or store only its hash instead.
    • Either approach is sufficient as long as the identifier remains unique.
  • Different users may choose the same operationId, so careful prefix design is recommended to avoid collisions.
    • For example, a prefix could include a company name or part of the wallet address.

Compatibility

The proposal is fully compatible with ERC20 and ERC1996.

Citation

Fernando Paris fer@io.builders, Julio Faura julio@adhara.io, Daniel Lehrner daniel@io.builders, "ERC-2021: Payoutable Token [DRAFT]," Ethereum Improvement Proposals, no. 2021, May 2019. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2021.

Conclusion

This article covered the ERC2021 payout request mechanism.

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

Twitter @cardene777

I also publish material on the following platforms.

https://chaldene.net/