Skip to content

fix(jobs): on-chain holder count should match Birdeye (token accounts, not distinct owners) - #1000

Merged
rickyrombo merged 1 commit into
mainfrom
mjp-onchain-holder-count
Aug 3, 2026
Merged

fix(jobs): on-chain holder count should match Birdeye (token accounts, not distinct owners)#1000
rickyrombo merged 1 commit into
mainfrom
mjp-onchain-holder-count

Conversation

@rickyrombo

Copy link
Copy Markdown
Contributor

What

CoinStatsOnchainJob computed the on-chain holder metric as COUNT(DISTINCT owner). That undercounts real holders: the Audius claimable-tokens program authority owns one token account per user (the user-bank mechanism), so many distinct users collapse into a single program owner.

Switch to COUNT(*) (token accounts with balance > 0) to match Birdeye's metric and reflect real distinct-user holdings.

How it was found

Validated against a public Solana RPC (getProgramAccounts on the token program), cross-referenced with the DB:

  • MZ: 24 token accounts, 16 non-zero across only 5 distinct owners — one wallet holds 11.
  • MONIST: 175 token accounts, 145 non-zero (= Birdeye's holder count exactly) across only 7 distinct owners — one program authority holds 139 of them.

So COUNT(DISTINCT owner) returned 5 / 7 where the real (and Birdeye) count is 16 / 145. The DB had full coverage in both cases; the bug was purely the aggregation.

Test

Updated coin_stats_onchain_test.go: two token accounts now share one owner, and the assertion expects the token-account count (4), not the distinct-owner count (3). go test ./jobs/ passes; build clean.

🤖 Generated with Claude Code

…lder metric

CoinStatsOnchainJob computed holder = COUNT(DISTINCT owner), which
undercounts: the claimable-tokens program authority owns one token
account per user (the user-bank mechanism), so many real holders collapse
into a single program owner. Verified on-chain — e.g. MONIST has 145
non-zero token accounts across only 7 distinct owners, because one program
authority holds 139 of them. Count token accounts (COUNT(*)) to match
Birdeye's holder metric and reflect real distinct-user holdings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rickyrombo
rickyrombo merged commit 845b056 into main Aug 3, 2026
2 checks passed
@rickyrombo
rickyrombo deleted the mjp-onchain-holder-count branch August 3, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant