ERC-1616 · Stagnant · ERC · 2018-11-23
ERC-1616: Attribute Registry Standard
A four-function read interface for registries that assign one canonical uint256 attribute value per type per address, so contracts can check things like KYC status from a single trusted source.
What problem does it solve?
Contracts sometimes need to know something about an address: has it passed KYC, is it an accredited investor, is it on an allow-list? Earlier claim standards (ERC-735 and ERC-780) let many issuers attach claims to the same address for the same topic. A verifier then has to decide which issuers to trust and how to resolve conflicting claims.
ERC-1616 moves that trust decision up one level. A curated Attribute Registry aggregates whatever sources it trusts and exposes a single answer. Verifiers only need to trust the registry, and do not care how the information was obtained.
How it works
Attributes are a flat uint256 → uint256 key-value store per account, with a key rule: each attribute type has exactly one value per address (not one per issuer). The interface is:
| Function | Behaviour |
|---|---|
hasAttribute(account, typeId) |
true if assigned and currently valid. Must never revert; errors from external calls are caught and return false |
getAttributeValue(account, typeId) |
The value. Must revert if hasAttribute would return false |
countAttributeTypes() |
Number of attribute types the registry defines. Must not revert |
getAttributeTypeID(index) |
Type ID at an index; reverts only when out of range |
Both lookup functions must be deterministic: two consecutive calls with the same arguments return the same result regardless of caller or tx.origin. The registry must also support ERC-165 and report interface ID 0x5f46473f.
How attributes are issued, revoked or expire is deliberately out of scope. Advanced registries can encode boolean expressions into a type ID, point values at off-chain metadata, or delegate to other registries without changing the interface.
Sample code
A token that only allows transfers to accounts holding an attribute:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IAttributeRegistry {
function hasAttribute(address account, uint256 attributeTypeID) external view returns (bool);
function getAttributeValue(address account, uint256 attributeTypeID) external view returns (uint256);
function countAttributeTypes() external view returns (uint256);
function getAttributeTypeID(uint256 index) external view returns (uint256);
}
contract GatedVault {
IAttributeRegistry public immutable registry;
uint256 public immutable requiredType; // e.g. an "approved investor" attribute ID
constructor(IAttributeRegistry r, uint256 typeId) {
registry = r;
requiredType = typeId;
}
modifier onlyAttested(address who) {
require(registry.hasAttribute(who, requiredType), "missing attribute");
_;
}
function deposit() external payable onlyAttested(msg.sender) {
// ...
}
}
Things to know
- Status is Stagnant. The spec points to the TPL (Transaction Permission Layer) contracts as a more complex implementation of the interface.
- Centralising trust in a registry curator is the design: whoever controls the registry controls who passes the check.
- Because
hasAttributemust not revert, a registry that calls other contracts must wrap those calls and returnfalseon failure. - The standard adds no metadata about attributes beyond the value; naming schemes were left to a possible future EIP. A related compliance-check design is ERC-2009.