---
eip: 6808
label: ERC-6808
title: Fungible Key Bound Token
status: Final
type: Standards Track
category: ERC
created: 2023-03-31
requires: 20
official: https://eips.ethereum.org/EIPS/eip-6808
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6808.md
canonical: https://eips.huatuo.xyz/zh/eip-6808/
lang: zh
tldr: ERC-20 扩展：持有者可以绑定两个密钥钱包，转账和授权必须事先经过它们批准；若其中一个钱包被盗，还可以转移资金或重置密钥。
tags: [token, erc20, security, anti-theft, wallet]
---

# ERC-6808: Fungible Key Bound Token

> An interface for Fungible Key Bound Tokens, also known as a FKBT.

**TL;DR:** ERC-20 扩展：持有者可以绑定两个密钥钱包，转账和授权必须事先经过它们批准；若其中一个钱包被盗，还可以转移资金或重置密钥。

## 它解决什么问题？

使用普通的 [ERC-20](/eip-20/) 代币时，谁掌握持有钱包的私钥，谁就掌控代币。助记词泄露或一次恶意签名就可能让资产被全部转走，没有第二次机会。

ERC-6808（Fungible Key Bound Token，FKBT）把可选的保护机制直接内置到代币中。持有者关联两个额外的 **密钥钱包**；关联之后，持有钱包只能在密钥钱包明确允许的限额内转移或授权代币。三个钱包中若有一个被盗，另外两个仍然可以保护资金。它面向 NFT 的姊妹标准是 [ERC-6809](/eip-6809/)。

## 它如何运作

接口 `IKBT20` 在 ERC-20 基础上增加了：

| 函数 | 调用者 | 效果 |
| --- | --- | --- |
| `addBindings(key1, key2)` | 持有者 | 用两个不同的密钥钱包保护账户（触发 `AccountSecured`） |
| `allowTransfer(amount, time, to, allFunds)` | 密钥钱包 | 在限制范围内允许持有者的下一次 `transfer` |
| `allowApproval(time, numberOfTransfers)` | 密钥钱包 | 允许持有者调用 `approve` / `increaseAllowance` / `decreaseAllowance`，并可限制 spender 能调用 `transferFrom` 的次数 |
| `safeFallback()` | 密钥钱包 | 将持有者的全部代币转到 **另一个** 密钥钱包 |
| `resetBindings()` | 密钥钱包 | 移除两个密钥钱包；代币恢复为普通 ERC-20 的行为 |

在 `allowTransfer` 中，`amount` 为 0、`time` 为 0 或 `to` 为 0，表示该维度"不设限制"，`allFunds = true` 则解锁全部。查询辅助函数（`getBindings`、`getTransferableFunds`、`getApprovalConditions`、`getNumberOfTransfersAllowed`、`isSecureWallet`）用于查看当前状态。

恢复逻辑：

- **持有钱包被盗** → 密钥钱包调用 `safeFallback`。资金会转到 *另一个* 密钥钱包，因此仅凭一个被盗的密钥钱包无法借此窃取资金。
- **某个密钥钱包被盗** → 另一个密钥钱包调用 `resetBindings`，然后持有者绑定新的密钥。持有者不能单独重置，否则掌握持有者私钥的窃贼可以直接移除保护。

如果三个钱包中有两个被盗，该标准就无能为力了。

## 示例代码

保护账户，然后发起一次受保护的转账（ethers v6）：

```ts
import { Contract, JsonRpcProvider, Wallet, parseUnits } from "ethers";

const abi = [
  "function addBindings(address,address) returns (bool)",
  "function allowTransfer(uint256 amount,uint256 time,address to,bool allFunds) returns (bool)",
  "function transfer(address,uint256) returns (bool)",
];
const provider = new JsonRpcProvider(process.env.RPC_URL);
const holder = new Wallet(process.env.HOLDER_KEY!, provider);
const key1   = new Wallet(process.env.KEY1_KEY!, provider);

const asHolder = new Contract(process.env.TOKEN!, abi, holder);
const asKey1   = asHolder.connect(key1) as Contract;

// one-time setup from the holding wallet
await (await asHolder.addBindings(key1.address, process.env.KEY2_ADDRESS!)).wait();

// each transfer: key wallet authorises 100 tokens to one recipient, then holder sends
const amount = parseUnits("100", 18);
await (await asKey1.allowTransfer(amount, 600, process.env.RECIPIENT!, false)).wait();
await (await asHolder.transfer(process.env.RECIPIENT!, amount)).wait();
```

## 需要注意

- 状态为 **Final**。
- 安全功能需要主动开启。在调用 `addBindings` 之前，代币的行为与 ERC-20 完全相同。
- 每次受保护的转账或授权都需要密钥钱包额外发送一笔交易，会花费 gas 和时间。
- 规范对 `time` 参数既说成秒，又说成"区块数"；在依赖某个具体单位之前，请先确认你所使用的实现。
- 如果任一密钥钱包已绑定到其他持有者、就是持有者本人，或是零地址，`addBindings` 应该 revert。
- 通过 `transferFrom` 拉取代币的集成仍然可用，但前提是持有者的授权已通过 `allowApproval` 获得允许。一种相关的基于验证的方案是 [ERC-7144](/eip-7144/)。


---

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