Sub topic 10
Measuring concentration with top-N share
This chapter assumes you can read basic Python and know what an address and a balance are. It also assumes you have seen how addresses are clustered and labeled into entities, and how exchange wallets are structured. Here you will turn a list of balances into one number that says how concentrated a token's ownership is. You will also learn why that number is easy to compute and easy to misread.
What top-N share measures
Top-N share is the fraction of total balance held by the N largest holders:
top_n_share = (sum of the N largest balances) / (sum of all balances)A result near 0 means ownership is spread widely. A result near 1 means a handful of holders own almost everything. Common choices are N = 1, 10, 100, and sometimes 1% of holders. You can compare the same N across tokens, or the same token across dates.
The measure is popular because it needs only a balance snapshot and has no tuning parameters beyond N. Its weakness is that the raw ledger gives you balances per address, not per owner. The result is only as good as the work done before the formula runs.
The basic computation
def top_n_share(balances, n):
"""Fraction of total supply held by the n largest balances."""
total = sum(balances)
if total == 0:
return 0.0
top = sorted(balances, reverse=True)[:n]
return sum(top) / total
balances = [5000, 1200, 800, 300, 100, 50, 25, 10, 5, 1]
print(round(top_n_share(balances, 3), 4)) # 0.9345The total is 7491 and the top three balances sum to 7000, so the share is about 0.9345. Three holders out of ten own roughly 93% of the supply in this sample.
Edge cases the function handles or should handle:
- Zero total. Returning 0.0 avoids division by zero. In production you may prefer to raise an error or return
None, because "no data" and "perfectly spread" are different situations. - N larger than the list. Slicing simply returns every balance, so the share is 1.0. This is correct but can mislead if you compare tokens with very different holder counts.
- Negative balances. Real ledgers do not have them. If your data pipeline produces one, it is a bug (for example, a missed incoming transfer), and the share will be wrong. Validate inputs rather than letting the formula hide the problem.
- Zero balances. Emptied addresses can be dropped. They do not change the sum, but they inflate holder counts if you later compute "top 1% of holders".
Why the raw number is usually wrong
Run the formula on every address of a popular token and the top of the list is rarely whales. It is infrastructure. Three kinds of address distort the result:
- Exchange wallets. A big exchange holds customer funds in a few very large wallets. Those balances belong to many people, so ranking them as one "holder" overstates concentration.
- Contracts. Staking contracts, bridges, liquidity pools, and wrapped-token vaults hold large balances on behalf of many users.
- Burn and null addresses. Tokens sent to an unspendable address still show a balance, but nobody can use them.
There is also the opposite error. One real owner may split funds over many addresses, so the top addresses understate that owner's share. That is why clustering and labeling come before this calculation.
An adjusted version
The next function applies the pipeline in the diagram. It sums balances by entity, drops entities in excluded categories, and then reuses top_n_share.
from collections import defaultdict
def top_n_share(balances, n):
total = sum(balances)
if total == 0:
return 0.0
top = sorted(balances, reverse=True)[:n]
return sum(top) / total
def adjusted_top_n_share(balances, entity_of, category_of, n,
exclude=("exchange", "contract", "burn")):
"""balances: dict address -> balance.
entity_of: dict address -> entity name (unknown addresses are their own entity).
category_of: dict entity name -> category (unknown entities count as 'unknown').
"""
by_entity = defaultdict(float)
for addr, bal in balances.items():
by_entity[entity_of.get(addr, addr)] += bal
kept = [
bal for entity, bal in by_entity.items()
if category_of.get(entity, "unknown") not in exclude
]
return top_n_share(kept, n)
balances = {
"ex_hot": 1000, "ex_cold": 3000, "staking_contract": 3000,
"w1": 500, "w2": 400, "w3": 300, "w4": 200,
"w5": 100, "w6": 100, "w7": 50, "w8": 50,
}
entity_of = {"ex_hot": "ExchangeA", "ex_cold": "ExchangeA"}
category_of = {"ExchangeA": "exchange", "staking_contract": "contract"}
raw = top_n_share(list(balances.values()), 3)
by_entity_only = adjusted_top_n_share(balances, entity_of, category_of, 3, exclude=())
adjusted = adjusted_top_n_share(balances, entity_of, category_of, 3)
print(round(raw, 4), round(by_entity_only, 4), round(adjusted, 4))The output is 0.8046 0.8621 0.7059, and each number answers a different question:
| Step | Top-3 share | What changed |
|---|---|---|
| Raw addresses | 0.8046 | The exchange is split over two addresses, so its 4000 never appears as one holder. |
| Grouped by entity | 0.8621 | `ex_hot` and `ex_cold` merge into ExchangeA (4000), which now ranks first. |
| Infrastructure excluded | 0.7059 | ExchangeA and the staking contract are removed, leaving 1700 held by individual holders. |
Notice that grouping alone made concentration look higher, and exclusion made it lower. Neither direction is "the truth". The adjusted figure describes how concentrated the tokens are among non-infrastructure holders, which is usually the question a whale study asks.
Choices that change the answer
The denominator
The sum of all balances is not always the right base. Three options are common:
- Total supply. Includes locked, burned, and unissued-but-minted tokens.
- Circulating supply. Excludes locked and burned amounts, but definitions differ by data provider.
- Sum of kept balances. What the code above uses: the total after exclusions.
Pick one, state it, and use it consistently. A top-10 share of 40% of supply and 60% of circulating supply can describe the same token.
The value of N
A small N, such as 1 or 10, is sensitive to a single entity changing labels. A large N, such as 1000, is less sensitive but hides what happens at the very top. Reporting several values (top 1, top 10, top 100) shows the shape of the distribution rather than one point.
Snapshot timing
Balances change every block. Compare snapshots taken at the same time of day, or at the same block height, when you track trends. On an account chain you can read balances at a specific block from a node. On a UTXO chain you must add up unspent outputs per address or cluster as of that block.
Excluding versus reporting
Dropping exchanges and contracts hides information that matters. If 30% of a token sits on one exchange, that is a fact about market structure. A good report gives the adjusted top-N share and the excluded share, for example "top-10 non-infrastructure holders own 12% of circulating supply; exchanges hold 30%; contracts hold 18%".
Common errors
- Using the top-N number without labels. The largest address on many tokens is an exchange or a contract. A "whale owns 20%" headline built that way is usually wrong.
- Comparing across chains or tokens with different label coverage. A token with well-labeled holders will look less concentrated than one with poor labels, even if the real distributions match.
- Treating clusters as certain. Common-input clustering can merge unrelated owners, for example when CoinJoin transactions combine inputs from many users. Each merge inflates the top holder.
- Ignoring custodians. Funds in a custodian's omnibus wallet may belong to many clients. Treat custodians like exchanges unless you have evidence of a single beneficial owner.
- Reading a change as an event. A jump in top-10 share between two days may come from a relabeled address, a newly discovered cluster, or a contract migration. Check the label change log before concluding that a whale bought.
Beyond top-N
Top-N share ignores everything below rank N. Two tokens can share a top-10 value of 50% while one has a smooth tail and the other has a few giants followed by a cliff. Measures such as the Gini coefficient or the Herfindahl-Hirschman index use the whole distribution. You do not need them to start, but if two top-N figures look identical and the tokens behave differently, look at the tail. Plotting the cumulative share by rank is a cheap first check.
Exercises
Exercise
A token has these entity balances after grouping: ExchangeB 600 (exchange), Vault 300 (contract), Alice 50, Bob 30, Carol 20. What is the top-2 share over all entities, and what is it after excluding the exchange and the contract?
Show answer
Total is 1000. Top two over all entities are ExchangeB and Vault, so (600 + 300) / 1000 = 0.9. After excluding the exchange and contract, the kept total is 100 and the top two are Alice and Bob, so (50 + 30) / 100 = 0.8. The headline concentration drops from 0.9 to 0.8, and the report should also state that infrastructure holds 90% of the balance.
Exercise
A top-10 share rises from 31% to 38% in one day with no large market moves. Name two non-trading explanations you would check before concluding that whales accumulated.
Show answer
Possible explanations include: a newly labeled or newly clustered group of addresses that merged several holders into one (or a previously excluded address that lost its exchange or contract label), a contract migration that moved balances to a new address, a change in the denominator such as updated circulating supply, or a snapshot taken at a different time than the earlier one. Check the label change log, cluster changes, and snapshot block heights first.