EIPs Explained

ERC-6808 · Final · ERC · 2023-03-31

ERC-6808: Fungible Key Bound Token

An ERC-20 extension where a holder can bind two key wallets that must pre-authorize transfers and approvals, and can rescue funds or reset keys if one wallet is compromised.

What problem does it solve?

With a normal ERC-20 token, whoever controls the holding wallet's key controls the tokens. A leaked seed phrase or one malicious signature can drain everything, with no second chance.

ERC-6808 (Fungible Key Bound Token, FKBT) builds optional protection into the token itself. The holder links two extra key wallets; once linked, the holding wallet can only move or approve tokens within limits that a key wallet has explicitly allowed. If one of the three wallets is compromised, the other two can still protect the funds. Its sibling for NFTs is ERC-6809.

How it works

The interface IKBT20 adds to ERC-20:

Function Caller Effect
addBindings(key1, key2) holder Secure the account with two distinct key wallets (emits AccountSecured)
allowTransfer(amount, time, to, allFunds) key wallet Permit the holder's next transfer within limits
allowApproval(time, numberOfTransfers) key wallet Permit the holder to call approve / increaseAllowance / decreaseAllowance, optionally capping how many transferFrom calls the spender gets
safeFallback() key wallet Move all tokens from the holder to the other key wallet
resetBindings() key wallet Remove both key wallets; token behaves like plain ERC-20 again

In allowTransfer, a zero amount, zero time or zero to means "no restriction" on that dimension, and allFunds = true unlocks everything. View helpers (getBindings, getTransferableFunds, getApprovalConditions, getNumberOfTransfersAllowed, isSecureWallet) expose the current state.

Recovery logic:

  • Holding wallet compromised → a key wallet calls safeFallback. Funds go to the other key wallet, so a single stolen key wallet cannot use this to steal.
  • A key wallet compromised → the other key wallet calls resetBindings, then the holder binds new keys. The holder alone cannot reset, otherwise a thief with the holder key could just remove the protection.

If two of the three wallets are compromised, the standard cannot help.

Sample code

Securing an account, then making a protected transfer (ethers v6):

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();

Things to know

  • Status is Final.
  • Security is opt-in. Until addBindings is called the token behaves exactly like ERC-20.
  • Each protected transfer or approval needs an extra transaction from a key wallet, which costs gas and time.
  • The spec describes the time parameter both as seconds and as "number of blocks"; check the implementation you use before relying on a specific unit.
  • addBindings should revert if either key wallet is already bound to another holder, is the holder itself, or is the zero address.
  • Integrations that pull tokens with transferFrom still work, but only after the holder's approval was allowed via allowApproval. A related validation-based approach is ERC-7144.

#token #erc20 #security #anti-theft #wallet

Details

Authors
Mihai Onila (@MihaiORO), Nick Zeman (@NickZCZ), Narcis Cotaie (@NarcisCRO)
Status
Final
Type
Standards Track / ERC
Created
2023-03-31
Requires

Machine-readable: Markdown · JSON