---
eip: 8047
label: ERC-8047
title: Forensic Token (Forest)
status: Draft
type: Standards Track
category: ERC
created: 2025-10-15
requires: 165, 1155, 5615
official: https://eips.ethereum.org/EIPS/eip-8047
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8047.md
canonical: https://eips.huatuo.xyz/eip-8047/
lang: en
tldr: 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.
tags: [token, compliance, traceability, erc-1155, aml]
---

# ERC-8047: Forensic Token (Forest)

> A DAG-based token enabling hierarchical traceability and efficient enforcement for compliant digital assets.

**TL;DR:** 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](/eip-1155/) with the [ERC-5615](/eip-5615/) supply extension. Each token ID is a node:

```solidity
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):

```ts
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](/eip-3643/), which enforces compliance at the account and identity level rather than per-token lineage.


---

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