---
eip: 7432
label: ERC-7432
title: Non-Fungible Token Roles
status: Final
type: Standards Track
category: ERC
created: 2023-07-14
requires: 165, 721
official: https://eips.ethereum.org/EIPS/eip-7432
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7432.md
canonical: https://eips.huatuo.xyz/eip-7432/
lang: en
tldr: Lets NFT owners grant expiring, optionally irrevocable roles (bytes32 ids with custom data) to other accounts, so the utility of an NFT can be shared or rented without giving up ownership.
tags: [nft, roles, rental, access-control, erc721]
---

# ERC-7432: Non-Fungible Token Roles

> Role Management for NFTs. Enables accounts to share the utility of NFTs via expirable role assignments.

**TL;DR:** Lets NFT owners grant expiring, optionally irrevocable roles (bytes32 ids with custom data) to other accounts, so the utility of an NFT can be shared or rented without giving up ownership.

## What problem does it solve?

An NFT often carries utility beyond ownership: access to a game, a property, an airdrop claim, a membership perk. Without a standard, sharing that utility means either transferring the NFT (losing it) or relying on each dApp's own delegation scheme.

ERC-7432 defines a generic **role registry** for NFTs. The owner grants a named role on a specific token to another account until a given time. dApps check the role instead of (or in addition to) ownership. Example from the spec: grant `keccak256("PropertyManager()")` to a manager and `keccak256("PropertyTenant(uint256)")` to a tenant of a digital property.

## How it works

A role assignment is a `Role` struct:

| Field | Meaning |
| --- | --- |
| `roleId` | `bytes32`, recommended `keccak256("RoleName(input_types)")` |
| `tokenAddress`, `tokenId` | The NFT the role belongs to |
| `recipient` | Who holds the role |
| `expirationDate` | `uint64` Unix time; the role lapses automatically |
| `revocable` | If `false`, only the recipient can revoke it early |
| `data` | Arbitrary bytes for role-specific parameters |

Key behaviour:

- **`grantRole`** reverts if the expiry is in the past or the caller is not the owner or an approved operator. Granting may **lock** the NFT, either by freezing it or moving it into escrow, and emits `TokenLocked` when it does.
- **`revokeRole`**: the recipient can always revoke; the original owner can only revoke if `revocable` is true.
- **`unlockToken`** returns or unfreezes the NFT, and must revert while any non-revocable role is still active.
- **`setRoleApprovalForAll`** lets an operator (e.g. a rental marketplace) manage roles for an owner.
- Views: `ownerOf`, `recipientOf`, `roleData`, `roleExpirationDate`, `isRoleRevocable`, `isRoleApprovedForAll`.

It is **not** an extension of [ERC-721](/eip-721/): it can live in a separate contract, so it works with existing, immutable NFT collections. The interface id is `0xd00ca5cf` ([ERC-165](/eip-165/)).

## Sample code

Granting a tenant role for 30 days and checking it from a dApp contract:

```solidity
bytes32 constant TENANT = keccak256("PropertyTenant(uint256)");

// owner side
roles.grantRole(IERC7432.Role({
    roleId: TENANT,
    tokenAddress: address(propertyNft),
    tokenId: 42,
    recipient: tenant,
    expirationDate: uint64(block.timestamp + 30 days),
    revocable: false,            // tenant is guaranteed the full term
    data: abi.encode(1_000e6)    // rent parameter
}));

// dApp side
function isTenant(address user) public view returns (bool) {
    return roles.recipientOf(address(propertyNft), 42, TENANT) == user
        && roles.roleExpirationDate(address(propertyNft), 42, TENANT) > block.timestamp;
}
```

## Things to know

- Status: **Final**.
- Use `type(uint64).max` as the expiration for a role that should effectively never expire.
- An optional metadata extension adds a `roles` array to ERC-721 JSON metadata, describing each role's name and the inputs encoded in `data`.
- Related approaches: [ERC-4907](/eip-4907/) adds a single time-limited "user" to an ERC-721; [ERC-5982](/eip-5982/) is a role-based access control interface.
- Always check expiry yourself as shown above; an expired assignment may still be stored until it is overwritten or revoked.


---

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