Sub topic 2
Labeling Entities and Judging Label Quality
This chapter assumes you know what a blockchain, wallet address, and transaction are. You should also know how Bitcoin's UTXO model differs from Ethereum's account model, and be able to read Python lists, dictionaries, and functions.
Labeling entities and judging label quality
An entity is one actor, such as an exchange, that controls many addresses. A label is a name attached to an address, such as "ExchangeA hot wallet." Labels come from exchange disclosures, public proofs, clustering results, and commercial datasets.
Judge each label by its source and age. An official disclosure is stronger than a guess based on one transfer. Labels also go stale when an exchange rotates its wallets. Treat every label as a claim that needs evidence.
How exchanges organize wallets
Exchanges split their funds across three wallet types:
- Hot wallets are online and pay out withdrawals quickly. They hold the smallest share of reserves.
- Warm wallets are partly online and refill hot wallets.
- Cold wallets are offline and hold most of the reserves.
Exchanges also give many users deposit addresses. Deposits often move into shared collection wallets, and then into cold storage. A single exchange can therefore control thousands of addresses, and many of them only receive funds.
Computing inflows, outflows, and netflow
Inflow to an exchange is value sent from outside to any of its addresses. Outflow is value sent from its addresses to outside. Netflow is inflow minus outflow. Transfers between two addresses of the same exchange are internal and must be skipped.
from collections import defaultdict
def exchange_netflow(transfers, labels):
flows = defaultdict(lambda: {"inflow": 0.0, "outflow": 0.0})
for t in transfers:
src = labels.get(t["from"])
dst = labels.get(t["to"])
if src is not None and src == dst:
continue # internal move within one exchange
if dst is not None:
flows[(dst, t["day"])]["inflow"] += t["amount"]
if src is not None:
flows[(src, t["day"])]["outflow"] += t["amount"]
return {
key: {**v, "netflow": v["inflow"] - v["outflow"]}
for key, v in flows.items()
}
labels = {"dep1": "ExchangeA", "hot1": "ExchangeA"}
transfers = [
{"day": "2026-11-26", "from": "user1", "to": "dep1", "amount": 120.0},
{"day": "2026-11-26", "from": "dep1", "to": "hot1", "amount": 50.0},
{"day": "2026-11-26", "from": "hot1", "to": "user2", "amount": 30.0},
]
print(exchange_netflow(transfers, labels))Defining and finding large holders
A large holder, often called a whale, is an entity whose balance exceeds a threshold you choose. Set the threshold relative to total supply, not as a fixed count of coins. Group addresses by entity before ranking. Otherwise one exchange looks like many separate whales.
When you study individual investors, exclude exchange, custodian, and contract addresses from the ranking.
> Labels are claims. Check them before you act on a flow.
Exercise
Using the code above, what is ExchangeA's netflow on 2026-11-26?
Show answer
The transfer from dep1 to hot1 is internal, so it is skipped. Inflow is 120.0 from user1. Outflow is 30.0 to user2. Netflow is 120.0 - 30.0 = 90.0.