---
eip: 5050
label: ERC-5050
title: Interactive NFTs with Modular Environments
status: Stagnant
type: Standards Track
category: ERC
created: 2021-04-18
requires: 165, 173, 721, 1155, 1820, 4906
official: https://eips.ethereum.org/EIPS/eip-5050
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5050.md
canonical: https://eips.huatuo.xyz/eip-5050/
lang: en
tldr: "A messaging protocol that lets NFTs send typed 'actions' to each other (attack, cast, feed…), optionally settled by a shared state contract, so games and apps can build interoperable 'digital physics' on top of tokens."
tags: [nft, gaming, interoperability, erc721, erc1155]
---

# ERC-5050: Interactive NFTs with Modular Environments

> Action messaging and discovery protocol for interactions on and between NFTs

**TL;DR:** A messaging protocol that lets NFTs send typed 'actions' to each other (attack, cast, feed…), optionally settled by a shared state contract, so games and apps can build interoperable 'digital physics' on top of tokens.

## What problem does it solve?

[ERC-721](/eip-721/) and [ERC-1155](/eip-1155/) define what an item *is*, not what it can *do*. Projects that want NFTs to interact, such as a sword hitting a monster or a spell cast on a character, each build bespoke contracts, so items from different projects cannot interact, and off-chain apps cannot discover what is possible.

ERC-5050 standardises how one token sends an action to another, how contracts advertise the actions they support, and how a shared "environment" contract can hold the resulting game state.

## How it works

- **Action struct.** An action has a `selector` (`bytes4(keccak256("namespace.action"))`), the `user`, a `from` object and a `to` object (each `address + tokenId`), an optional `state` contract and free-form `data`.
- **Sender interface** (`IERC5050Sender`, ID `0xc8c6c9f3`): `sendAction(action)`, `isValid(hash, nonce)`, `sendableActions()` (human-readable list), plus per-action approvals (`approveForAction`, `setApprovalForAllActions`).
- **Receiver interface** (`IERC5050Receiver`, ID `0x1a3f02f4`): `onActionReceived(action, nonce)` and `receivableActions()`.
- **Flow.** The sending contract stores a nonced hash of the action and calls the receiver, which may forward it to the state contract. The state contract calls back `isValid` on the sender to confirm the action is authentic, then finalises it. Without a state contract, sender and receiver manage their own state.
- **State contracts** are swappable environments (e.g. a `FightGame` that stores HP and strength). The same NFTs can play in different environments.
- **Naming conventions:** dot for namespaces (`spells.cast`), `>` for required sequence (`settle>build`).
- **Extensions:** `interfaceURI(action)` for custom UIs, action proxies via a modified [ERC-1820](/eip-1820/) registry for legacy contracts, trusted *controllers* for bridging, and [ERC-4906](/eip-4906/) events for metadata refresh.

## Sample code

Sending an action from TypeScript (ethers v6):

```ts
import { Contract, id } from "ethers";

const sender = new Contract(fightersAddr, [
  "function sendAction((bytes4 selector,address user,(address _address,uint256 _tokenId) from,(address _address,uint256 _tokenId) to,address state,bytes data) action) payable",
  "function sendableActions() view returns (string[])",
], signer);

console.log(await sender.sendableActions()); // e.g. ["fight.attack"]

await sender.sendAction({
  selector: id("fight.attack").slice(0, 10),        // bytes4 of keccak256
  user: await signer.getAddress(),
  from: { _address: fightersAddr, _tokenId: 1n },
  to:   { _address: monstersAddr, _tokenId: 7n },
  state: fightGameAddr,                              // or ZeroAddress
  data: "0x",
});
```

## Things to know

- Status: **Stagnant**; it was never finalised.
- Validation proves the action came from the *initiating contract*, not that the `user` field is honest. The protocol deliberately treats the sending contract as the "prime mover", so only interact with trusted sender contracts.
- Action chains (sender → receiver → state) can run out of gas; handlers should be minimal and avoid loops.
- Existing non-upgradeable NFT contracts need a proxy registry to participate.


---

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