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 ERC-2018, which proposes a mechanism for performing off-chain KYC and AML checks and processing token transfers securely in three stages: ordering, reviewing, and executing the transfer.

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

I also cover a variety of other EIPs.

Overview

In finance and banking, clearing encompasses the procedures between agreeing to a transaction and the final settlement of funds. Blockchains similarly need mechanisms for checking and validating transaction details before execution and ultimately processing those transactions.

In this mechanism, a designated account called a clearing agent determines whether a transfer can be executed. Until the transfer is approved, the intended transfer amount is not deducted from the account balance, but it is reserved so that it cannot be used for other transfers. This reservation is intended to eliminate the risk of a subsequent transaction failure due to the reserved funds being spent elsewhere and ensure that the approved transfer can be executed.

The account ordering the transfer does not necessarily have to be the account holder. A third-party account previously authorized as an operator can also request a transfer on the holder's behalf.

Motivation

Existing token standards implemented on blockchains, such as ERC20, cannot adequately address legal requirements such as know-your-customer (KYC) and anti-money-laundering (AML) checks. In particular, these checks often need to take place off-chain, outside the blockchain. However, there is no standard mechanism for controlling transaction execution based on the results of off-chain checks.

ERC-2018 allows users to place an order for a token transfer. A clearing agent verifies the order, and the transfer can be executed only if the relevant legal requirements are satisfied. If a problem is identified, the agent can reject the transfer and specify a reason.

This allows regulated tokens subject to KYC and AML requirements to support secure and flexible pre-transfer reviews, combining transparency with compliance.

Specification

js
interface ClearableToken /* is ERC-1996 */ {
    enum ClearableTransferStatusCode { Nonexistent, Ordered, InProcess, Executed, Rejected, Cancelled }

    function orderTransfer(string calldata operationId, address to, uint256 value) external returns (bool);
    function orderTransferFrom(string calldata operationId, address from, address to, uint256 value) external returns (bool);
    function cancelTransfer(string calldata operationId) external returns (bool);
    function processClearableTransfer(string calldata operationId) external returns (bool);
    function executeClearableTransfer(string calldata operationId) external returns (bool);
    function rejectClearableTransfer(string calldata operationId, string calldata reason) external returns (bool);
    function retrieveClearableTransferData(string calldata operationId) external view returns (address from, address to, uint256 value, ClearableTransferStatusCode status);

    function authorizeClearableTransferOperator(address operator) external returns (bool);
    function revokeClearableTransferOperator(address operator) external returns (bool);
    function isClearableTransferOperatorFor(address operator, address from) external view returns (bool);

    event ClearableTransferOrdered(address indexed orderer, string operationId, address indexed from, address indexed to, uint256 value);
    event ClearableTransferInProcess(address indexed orderer, string operationId);
    event ClearableTransferExecuted(address indexed orderer, string operationId);
    event ClearableTransferRejected(address indexed orderer, string operationId, string reason);
    event ClearableTransferCancelled(address indexed orderer, string operationId);
    event AuthorizedClearableTransferOperator(address indexed operator, address indexed account);
    event RevokedClearableTransferOperator(address indexed operator, address indexed account);
}

Events

ClearableTransferOrdered

javascript
event ClearableTransferOrdered(
    address indexed orderer,
    string operationId,
    address indexed from,
    address indexed to,
    uint256 value
);

Emitted when a clearable transfer is ordered. It is emitted when a user or operator orders a transfer that requires clearing. It indicates that the intended transfer amount is locked before the transfer is finalized.

Parameters

  • orderer
    • Address of the account that ordered the transfer.
  • operationId
    • Unique identifier for the transfer operation.
  • from
    • Address of the account expected to send the tokens.
  • to
    • Address of the account expected to receive the tokens.
  • value
    • Amount to be transferred.

ClearableTransferInProcess

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

Emitted when a clearable transfer moves into the in-process state. This intermediate state indicates that the clearing agent has started processing the transfer. The order can no longer be canceled after this point.

Parameters

  • orderer
    • Address of the account that ordered the transfer.
  • operationId
    • Unique identifier for the transfer operation.

ClearableTransferExecuted

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

Emitted when a clearable transfer is successfully executed. It indicates that the tokens have actually been transferred based on the clearing agent's decision. The transfer from from to to is complete.

Parameters

  • orderer
    • Address of the account that ordered the transfer.
  • operationId
    • Unique identifier for the transfer operation.

ClearableTransferRejected

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

Emitted when a clearable transfer is rejected. It indicates that the clearing agent rejected the transfer following a review, such as KYC or AML checks. The reason is explicitly provided as a string in reason.

Parameters

  • orderer
    • Address of the account that ordered the transfer.
  • operationId
    • Unique identifier for the transfer operation.
  • reason
    • Reason for rejection.

ClearableTransferCancelled

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

Emitted when a clearable transfer is canceled. It is emitted when the orderer cancels a transfer order that has not yet been executed. Cancellation is possible only before the order reaches the InProcess state or a subsequent state.

Parameters

  • orderer
    • Address of the account that ordered the transfer.
  • operationId
    • Unique identifier for the transfer operation.

AuthorizedClearableTransferOperator

javascript
event AuthorizedClearableTransferOperator(
    address indexed operator,
    address indexed account
);

Emitted when an account is authorized as a clearable transfer operator. It indicates that account has granted operator permission to order transfers on its behalf.

Parameters

  • operator
    • Address of the authorized operator.
  • account
    • Address of the account on whose behalf the operator can act.

RevokedClearableTransferOperator

javascript
event RevokedClearableTransferOperator(
    address indexed operator,
    address indexed account
);

Emitted when an operator's clearable transfer permissions are revoked. It indicates that account has revoked operator's permission to act on its behalf.

Parameters

  • operator
    • Address of the removed operator.
  • account
    • Address of the account that revoked the permission.

Functions

orderTransfer

javascript
function orderTransfer(string calldata operationId, address to, uint256 value) external returns (bool);

Orders a transfer. It reserves a transfer of tokens from the sender (msg.sender) to to. No actual transfer takes place at this point, but the specified amount is reserved and cannot be used for other transfers. The call reverts if the same operationId has already been used.

Parameters

  • operationId
    • ID uniquely identifying the transfer subject to clearing.
  • to
    • Address of the token recipient.
  • value
    • Intended transfer amount.
    • Must not exceed the sender's balance.

Return value

  • bool
    • Boolean indicating whether the operation succeeded.

orderTransferFrom

javascript
function orderTransferFrom(string calldata operationId, address from, address to, uint256 value) external returns (bool);

Orders a transfer on behalf of another account. It places an order for a transfer from from to to. The msg.sender must be an operator authorized by from. The operation fails if the same operationId has already been used.

Parameters

  • operationId
    • ID uniquely identifying the transfer subject to clearing.
  • from
    • Address sending the tokens.
  • to
    • Address receiving the tokens.
  • value
    • Intended transfer amount.
    • Must not exceed the source account's balance.

Return value

  • bool
    • Boolean indicating whether the operation succeeded.

cancelTransfer

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

Cancels an ordered transfer. The orderer can cancel a transfer only if it has not yet entered the InProcess state. Orders that are already being processed or have been executed cannot be canceled.

Parameters

  • operationId
    • ID uniquely identifying the transfer order to cancel.

Return value

  • bool
    • Boolean indicating whether cancellation succeeded.

processClearableTransfer

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

Moves a transfer into the in-process state. The clearing agent uses this function to indicate that the transfer is under review. Once the transfer enters this state, the orderer can no longer cancel it. Only the clearing agent may call this function.

Parameters

  • operationId
    • ID uniquely identifying the relevant transfer order.

Return value

  • bool
    • Boolean indicating whether the state change succeeded.

executeClearableTransfer

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

Executes a transfer. The function is called when the clearing agent approves the transfer order. The tokens are actually transferred from from to to. Only the clearing agent may execute this function.

Parameters

  • operationId
    • ID uniquely identifying the transfer order to execute.

Return value

  • bool
    • Boolean indicating whether execution succeeded.

rejectClearableTransfer

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

Rejects a transfer. The clearing agent uses this function to reject an ordered transfer based on the results of its review. The reserved tokens are released and become available for use again. A reason for rejection can be specified as a string.

Parameters

  • operationId
    • ID uniquely identifying the transfer order to reject.
  • reason
    • String describing the reason for rejection.

Return value

  • bool
    • Boolean indicating whether rejection succeeded.

retrieveClearableTransferData

javascript
function retrieveClearableTransferData(string calldata operationId) external view returns (address from, address to, uint256 value, ClearableTransferStatusCode status);

Retrieves details of a transfer order. It provides access to the state, source, destination, amount, and other information associated with the specified operationId.

Parameters

  • operationId
    • ID uniquely identifying the transfer order to retrieve.

Return values

  • from
    • Source address.
  • to
    • Destination address.
  • value
    • Transfer amount.
  • status
    • Current status code of the transfer order.

authorizeClearableTransferOperator

javascript
function authorizeClearableTransferOperator(address operator) external returns (bool);

Authorizes a clearable transfer operator. It is used to register an operator that can order transfers on the caller's behalf.

Parameters

  • operator
    • Address of the operator to authorize.

Return value

  • bool
    • Boolean indicating whether authorization succeeded.

revokeClearableTransferOperator

javascript
function revokeClearableTransferOperator(address operator) external returns (bool);

Revokes an operator's permissions. It is used to revoke the permissions of an operator who was previously authorized.

Parameters

  • operator
    • Address of the operator whose permissions are to be revoked.

Return value

  • bool
    • Boolean indicating whether revocation succeeded.

isClearableTransferOperatorFor

javascript
function isClearableTransferOperatorFor(address operator, address from) external view returns (bool);

Checks whether the specified operator is authorized to order transfers on another account's behalf. It checks whether operator has permission to order clearable transfers for from.

Parameters

  • operator
    • Address of the operator to check.
  • from
    • Account that may have authorized the operator.

Return value

  • bool
    • Boolean indicating whether the operator has the required permission.

Additional details

Temporarily reserving funds through integration with EIP-1996

ERC-2018 uses the hold mechanism defined in ERC-1996. When a token transfer is ordered, no actual transfer takes place; instead, the intended amount is temporarily held. This design prevents the same amount from being spent twice while a decision is pending and ensures that the transfer is executed only after approval.

For more information about ERC-1996, see the article below.

[ERC1996] Understanding the Hold Mechanism for Future Transfers

The clearing agent makes decisions off-chain

Whether a transfer can be executed is determined by a previously designated entity called the clearing agent. The proposal does not specify how the clearing agent must be implemented, but this role generally performs off-chain checks such as KYC and AML. The agent plays an important role in approving or rejecting transfers based on external information that a smart contract cannot determine on its own, such as identity verification or sanctions screening.

Why operationId is represented as a string

The operationId that uniquely identifies each transfer order is designed as a string rather than a number or hash. Although less gas-efficient, this approach offers several advantages.

  • IDs can be human-readable and easy to track.
  • IDs are convenient for off-chain reconciliation and log analysis.

Implementers can choose to store the original string on-chain or store only its hash. A hash is sufficient for operation as long as the order can be identified.

operationId collision risks and naming conventions

The operationId must be unique across all transfer orders. When multiple transfers are processed concurrently, duplicate IDs may cause conflicts. Each issuer is therefore encouraged to use a prefix (for example, "userA-" or "corpX-2025/") to create a separate namespace. Although not a mandatory requirement of the specification, this practice is important for operational safety.

Function naming follows ERC777

Function names such as authorizeClearableTransferOperator, revokeClearableTransferOperator, and isClearableTransferOperatorFor follow the naming conventions for operator functions defined by ERC777. This improves compatibility and readability across ERC standards and provides an API that developers can understand more readily.

For more information about ERC777, see the article below.

[ERC777] Understanding the Standard Token Contract Interface

Citation

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

Conclusion

This article covered ERC-2018, which proposes enabling off-chain KYC and AML checks and processing token transfers securely in three stages: ordering, reviewing, and executing the transfer. I hope this explanation was helpful.

If you have questions, feel free to reach out via direct message on Twitter.

Twitter @cardene777

I also publish content on other platforms, which you can find below.

https://chaldene.net/