---
eip: 902
label: ERC-902
title: Token Validation
status: Stagnant
type: Standards Track
category: ERC
created: 2018-02-14
requires: 1066
official: https://eips.ethereum.org/EIPS/eip-902
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-902.md
canonical: https://eips.huatuo.xyz/eip-902/
lang: en
tldr: Proposed a shared TokenValidator interface that tokens call to approve holders and transfers, for example for KYC or compliance rules; it is Stagnant and was never widely adopted.
tags: [token, compliance, validation, security-token, stagnant]
---

# ERC-902: Token Validation

> A protocol for services providing token ownership and transfer validation.

**TL;DR:** Proposed a shared TokenValidator interface that tokens call to approve holders and transfers, for example for KYC or compliance rules; it is Stagnant and was never widely adopted.

## What problem does it solve?

Tokens that represent regulated assets, such as securities, often have to restrict who can hold or trade them. Typical checks are KYC/AML status, residency, spending limits or transfer volumes. Every such token tended to build its own whitelist.

ERC-902 separates those rules from the token. Compliance providers, or any business logic, run **validator contracts**. Tokens ask a validator before they issue, transfer or spend. Many tokens can share one validator, and validators can combine or delegate to one another.

## How it works

**`TokenValidator`** exposes two overloaded `check` functions, both returning a one-byte status code from [ERC-1066](/eip-1066/):

- `check(token, subject)` is a general check on one address, for example "is this user whitelisted?" or "is this an admin?".
- `check(token, from, to, amount)` checks a specific transfer.

The token address is passed explicitly because validators may call one another, so a validator cannot rely on `msg.sender` to know which token is asking.

**`ValidatedToken`** defines two `Validation` events that the **token** (not the validator) must emit after each check:

- `Validation(subject, statusCode)`
- `Validation(from, to, amount, statusCode)`

Emitting from the token avoids duplicate events when validators chain together.

What is deliberately left out:

- There is no central registry. Each token decides how it chooses its validators, whether public, private or hard-coded.
- There is no fixed status-code scheme beyond pointing to ERC-1066.

Because only the check is defined, the design fits [ERC-20](/eip-20/), [ERC-721](/eip-721/), [ERC-777](/eip-777/) and future token types.

## Sample code

A token gating `transfer` on a validator (modern Solidity, simplified):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface TokenValidator {
    function check(address token, address subject) external returns (bytes1);
    function check(address token, address from, address to, uint256 amount) external returns (bytes1);
}

contract ValidatedToken {
    event Validation(address indexed from, address indexed to, uint256 value, bytes1 indexed statusCode);

    bytes1 constant OK = 0x11; // ERC-1066 "Allowed or Go"
    TokenValidator public validator;
    mapping(address => uint256) public balanceOf;

    constructor(TokenValidator v) { validator = v; }

    function transfer(address to, uint256 amount) external returns (bool) {
        bytes1 code = validator.check(address(this), msg.sender, to, amount);
        emit Validation(msg.sender, to, amount, code);
        if (code != OK) return false;
        balanceOf[msg.sender] -= amount;
        balanceOf[to] += amount;
        return true;
    }
}
```

## Things to know

- **This proposal is Stagnant and was never widely adopted.** It depends on ERC-1066, which is also Stagnant.
- The original interface uses pre-0.5 Solidity syntax (`public` in interfaces, the `byte` type). The sample above modernizes it.
- The meaning of each status code is left to ERC-1066 and the implementer. Confirm which code your validator treats as "allowed". The sample uses `0x11` ("Allowed or Go" in ERC-1066's table).
- `check` is not `view`, so a validator may update state, for example to track volume limits. That costs gas on every transfer.
- Putting identity or residency data on chain has privacy implications. A validator usually exposes only a pass or fail result.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-902
