---
eip: 7656
label: ERC-7656
title: Generalized Contract-Linked Services
status: Final
type: Standards Track
category: ERC
created: 2024-03-15
requires: 20, 165, 721, 1155, 1167, 4337
official: https://eips.ethereum.org/EIPS/eip-7656
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7656.md
canonical: https://eips.huatuo.xyz/eip-7656/
lang: en
tldr: "A factory standard for deploying deterministic minimal-proxy 'services' linked to any NFT or smart account, so you can add features such as recovery, staking or permissions without changing the original contract."
tags: [factory, nft, account-abstraction, proxy, extensions]
---

# ERC-7656: Generalized Contract-Linked Services

> Define a factory for generic services linked to any contract type, including smart accounts and NFTs

**TL;DR:** A factory standard for deploying deterministic minimal-proxy 'services' linked to any NFT or smart account, so you can add features such as recovery, staking or permissions without changing the original contract.

## What problem does it solve?

Token-bound accounts ([ERC-6551](/eip-6551/)) showed that you can attach a contract to an NFT at a predictable address, owned by whoever owns the token. But that design assumes the attached contract is an *account*, and it only links to NFTs.

Many useful add-ons are not accounts: a social-recovery module for a wallet, a staking or rental vault for an NFT, a dynamic-metadata service, compliance logic for a real-world-asset token. ERC-7656 generalizes the idea. One factory can deploy **any** service contract, linked either to a specific token ID or to a contract with no ID (such as an [ERC-4337](/eip-4337/) smart account), without touching the linked contract's code.

## How it works

`IERC7656Factory` (interface ID `0x9e23230a`) has two functions with the same arguments:

- `create(implementation, salt, chainId, mode, linkedContract, linkedId)` — deploys the service and emits `Created`.
- `compute(...)` — returns the address it would have, so services can be referenced before deployment.

Each service is an [ERC-1167](/eip-1167/) minimal proxy pointing at `implementation`, with the link data appended to its bytecode (183 bytes total): `salt`, `chainId`, `mode`, `linkedContract`, `linkedId`. The factory stores nothing; the address is fully determined by these inputs.

The `bytes12 mode` says how to interpret the link:

| Mode | Value | Use |
| --- | --- | --- |
| `LINKED_ID` | `0x…00` | Linked to a token ID, e.g. an [ERC-721](/eip-721/) NFT; compatible with token-bound accounts |
| `NO_LINKED_ID` | `0x…01` | Linked to a contract without an ID, e.g. a smart account; `linkedId` should be 0 |

The remaining mode bytes are reserved for future linking rules. Services should implement `IERC7656Service.linkedData()` (interface ID `0x7e110a1d`), check ownership through the linked contract, and verify `chainId == block.chainid`.

## Sample code

Predicting and deploying a service linked to an NFT (ethers v6):

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

const factoryAbi = [
  "function compute(address,bytes32,uint256,bytes12,address,uint256) view returns (address)",
  "function create(address,bytes32,uint256,bytes12,address,uint256) returns (address)",
];
const factory = new Contract(factoryAddress, factoryAbi, signer);

const LINKED_ID = "0x000000000000000000000000";
const { chainId } = await signer.provider!.getNetwork();
const args = [serviceImpl, ZeroHash, chainId, LINKED_ID, nftContract, 1234n] as const;

const predicted = await factory.compute(...args);
console.log("service will live at", predicted);
await (await factory.create(...args)).wait();
```

A service's owner check, as in the spec's example:

```solidity
function owner() public view returns (address) {
    (uint256 chainId, , address token, uint256 id) = linkedData();
    if (chainId != block.chainid) return address(0);
    return IERC721(token).ownerOf(id);
}
```

## Things to know

- Status is **Final**.
- The factory does not vet implementations. Anyone can link a malicious service to your NFT or account address; only trust services whose implementation you have reviewed.
- A seller could change a linked service's settings just before a sale; marketplaces may need lock periods.
- An NFT whose linked wallet holds that same NFT creates an ownership cycle that can lock assets.
- Upgradeable implementations reintroduce trust in the upgrader; the spec recommends timelocks or multisig control.


---

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