---
eip: 6956
label: ERC-6956
title: Asset-bound Non-Fungible Tokens
status: Review
type: Standards Track
category: ERC
created: 2023-04-29
requires: 165, 721
official: https://eips.ethereum.org/EIPS/eip-6956
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6956.md
canonical: https://eips.huatuo.xyz/zh/eip-6956/
lang: zh
tldr: 将 NFT 与实体或数字资产一对一绑定，并允许证明自己控制该资产的人（由可信预言机证明）在无需当前所有者签名的情况下铸造、转移、授权或销毁该 NFT。
tags: [nft, phygital, physical-assets, oracle, attestation]
---

# ERC-6956: Asset-bound Non-Fungible Tokens

> Asset-bound NFTs anchor a token 1-1 to an asset and operations are authorized through oracle-attestation of control over the asset

**TL;DR:** 将 NFT 与实体或数字资产一对一绑定，并允许证明自己控制该资产的人（由可信预言机证明）在无需当前所有者签名的情况下铸造、转移、授权或销毁该 NFT。

## 它解决什么问题？

NFT 常被用来代表现实中的东西：运动鞋、收藏品、汽车零件、房子。使用普通的 [ERC-721](/eip-721/)，这种关联很弱：资产标识符存放在可变的链下元数据中，而 NFT 只有在当前持有者签名时才会移动。如果你卖掉了运动鞋，但旧主人仍持有（或失去了访问权限）NFT，代币与实物就会脱节。

ERC-6956 颠倒了可信来源。**对资产的控制决定谁控制 NFT。** 只要你能证明自己持有该实物，就可以认领它的代币，即使前任持有者不配合或丢失了密钥。

## 它如何运作

规范中的关键术语：

- **Anchor（锚点）** — 资产唯一的 `bytes32` id（对实体商品通常是哈希后的序列号），通过 `tokenByAnchor` / `anchorByToken` 与 token id 一一对应。token id `0` 和 anchor `0x0` 无效。
- **Oracle（预言机）** — 验证*控制权证明*的可信签名者，例如，确认指定了 `to` 地址的手机确实在物体上防篡改标签的物理附近。
- **Attestation（证明）** — `abi.encode(to, anchor, attestationTime, validStartTime, validEndTime, signature)`，其中预言机对 `keccak256(to, anchor, attestationTime, validStartTime, validEndTime)` 签名。

任何人都可以提交 attestation；发送方和接收方都不必签名，gas 可以由品牌方等第三方支付：

- `transferAnchor(attestation)` — 将代币转移给 `to`，如果该 anchor 还没有代币，则铸造。
- `approveAnchor(attestation)` 和 `burnAnchor(attestation)` — 仅当 `approveAuthorization()` / `burnAuthorization()` 包含 `ASSET` 时才允许。
- `decodeAttestationIfValid(attestation, data)` — 在不改变状态的情况下，检查签名者是否为可信预言机、时间窗口是否有效以及 attestation 是否未被使用。

每个 attestation 只能使用一次（`AttestationUse` 事件，`attestationsUsedByAnchor`）。除非 anchor 已被释放，否则普通的 ERC-721 转账会被阻止，且不允许批量转账。

可选扩展：**AttestationLimited**（限制 anchor 可移动的次数）、**Floatable**（临时允许无需 attestation 的普通转账，例如交易预订单）和 **ValidAnchors**（有效 anchor 的 Merkle 根，由与预言机分离的角色维护）。

## 示例代码

预言机在验证用户位于物体旁之后创建 attestation（ethers v6）：

```ts
import { AbiCoder, getBytes, solidityPackedKeccak256, Wallet } from "ethers";

async function makeAttestation(oracle: Wallet, to: string, anchor: string) {
  const now = Math.floor(Date.now() / 1000);
  const validStart = 0;
  const validEnd = now + 15 * 60; // 15 minutes

  const hash = solidityPackedKeccak256(
    ["address", "bytes32", "uint256", "uint256", "uint256"],
    [to, anchor, now, validStart, validEnd],
  );
  const sig = await oracle.signMessage(getBytes(hash));

  return AbiCoder.defaultAbiCoder().encode(
    ["address", "bytes32", "uint256", "uint256", "uint256", "bytes"],
    [to, anchor, now, validStart, validEnd, sig],
  );
}

// any account (e.g. the issuer's gas payer) can submit it
await abnft.connect(gasPayer).transferAnchor(await makeAttestation(oracle, alice, anchor));
```

## 需要注意

- **状态：Review。**
- **盗窃随实物而行。** 如果资产被盗，窃贼可以认领该 NFT；预言机证明的是控制权，而非法律上的所有权。若这很重要，请结合锁定机制（例如 [ERC-5192](/eip-5192/)）。
- **耗尽 gas。** 如果发行方为每个 attestation 支付 gas，持有一件实物的攻击者可以不断向新地址生成 attestation。推荐的防御措施是 AttestationLimited 扩展。
- 一切都取决于预言机和 anchor 技术。明确不推荐容易被复制的标签（条形码、普通 NFC 芯片）。
- 请对序列号做哈希，而不是直接使用，以免代币数据泄露产量。
- 相关方案：[ERC-4519](/eip-4519/) 和 [ERC-5791](/eip-5791/)，它们依赖带有自身签名芯片的资产。


---

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