---
eip: 8323
title: Source-Token Agent Binding for ERC-8004
description: Derive an ERC-8004 agent identity from an existing ERC-721 token, recording permanent provenance while exposing live ownership separately.
author: Tiago Merlini (@TMerlini) <merloproductions@gmail.com>, babyblueviper1 (@babyblueviper1)
discussions-to: https://ethereum-magicians.org/t/erc-8323-source-token-agent-binding-for-erc-8004/28920
status: Draft
type: Standards Track
category: ERC
created: 2026-07-08
requires: 165, 721, 6551, 8004
---

## Abstract

This standard defines a minimal interface for an [ERC-8004](./eip-8004.md) agent identity registry that is **bound to a single source [ERC-721](./eip-721.md) collection**. Holders of the bound collection bridge a token they own into an agent identity. The source token is recorded at registration time as **permanent provenance** and is never locked or transferred; ownership of the source token is checked once at mint via `ownerOf` and thereafter exposed as a **separate, live, re-checkable view**. This separates two facts that are easy to conflate: *which token an agent was derived from* (immutable) and *whether the current agent holder still owns that token* (mutable).

## Motivation

[ERC-8004](./eip-8004.md) establishes agent identities but assumes an agent is minted fresh, with no relationship to an existing asset. In practice the most natural agents are **derived from non-fungible tokens (NFTs) people already hold**: a profile-picture (PFP) token, a membership token, a game character.

[ERC-8217](./eip-8217.md) lets a registry record that an ERC-8004 identity is controlled by an external object such as a token. This standard addresses a narrower case that ERC-8217 does not fix in place: an identity *minted from* a token, where the link to that token is permanent provenance that survives a sale, and where whether the link still holds is a separate, live question answered from current chain state rather than from a stored record.

[ERC-6551](./eip-6551.md) (token-bound accounts, TBA) gives a token an *account*, but inverts the direction this standard needs: a TBA is "a wallet owned by a token," whereas an agent identity derived from a token is "an identity whose provenance is a token, owned by whoever the agent owner is." The two compose but solve different problems.

Concretely, this standard answers:

- **Provenance:** which source token (collection + tokenId) was an agent minted from? This must be immutable for the life of the agent.
- **Live ownership:** does the current owner of the agent still own the source token? This must be queryable at any time without trusting stored state.
- **Non-custody:** binding must not lock, escrow, or transfer the source token. Eligibility is checked at mint via `ownerOf`; nothing on the source collection changes.
- **Visual identity:** an agent bridged from a token should be able to present as the NFT it was derived from, so the binding is legible to people, not only to contracts.

Lookup across many source collections is out of scope.

Keeping provenance and live ownership distinct is the core contribution. A consumer evaluating an agent can ask "was this agent legitimately minted by a holder of collection X?" (permanent, answered by `getSourceNFT` and the `SourceNFTLinked` log) independently of "is the agent's source NFT still held by the agent owner today?" (live, answered by `isSourceNFTOwnershipValid`). Collapsing these, as a naive "bound NFT" field would, loses provenance the moment the source token is sold, and loses freshness the moment it is cached.

## 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 RFC 2119 and RFC 8174.

A compliant registry MUST be an [ERC-721](./eip-721.md) contract (the agent identity is itself an NFT) and an [ERC-8004](./eip-8004.md) Identity Registry as that standard specifies it; the ERC-8004 Reputation and Validation registries are not required by this standard. An agent minted through `registerWithSource` is an ordinary ERC-8004 identity: the registry performs every registration step ERC-8004 requires, in addition to the steps below. Because the registry is an ERC-8004 Identity Registry, it also exposes ERC-8004's plain `register` functions; an agent minted through them has no source binding, and `hasSourceNFT` returns `false` for it. The registry MUST implement the following interface and MUST return `true` from [ERC-165](./eip-165.md) `supportsInterface(0x27eba962)`, the interface id of `IAgentSourceBinding` (the XOR of its five function selectors).

```solidity
interface IAgentSourceBinding /* is IERC165 */ {
    /// @notice Emitted once, at registration, binding an agent to its source token.
    ///         MUST be emitted exactly once per agentId and MUST NOT be emitted again.
    event SourceNFTLinked(
        uint256 indexed agentId,
        address indexed sourceContract,
        uint256 sourceTokenId
    );

    /// @notice The source ERC-721 collection this registry is bound to.
    /// @dev MUST be immutable for the life of the registry.
    function boundCollection() external view returns (address);

    /// @notice Register an agent derived from `sourceTokenId` of `boundCollection`.
    /// @dev MUST revert unless `IERC721(boundCollection).ownerOf(sourceTokenId) == msg.sender`.
    ///      MUST mint a new agent identity (ERC-721) to `msg.sender`.
    ///      MUST record (boundCollection, sourceTokenId) as immutable provenance.
    ///      MUST emit `SourceNFTLinked`.
    ///      MUST NOT lock, escrow, or transfer the source token.
    /// @return agentId The newly minted agent identity.
    function registerWithSource(uint256 sourceTokenId)
        external
        payable
        returns (uint256 agentId);

    /// @notice The immutable source token an agent was derived from.
    /// @dev MUST revert if `agentId` does not exist or has no source binding.
    function getSourceNFT(uint256 agentId)
        external
        view
        returns (address sourceContract, uint256 sourceTokenId);

    /// @notice Whether `agentId` has a recorded source binding.
    function hasSourceNFT(uint256 agentId) external view returns (bool);

    /// @notice Whether the source token is still under the control of `agentId`.
    /// @dev Live check via `ownerOf`. Valid if `ownerOf(sourceToken)` is (a) the agent
    ///      holder, (b) the agent's CANONICAL ERC-6551 token-bound account, or (c) the
    ///      binding contract itself. A bare `ownerOf == ownerOf(agentId)` check is
    ///      non-conformant: it fails every (b) and (c) binding.
    ///      The account in (b) is pinned: the account from the ERC-6551 registry
    ///      0x000000006551c19487814612e58FE06813775758 with the implementation and salt
    ///      the registry declares, not "any TBA of the agent" (a token has many).
    ///      MUST NOT rely on cached ownership. Reverts for a non-existent `agentId`
    ///      (per ERC-721 `ownerOf`) and for an agent with no source binding (as
    ///      `getSourceNFT`); returns false (not revert) when the source token no longer exists.
    function isSourceNFTOwnershipValid(uint256 agentId) external view returns (bool);
}
```

### Query-only source binding

Not every agent that can prove source ownership implements source-binding *registration*. The canonical case is a **self-sourced** agent, whose source is the agent contract itself (`getSourceNFT(agentId)` returns `(address(this), agentId)`), so there is no external collection and `boundCollection` / `registerWithSource` have no meaning for it. Such an implementation MUST NOT advertise `IAgentSourceBinding` (`0x27eba962`): it does not implement all five functions, and advertising the full id is a false [ERC-165](./eip-165.md) positive that a consumer would trust.

For these implementations this standard defines a query-only companion interface, `IAgentSourceBindingView`, the read side of source binding, with [ERC-165](./eip-165.md) id `0x8b3597c9` (the XOR of the `getSourceNFT`, `hasSourceNFT`, and `isSourceNFTOwnershipValid` selectors):

```solidity
interface IAgentSourceBindingView /* is IERC165 */ {
    /// @notice The immutable source token an agent was derived from.
    /// @dev MUST revert if `agentId` does not exist or has no source binding.
    function getSourceNFT(uint256 agentId)
        external
        view
        returns (address sourceContract, uint256 sourceTokenId);

    /// @notice Whether `agentId` has a recorded source binding.
    function hasSourceNFT(uint256 agentId) external view returns (bool);

    /// @notice Whether the source token is still under the control of `agentId`.
    ///         Same semantics as in `IAgentSourceBinding`.
    function isSourceNFTOwnershipValid(uint256 agentId) external view returns (bool);
}
```

The three functions MUST implement semantics identical to their same-named counterparts in `IAgentSourceBinding`. `isSourceNFTOwnershipValid` in particular MUST implement the full three-case live-ownership rule defined under **Provenance vs. live ownership** below; a self-sourced implementation is not exempt from it. `IAgentSourceBindingView` is an independent interface, not a base of `IAgentSourceBinding`: the two ids stay fixed to the functions each declares.

- An implementation that returns `true` from `supportsInterface(0x8b3597c9)` MUST implement all three functions with the semantics defined in this standard.
- Such an implementation MUST return `false` from `supportsInterface(0x27eba962)` unless it also implements `boundCollection` and `registerWithSource`.
- A full `IAgentSourceBinding` implementation SHOULD also return `true` from `supportsInterface(0x8b3597c9)`, so a view-only consumer can detect it without probing the full interface.
- A consumer that only needs to read and re-verify source ownership SHOULD accept either `0x8b3597c9` or `0x27eba962`. A consumer that requires source-binding registration MUST check `0x27eba962`.
- An implementation MUST advertise only the interface it implements.

### Registration

- `registerWithSource` MUST verify live ownership of the source token by the caller and MUST revert otherwise.
- Implementations MAY offer overloads accepting a custom agent Uniform Resource Identifier (URI) and/or initial metadata, provided the source-ownership check and the `SourceNFTLinked` emission are preserved.
- The source binding, once recorded, MUST be immutable. There MUST be no function that rebinds, clears, or overwrites the `(sourceContract, sourceTokenId)` of an existing agent.
- A registry MUST NOT prevent the same source token from being bridged again: as a source token changes hands, each holder MAY mint an agent from it. The resulting agents are distinct identities sharing a common provenance source.
- The registry MUST treat the bound collection as untrusted code and MUST NOT rely on state assumptions across the `ownerOf` call.
- An implementation that forwards or escrows the value sent to `registerWithSource` MUST revert the entire registration if that transfer fails, and MUST NOT leave ETH stranded in the registry. A registry that charges no fee SHOULD reject a non-zero `msg.value`.

### Provenance vs. live ownership

- `getSourceNFT` and the `SourceNFTLinked` event express **permanent provenance** and MUST remain valid even after the source token is transferred away.
- `isSourceNFTOwnershipValid` expresses **live ownership** and MUST be computed from a current `ownerOf` call at query time.
- Consumers MUST NOT infer live ownership from `getSourceNFT` alone, and MUST NOT treat a `false` live check as invalidating provenance.
- **Valid ownership is not bare owner-equality.** `isSourceNFTOwnershipValid` MUST return `true` when `ownerOf(sourceToken)` is any of: (a) the current owner of `agentId` (direct, non-custodial holding); (b) the agent's canonical [ERC-6551](./eip-6551.md) token-bound account (the agent holds its own source); or (c) the binding contract itself (the source is escrowed under the binding). A literal `ownerOf(sourceToken) == ownerOf(agentId)` check is non-conformant: it reports every (b) and (c) binding as permanently lapsed.
- **Case (b) MUST pin a single account.** A token-bound account is `CREATE2`-derived from `(registry, implementation, chainId, tokenContract, tokenId, salt)`, so one agent token is the base of unboundedly many candidate accounts; "any TBA of the agent" is not checkable, and two implementations that pick differently disagree on identical chain state. The canonical account is the one computed via the [ERC-6551](./eip-6551.md) registry at `0x000000006551c19487814612e58FE06813775758` using the `implementation` and `salt` the binding registry declares. A conformant registry MUST make that `implementation` and `salt` determinable (for example a view returning the account, or values fixed in the implementation and documented).
- **Nonexistent agent, unbound agent, nonexistent source.** `isSourceNFTOwnershipValid` MUST revert for a non-existent `agentId` (it inherits ERC-721 `ownerOf` semantics) and MUST revert for an existing `agentId` that has no source binding, consistent with `getSourceNFT`. The return-`false`-not-revert rule applies only to the *source* token: for a bound agent whose source token is burned or does not exist, it returns `false`, not a revert.

### Consumer requirements

The provenance / live-ownership split exists so a consumer can ask "is this binding still true?" This subsection states when a consumer is obligated to ask. Here, a *consumer* is any contract or off-chain process that takes an irreversible action conditioned on a source-bound identity, and an *approval* is any authorization for that action issued before it is taken (for example a signed decision by a third party).

- **Re-check at action time, not approval time.** A consumer MUST call `isSourceNFTOwnershipValid` when it takes the action, not only when the action was approved. An approval reflects chain state as of when it was issued; source-token ownership is mutable and can lapse in between.
- **Atomicity.** Where the consumer is a contract, the re-check MUST be performed in the same transaction as the gated action. A separate re-check transaction ahead of the action reintroduces the lapse window at a smaller scale (a time-of-check to time-of-use (TOCTOU) gap). An off-chain consumer MUST re-check as close to execution as possible and record the check timestamp alongside the action.
- **Approvals do not carry a lapsed binding forward.** If `isSourceNFTOwnershipValid` returns `false` at action time, the consumer MUST NOT take the action on the strength of the earlier approval. The approval remains an authentic record of what was true when it was issued; consumers MUST record the failed re-check separately from the approval.
- **No canonical agent per source token.** Because re-mint is permitted, no `agentId` is *the* agent for a source token; several simultaneously valid bindings to one source token are possible. A consumer MUST treat the `agentId` as the identity and MUST NOT resolve "the agent for token X" by source token.
- **Caching.** `getSourceNFT` is immutable and MAY be cached indefinitely. `isSourceNFTOwnershipValid` MUST NOT be cached across actions; each gated action performs its own check.
- **Indexing.** This registry emits nothing when a binding's validity changes; validity changes as `Transfer` events on the *source* collection. A consumer that indexes binding validity MUST watch both the registry and the source collection.

### Binding scope

- A registry MUST be bound to exactly one source collection (`boundCollection`), fixed at deployment and immutable thereafter.

### Metadata inheritance

- [ERC-8004](./eip-8004.md) requires the agent's URI to resolve to the agent registration file. An implementation SHOULD carry the source token's visual metadata (image, name, attributes) in that registration file, for example by reusing the source token's InterPlanetary File System (IPFS) media, so that the agent presents with the visual identity of its source token. This standard does not change what the agent URI must resolve to.
- The transport mechanism is implementation-defined: an implementation MAY reference the source token's media directly (same content identifier (CID)), or embed a derived copy. The standard does not prescribe the document shape beyond what ERC-8004 requires.
- An agent MAY carry distinct visual metadata where a separate identity is intended.

## Rationale

- **Live `ownerOf` over locking:** non-custodial binding keeps the source NFT liquid and usable elsewhere; the standard never competes with the source collection for custody.
- **Immutable provenance:** provenance that disappears on transfer is not provenance. Recording it once and never mutating it makes "minted by a holder of X" a permanent, log-indexable fact.
- **Separate live view:** consumers that do care about current ownership (for example gating an action on continued holding) get a trustless live check, decoupled from the historical fact.
- **Agent identity as ERC-721:** makes agents themselves transferable and marketplace-compatible, reusing existing infrastructure rather than inventing custody.
- **Re-mint over a mint ledger:** eligibility is "the caller owns the source token now." Forbidding a second mint would require tracking historical mints and gating on them, which recreates the custody the standard avoids. The consequence is that the number of agents bound to a collection is not bounded by its supply, which is why the consumer requirements forbid resolving an identity by source token.
- **Fees are non-normative:** `registerWithSource` is `payable` to accommodate implementations that charge a mint fee, but the standard defines no fee, treasury, or pricing mechanism, and a registry may mint for free.
- **Honest ERC-165 over convenient ERC-165:** a self-sourced agent implements the read side of binding but not registration. Rather than let it advertise the full `IAgentSourceBinding` and misreport `supportsInterface`, the standard gives that profile its own id (`0x8b3597c9`). Whether a source exists and is still owned is universal; registration presumes an external collection. Deriving the id via `type(IAgentSourceBindingView).interfaceId` rather than a hardcoded constant keeps it from drifting from the functions the interface declares.

## Backwards Compatibility

This standard is strictly additive to [ERC-8004](./eip-8004.md) and changes no existing interface. A compliant registry is a valid ERC-721 and ERC-8004 Identity Registry; consumers unaware of `IAgentSourceBinding` treat agents as ordinary ERC-8004 identities.

## Reference Implementation

Both interfaces are given, with their ERC-165 ids, in [the interface file](../assets/eip-8323/IAgentSourceBinding.sol).

An implementation deploys one registry per source collection. `registerWithSource` reads `ownerOf(sourceTokenId)` on the bound collection, mints the agent identity to the caller, records `(boundCollection, sourceTokenId)` in storage that no function can later overwrite, and emits `SourceNFTLinked`. `isSourceNFTOwnershipValid` reads `ownerOf` on the source collection at call time and compares it with the three cases: the current owner of the agent, the agent's token-bound account computed from the ERC-6551 registry with the implementation and salt the registry exposes through a view, and the registry's own address. A self-sourced registry implements only `IAgentSourceBindingView`, returns `(address(this), agentId)` from `getSourceNFT`, and answers `true` for `0x8b3597c9` and `false` for `0x27eba962`.

## Security Considerations

- **Provenance is not current ownership.** `getSourceNFT` says where an agent came from, not who holds that token today; only `isSourceNFTOwnershipValid` answers the second question.
- **Source-token transfer after mint.** Because binding is non-custodial, the source token can be sold while the agent persists. This is intended, and an application gating on continued holding has to re-check live.
- **Sybil surface.** Because re-mint is allowed, "an agent exists for token X" is not evidence of a unique or current relationship. Where uniqueness matters, applications combine provenance, the live check, and their own policy.
- **Track record does not travel with the source token.** A re-minted agent inherits provenance, never reputation. Records of an agent's past conduct bind to the `agentId`, not to the source token, so trust should not be transferred across distinct `agentId`s that share a source token. Buying the token buys provenance and visual identity, not a history, which makes resale neutral at the trust layer.
- **Hostile source collection.** The bound collection is arbitrary ERC-721 code. A malicious `ownerOf` can lie about ownership; the binding is only as trustworthy as the collection it is bound to.
- **Value handling.** `registerWithSource` is `payable`; mishandled forwarding could mint an agent without the associated value settling, or strand ETH in the registry.
- **Contract wallets.** Agent identities are often operated by smart-contract wallets. Where an implementation accepts contract-wallet signatures for the ERC-8004 agent-wallet functions, it should verify them through [ERC-1271](./eip-1271.md) and bind each signed payload to the `agentId` and an expiry, as ERC-8004 describes.

## Copyright

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