Sub topic 9
Measuring concentration: top-N share and Gini
This chapter assumes you can read simple Python and know basic statistics (percentiles, distributions). It also assumes you have a table of balances from the earlier chapter on holder distribution and balance cohorts. Cohorts tell you how many addresses sit in each balance band. Concentration measures compress that picture into one number, so you can track it over time or compare assets.
What concentration measures answer
Concentration asks how unequally supply is spread across holders. A small number of holders controlling most of the supply raises several practical questions:
- How easily could a few holders move the market by selling?
- How much would a governance vote, if holders vote by balance, reflect only a few parties?
- Is the supply mostly spread among many small holders?
Two measures are standard. Top-N share is the fraction of total supply held by the N largest balances. The Gini coefficient is a single number between 0 and 1 that summarizes inequality across all balances. They answer different questions, and you will usually want both.
Top-N share
Top-N share is the simplest concentration measure. Sort balances from largest to smallest, add up the first N, and divide by the total.
def top_n_share(balances, n):
total = sum(balances)
return sum(sorted(balances, reverse=True)[:n]) / total
def gini(balances):
xs = sorted(balances)
n = len(xs)
total = sum(xs)
weighted = sum(i * x for i, x in enumerate(xs, start=1))
return 2 * weighted / (n * total) - (n + 1) / n
balances = [1, 1, 2, 5, 10, 100, 881]
print(top_n_share(balances, 2))
print(gini(balances))The total here is 1000. The two largest balances are 881 and 100, so the top-2 share is 981 / 1000 = 0.981. The Gini value is about 0.813.
Common choices are N = 1, 10, 100, and sometimes a percentage such as the top 1% of holders. Each has a different use:
- Fixed N (top 10, top 100) is easy to explain and compare across dates. It is sensitive to the single largest holder.
- Percentage of holders (top 1%) scales with the number of holders. The cutoff moves as the holder count grows, which makes comparisons across assets trickier. An asset with 100 million dust addresses has a top 1% of a million addresses.
Top-N share has two limits. It says nothing about the distribution below rank N. It also changes in discrete jumps when one large holder moves funds.
The Gini coefficient
The Gini coefficient comes from economics, where it summarizes income inequality. For balances sorted from smallest to largest as x₁ ≤ x₂ ≤ … ≤ xₙ, the formula used in the code is:
G = 2 · Σ(i · xᵢ) / (n · Σxᵢ) − (n + 1) / n
where the sum runs over ranks i = 1 to n. Read the result like this:
| Gini | Meaning |
|---|---|
| 0 | Every holder has the same balance |
| Around 0.5 | Moderate inequality |
| Close to 1 | Almost all supply sits in very few holders |
Two edge cases show the limits of the scale.
def gini(balances):
xs = sorted(balances)
n = len(xs)
total = sum(xs)
weighted = sum(i * x for i, x in enumerate(xs, start=1))
return 2 * weighted / (n * total) - (n + 1) / n
print(gini([10, 10, 10, 10])) # 0.0, perfectly equal
print(gini([0, 0, 0, 100])) # 0.75, one holder has everythingThe second result is 0.75 and not 1. With a finite number of holders, the maximum is (n − 1) / n. For n = 4 that is 0.75. This matters little when n is in the millions, but it matters when you compute Gini over a small set, such as the top 100 holders. Some analysts rescale by n / (n − 1) so the maximum becomes exactly 1.
Why Gini is hard to use on crypto data
Gini was designed for populations where almost everyone has a positive amount and roughly one person is one unit. On-chain balances break both assumptions, and the Gini of a typical token is often above 0.9 for reasons that have little to do with ownership structure.
- Many tiny balances. Large numbers of addresses hold dust. Whether you include them changes the result a great deal.
- Zero balances. Addresses that once held tokens and now hold none still appear in many datasets.
- Heavy tails. A few very large balances dominate the weighted sum, so the number saturates near 1 and stops distinguishing between assets.
The next section shows how large the zero-balance effect can be.
Decisions that change the number
The formulas are short. Most of the real work is deciding which balances go in the list. Each decision below can move the result more than any change in actual ownership.
Zero balances and dust thresholds
Take eight addresses, four of them empty.
def gini(balances):
xs = sorted(balances)
n = len(xs)
total = sum(xs)
weighted = sum(i * x for i, x in enumerate(xs, start=1))
return 2 * weighted / (n * total) - (n + 1) / n
with_zeros = [0, 0, 0, 0, 10, 10, 10, 10]
without_zeros = [x for x in with_zeros if x > 0]
print(gini(with_zeros)) # 0.5
print(gini(without_zeros)) # 0.0The four holders have identical balances, yet including empty addresses reports moderate inequality. Always filter to balances above zero. Many analysts also set a minimum threshold, such as 0.001 of the asset or a small dollar value. The threshold is a choice, so state it whenever you publish a figure.
Excluding non-holder addresses
Some addresses hold supply without being investors in the usual sense. Examples are exchange wallets, staking contracts, bridge escrow, burn addresses, treasury or vesting contracts, and wrapped-token contracts. A single exchange hot wallet can hold the balances of hundreds of thousands of customers. Left in, it appears as one enormous holder and pushes top-N share and Gini up.
There are two reasonable treatments:
- Exclude labeled infrastructure addresses and compute concentration over the remaining supply.
- Keep them, but report them as separate categories, for example "held on exchanges" next to "held by other addresses".
Neither is correct in all cases. Excluding hides how much supply sits in custody, and keeping makes concentration look worse than the real ownership structure. Which to use depends on the question. Both rely on address labels, which are incomplete and sometimes wrong.
Addresses versus entities
Recall from the chapter on addresses and entities that one owner often controls many addresses. Splitting a balance across wallets lowers measured concentration. Merging addresses into entities by clustering raises it.
from collections import defaultdict
def top_n_share(balances, n):
total = sum(balances)
return sum(sorted(balances, reverse=True)[:n]) / total
def gini(balances):
xs = sorted(balances)
n = len(xs)
total = sum(xs)
weighted = sum(i * x for i, x in enumerate(xs, start=1))
return 2 * weighted / (n * total) - (n + 1) / n
address_balances = {"0xa": 400, "0xb": 300, "0xc": 200, "0xd": 100}
entity_of = {"0xa": "E1", "0xb": "E1"} # clustering says 0xa and 0xb share an owner
entity_balances = defaultdict(int)
for addr, bal in address_balances.items():
entity_balances[entity_of.get(addr, addr)] += bal
by_address = list(address_balances.values())
by_entity = list(entity_balances.values())
for label, data in [("address", by_address), ("entity", by_entity)]:
print(label,
"top1:", round(top_n_share(data, 1), 3),
"top2:", round(top_n_share(data, 2), 3),
"gini:", round(gini(data), 3))The output is:
address top1: 0.4 top2: 0.7 gini: 0.25
entity top1: 0.7 top2: 0.9 gini: 0.4Merging two addresses into one entity raised the top-1 share from 40% to 70%. The clustering heuristics are themselves imperfect: they can wrongly merge unrelated users, such as customers of a shared service, and they can miss real links. Treat entity-level numbers as estimates with uncertainty, and state which unit you measured.
Snapshot timing and the supply base
Balances change continuously, so you must pick a block height or timestamp and use it for every address. Also decide the denominator for top-N share. You can divide by total issued supply, by circulating supply, or by the sum of the filtered balances. These can differ a lot when large amounts are locked, burned, or unissued. In the code above, the denominator is the sum of whatever list you pass in, so the filtering step defines it.
A repeatable workflow
The diagram shows the order of operations. Cleaning comes before any formula.
A function that makes these choices explicit helps keep results comparable over time:
def concentration_report(balances, min_balance=0.0, exclude=None, top_ns=(1, 10)):
"""balances: dict of holder -> balance. exclude: set of holder keys to drop."""
exclude = exclude or set()
kept = [b for h, b in balances.items() if h not in exclude and b > min_balance]
if not kept:
raise ValueError("no balances left after filtering")
total = sum(kept)
ranked = sorted(kept, reverse=True)
report = {"holders": len(kept)}
for n in top_ns:
report[f"top{n}_share"] = sum(ranked[:n]) / total
xs = sorted(kept)
n = len(xs)
weighted = sum(i * x for i, x in enumerate(xs, start=1))
report["gini"] = 2 * weighted / (n * total) - (n + 1) / n
return report
snapshot = {"0xa": 500, "0xb": 250, "0xc": 120, "0xd": 0, "0xe": 0.0004, "0xex": 2000}
print(concentration_report(snapshot, min_balance=0.001, exclude={"0xex"}, top_ns=(1, 2)))Here the zero balance and the 0.0004 dust balance are dropped by min_balance, and the labeled exchange address 0xex is excluded. The remaining three holders have 870 in total, so the top-1 share is 500 / 870, about 0.575.
Comparing over time and across assets
Concentration numbers are most useful when compared against something. Keep these cautions in mind:
- Same method, same filters. A change in the dust threshold or the label set creates a fake trend. Version your label list and record it with each series.
- Holder count matters. Gini shifts as the number of addresses grows, even if the large holders do not change. When thousands of new small addresses appear, such as after an airdrop, Gini rises without anyone accumulating more.
- Distribution shape differs by ledger. On a UTXO chain, addresses are often used once, so address-level balances understate how much one owner holds. Entity clustering matters even more there.
- Supply schedule effects. Tokens in vesting contracts or a foundation treasury count as one large balance until released. Concentration can fall sharply on an unlock date with no change in demand.
Common mistakes
- Reading Gini as a verdict on decentralization. It measures balance inequality across the addresses you included. It does not measure control of the protocol, validator power, or developer influence.
- Comparing numbers from different pipelines. Two providers can report very different Gini values for the same asset because of different filters.
- Forgetting the finite-n ceiling. When n is small, the maximum Gini is below 1.
- Dividing by the wrong supply. Top-10 share of circulating supply and top-10 share of total supply answer different questions.
- Treating a clustering output as fact. Report entity-level figures as estimates.
Exercises
Exercise
A token snapshot lists 1,000 addresses with a positive balance and 9,000 addresses with a zero balance. You compute the Gini coefficient over all 10,000 addresses and get 0.95. A colleague computes 0.70 over the 1,000 positive-balance addresses only. Which figure better describes how supply is spread among holders, and why do the two differ?
Show answer
The 0.70 figure is the better description of holders, because zero-balance addresses hold nothing and are not holders. Including them adds many entries at zero, which increases the measured inequality (the Gini formula treats them as the poorest members of the population). The gap reflects how many empty addresses are in the dataset, not how supply is distributed. Whichever you choose, state the filter.
Exercise
The balances are [50, 30, 10, 5, 5]. Compute the top-2 share. Then compute the Gini coefficient using G = 2 sum(i x_i) / (n * total) - (n + 1) / n, with balances sorted ascending and i starting at 1.
Show answer
The total is 100. The top-2 share is (50 + 30) / 100 = 0.8. Sorted ascending: [5, 5, 10, 30, 50]. The weighted sum is 15 + 25 + 310 + 430 + 550 = 5 + 10 + 30 + 120 + 250 = 415. Then G = 2 415 / (5 * 100) - 6/5 = 1.66 - 1.2 = 0.46.
Exercise
Clustering merges your two largest address-level holders into one entity. State the direction of change for top-1 share and for the holder count, and name one risk of relying on the merged result.
Show answer
Top-1 share rises (or stays the same), because the merged entity's balance is at least as large as either address alone. The holder count falls by one. The risk is a false merge: if the two addresses actually belong to different owners, for example customers of a shared service, the merged figure overstates concentration. Missed links in the other direction would understate it.