EIPs Explained

ERC-8047 · Draft · ERC · 2025-10-15

ERC-8047: Forensic Token (Forest)

An ERC-1155-based token where every transfer spawns a child token linked to its parent, forming a traceable DAG so issuers can freeze tainted funds by lineage instead of whole accounts.

What problem does it solve?

With account-based tokens like ERC-20, every incoming payment is merged into one balance. When a regulated issuer (e-money, stablecoin, CBDC-style system) learns that some funds came from a hack or fraud, it can usually only freeze the whole account, locking legitimate money too, after slow off-chain analysis.

Forest (Forensic Token) keeps the identity of money as it moves. Each unit of value has an ID, a parent and a root, so an issuer can target exactly the funds descended from a suspicious token and leave the rest of a user's holdings usable.

How it works

Built on ERC-1155 with the ERC-5615 supply extension. Each token ID is a node:

struct Token { uint256 root; uint256 parent; uint256 value; uint96 depth; address owner; }
  • Mint: creates a new root (root = id, parent = 0). IDs are always generated by the contract, never by the caller, to prevent collisions or lineage forgery.
  • Spend (safeTransferFrom): the sender's token is reduced by value (partial spend) or to zero (full spend), and a new child token is minted to the recipient with parent = id, depth = parent.depth + 1. Two TransferSingle events are emitted for ERC-1155 compatibility, plus TokenSpent and TokenCreated.
  • Burn: a soft delete. Value goes down but the ID stays in the DAG so lineage is never lost; exists(id) stays true.
  • Merge: several tokens with the same root can be combined into one new token whose parent is the deepest input. Cross-root merges are optional and must use a non-zero mergeType.

Enforcement works by root or depth. Because every descendant carries its root, a rule like "freeze root X from depth 3 onward" applies to the whole family in constant time, without iterating over tokens. The reference implementation stores per-depth freeze flags in 256-bit bitmaps.

Sample code

Walking a token's lineage back to its origin (ethers v6):

import { Contract } from "ethers";

const forest = new Contract(tokenAddress, [
  "function parentOf(uint256) view returns (uint256)",
  "function rootOf(uint256) view returns (uint256)",
  "function depthOf(uint256) view returns (uint256)",
], provider);

async function lineage(id: bigint): Promise<bigint[]> {
  const path = [id];
  let cur = id;
  while (true) {
    const p: bigint = await forest.parentOf(cur);
    if (p === 0n) break;     // reached the root
    path.push(p);
    cur = p;
  }
  return path;               // [id, parent, ..., root]
}

Things to know

  • Status is Draft.
  • Not a drop-in ERC-20: balances are spread over many token IDs, so wallets need to pick IDs to spend and should compute spendable balance off-chain from events.
  • Many small transfers create many nodes; the spec recommends dust limits and bounded batch sizes to avoid state bloat and out-of-gas.
  • Merging across different roots mixes lineages and can "taint" clean funds; wallets should keep tokens partitioned by root.
  • The full flow of funds is public by design. Privacy requirements must be handled elsewhere.
  • Compare ERC-3643, which enforces compliance at the account and identity level rather than per-token lineage.

#token #compliance #traceability #erc-1155 #aml

Details

Authors
Sirawit Techavanitch (@MASDXI) <[email protected]>, Supachate Innet <[email protected]>
Status
Draft
Type
Standards Track / ERC
Created
2025-10-15
Requires

Machine-readable: Markdown · JSON