---
eip: 8234
title: Referable NFTs Authorization
description: Defines an interface for granting, revoking, and querying NFT referral authorization.
author: Ruiqiang Li (@richard-620) <richard.620.research@gmail.com>, Qin Wang <qin.wang@data61.csiro.au>, Shiping Chen <shiping.chen@data61.csiro.au>, Saber Yu (@OniReimu), John Le <johnle@uow.edu.au>, Brian Yecies <byecies@uow.edu.au>
discussions-to: https://ethereum-magicians.org/t/erc-8234-referable-nfts-authorization/28258
status: Draft
type: Standards Track
category: ERC
created: 2026-04-16
requires: 165, 191, 721
---


## Abstract

This ERC defines a standard interface for authorizing referral relationships between [ERC-721](./eip-721.md) non-fungible tokens (NFTs). It allows the owner of a referred NFT to grant or revoke authorization for a specific referring NFT, either directly on-chain or through an off-chain signature. It supports cross-contract referrals and standalone registries without requiring modifications to existing token contracts.

## Motivation

Referral-capable NFT designs, including [ERC-5521](./eip-5521.md), do not standardize a general owner-controlled authorization layer for cross-contract referral relationships. Existing ERC-721 collections may also be unable to add native referral logic.

This ERC defines a minimal authorization interface supporting owner-controlled consent, relayed signature-based authorization, and deployment as a standalone registry or auxiliary module. It does not define the referral relationship itself.

## Specification

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119) [RFC 8174](https://www.rfc-editor.org/rfc/rfc8174) when, and only when, they appear in all capitals, as shown here.

### Interface

Both the referred NFT (the NFT being referred to) and the referring NFT (the NFT seeking to refer to it) MUST belong to ERC-721 collections. Neither collection is required to implement ERC-5521. This ERC does not itself create, store, or enforce referral relationships.

A compliant implementation MUST expose the following interface:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.4;

interface ERC165 {
    function supportsInterface(bytes4 interfaceID)
        external view returns (bool);
}

/// @title Referable NFTs with Authorization
interface IAuthorizedReferral is ERC165 {
    event ReferralAuthorizationSet(
        address indexed referredContract,
        uint256 indexed referredTokenId,
        address indexed referringContract,
        uint256 referringTokenId,
        bool authorized
    );

    function isReferralAuthorized(
        address referredContract,
        uint256 referredTokenId,
        address referringContract,
        uint256 referringTokenId
    ) external view returns (bool);

    /// @notice Set authorization as the owner or an ERC-721 approved address
    function setReferralAuthorization(
        address referredContract,
        uint256 referredTokenId,
        address referringContract,
        uint256 referringTokenId,
        bool authorized
    ) external;

    /// @notice Relay an authorization signed by the current owner
    function setReferralAuthorizationBySig(
        address referredContract,
        uint256 referredTokenId,
        address referringContract,
        uint256 referringTokenId,
        bool authorized,
        uint256 nonce,
        uint256 deadline,
        bytes calldata signature
    ) external;

    /// @notice Return the current sequential nonce of a referred NFT
    function referralAuthorizationNonce(
        address referredContract,
        uint256 referredTokenId
    ) external view returns (uint256);
}
```

Implementations MUST comply with [ERC-165](./eip-165.md) and MUST return `true` from `supportsInterface` for `type(IAuthorizedReferral).interfaceId`. This identifier is the XOR of the selectors of the four functions declared directly in `IAuthorizedReferral`, excluding the inherited `supportsInterface` function and the event.

### Authorization Semantics

If `isReferralAuthorized` returns `true`, the referred NFT permits the specified referring NFT to establish or claim a referral relationship, subject to the consuming application's rules.

Both contract addresses MUST be nonzero, contain deployed code, and support ERC-721 under ERC-165. Both token IDs MUST identify existing NFTs, as determined by successful ERC-721 `ownerOf` calls returning nonzero addresses. A pair in which both contract addresses and token IDs are identical is invalid.

Both authorization setters MUST revert for invalid pairs. `isReferralAuthorized` MUST return `false` for invalid pairs, unset pairs, revoked pairs, or authorizations whose recorded owner differs from the current referred NFT owner. Failed ownership or interface queries MUST be treated as invalid for these purposes.

Every successful setter call MUST store the supplied authorization value and the current referred NFT owner, and MUST emit `ReferralAuthorizationSet` with the supplied pair and value, including when the value is unchanged.

Applications integrating this ERC MUST define how authorization state is consumed. This ERC does not mandate how a referral relationship is materialized, displayed, interpreted, or enforced.

### Direct Authorization

The current owner MUST be determined by calling ERC-721 `ownerOf(referredTokenId)` on `referredContract`.

The caller of `setReferralAuthorization` MUST be one of:

- the current owner;
- the address returned by `getApproved(referredTokenId)`; or
- an operator for which `isApprovedForAll(currentOwner, msg.sender)` returns `true`.

These approvals are defined by ERC-721, not ERC-5521. Unauthorized calls MUST revert.

### Signature-Based Authorization

Anyone MAY call `setReferralAuthorizationBySig`. The call MUST revert unless all of the following conditions hold:

- the pair is valid;
- the supplied `nonce` equals the current nonce of the referred NFT;
- `block.timestamp <= deadline`;
- the signature satisfies the Signature Message requirements and recovers the current owner returned by `ownerOf(referredTokenId)`.

Unlike direct authorization, signature-based authorization does not accept signatures from approved addresses or operators. The mandatory signature format supports ECDSA signatures from externally owned accounts. Contract-wallet signature validation is not standardized by this ERC; contract owners can use direct authorization.

### Nonce Management

The nonce MUST be a sequential `uint256` counter scoped to `(referredContract, referredTokenId)` within the implementing contract. Its initial value MUST be zero. `referralAuthorizationNonce` MUST return this counter, including zero for a previously unused key.

Each successful call to either authorization setter MUST increment the counter by exactly one. Failed calls MUST NOT change it. The counter MUST NOT reset on ownership changes, revocation, or token burning and reminting, and MUST NOT wrap around.

Incrementing the counter on direct updates invalidates previously signed but unsubmitted authorizations for the same referred NFT. A signer MUST use the current counter when constructing a signature.

### Signature Message

The following [ERC-191](./eip-191.md) version `0x45` message construction is REQUIRED for `setReferralAuthorizationBySig`. The inner hash MUST be computed using `abi.encode` with the fields in the exact order and Solidity types shown below:

| Field | Solidity type |
| --- | --- |
| `referredContract` | `address` |
| `referredTokenId` | `uint256` |
| `referringContract` | `address` |
| `referringTokenId` | `uint256` |
| `authorized` | `bool` |
| `nonce` | `uint256` |
| `deadline` | `uint256` |
| `chainId` | `uint256` |
| `verifyingContract` | `address` |

```solidity
bytes32 messageHash = keccak256(
    abi.encode(
        referredContract,
        referredTokenId,
        referringContract,
        referringTokenId,
        authorized,
        nonce,
        deadline,
        block.chainid,
        address(this)
    )
);

bytes32 digest = keccak256(
    abi.encodePacked(
        "\x19Ethereum Signed Message:\n32",
        messageHash
    )
);
```

The verifier MUST derive `chainId` from `block.chainid` and `verifyingContract` from `address(this)`. The signer MUST use the corresponding chain ID and address of the implementing contract. Wallets using `personal_sign` MUST sign the raw 32-byte `messageHash`, not its hexadecimal text or the already-prefixed digest.

The signature MUST contain exactly 65 bytes, encoded as `r || s || v`, where `r` and `s` are 32-byte big-endian integers and `v` is a single byte equal to 27 or 28. The verifier MUST reject zero `r`, zero `s`, `r` greater than or equal to the secp256k1 group order, and `s` greater than the following half-order:

```text
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0
```

The verifier MUST recover the signer using `ecrecover(digest, v, r, s)` and MUST reject a zero recovered address or an address different from the current owner. The nonce prevents repeated execution, the deadline limits signature validity, and the chain ID and verifying contract bind signatures to their execution domain.

### Ownership Change Semantics

Authorization represents consent associated with the owner recorded when the authorization was set. `isReferralAuthorized` MUST return `false` whenever the current referred NFT owner differs from that recorded owner, even if the stored authorization value is `true`.

A signature MUST be rejected if its recovered signer is not the current referred NFT owner at execution time.

A standalone registry cannot reliably detect intervening transfers of an unmodified ERC-721 token. If a token returns to its recorded owner, a previously stored authorization can become effective again. Likewise, an unused signature from that owner can become valid again if its nonce and deadline remain valid. Burning and reminting to the same owner may have the same effect. This ERC specifies current-owner checks, not irreversible invalidation on every transfer.

## Rationale

This ERC is intentionally limited to authorization and does not define a canonical data model for referral relationships. Both NFT contract addresses are explicit parameters to support cross-contract authorization, including legacy ERC-721 collections.

Separate entry points for direct and signature-based authorization avoid overloaded method ambiguity. ERC-721 approvals support delegated on-chain management, while owner-only signatures provide explicit owner consent for relayed updates.

A sequential nonce and a canonical ERC-191 digest provide interoperable signature construction and replay protection. Direct updates also increment the nonce to prevent an older pending signature from overriding a subsequent direct update. Implementations may offer additional signature mechanisms through separate entry points, but must not change the required digest or validation rules of `setReferralAuthorizationBySig`.

Current-owner checks enable standalone deployment without requiring transfer hooks. Permanent invalidation across all ownership transitions would require additional ownership-history information not exposed by ERC-721.

## Backwards Compatibility

This ERC does not require modification of existing ERC-721 token contracts. It may be implemented as a standalone registry, middleware contract, or auxiliary module.

This ERC does not replace ERC-5521. Referral-capable applications may consult this authorization interface before accepting or materializing a referral claim involving ERC-721 tokens.

## Security Considerations

The following considerations apply to implementations of this ERC and to the applications that consume it.

- Implementations must enforce the specified nonce, deadline, signature validation, and ownership checks.
- Any address may relay a valid signature. Applications should assume that submission may be front-run and that competing updates may race.
- A nonce is shared by all authorization pairs for a referred NFT. Concurrent signatures using the same nonce compete; only one can succeed.
- ERC-721 approved addresses and operators can grant or revoke authorization directly and invalidate pending signatures. Owners should consider this authority when granting approvals.
- Revoking ERC-721 approval does not automatically revoke referral authorizations previously set by an approved address.
- Current-owner checks do not detect transfers away and back or burning and reminting to the same owner. Applications requiring permanent transfer-based invalidation need additional mechanisms beyond this ERC.
- Applications should use short signature deadlines and rely on confirmed on-chain authorization state rather than off-chain intent alone.
- Applications must identify which registry they trust, since authorization state may differ across registries.
- Implementations should consider storage growth and treat external token contracts as untrusted. ERC-165 support claims alone do not guarantee correct ERC-721 behavior.

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).
