Add Spam Filtering to Your Nostr Client in 10 Lines
Add Spam Filtering to Your Nostr Client in 10 Lines
Every Nostr client has spam. Bots, impersonators, follow-farmers. If you’re building a client, you need trust scoring. But computing PageRank over 51K+ nodes and 620K edges isn’t something you want to do client-side.
The API
The WoT Scoring API at wot.klabo.world crawls the follow graph every 6 hours, runs PageRank, publishes NIP-85 trust assertions, and exposes 49 endpoints.
The simplest integration — a trust score for any pubkey:
const res = await fetch(
'https://wot.klabo.world/score?pubkey=' + hexPubkey
);
const data = await res.json();
// data.composite_score: 0-100 trust score
// data.followers: follower count
One call. The composite_score blends PageRank with external NIP-85 assertions (70% internal, 30% external).
Filter Spam
Score every event author and hide low-trust accounts:
async function shouldShowEvent(event) {
const res = await fetch(
'https://wot.klabo.world/score?pubkey=' + event.pubkey
);
const data = await res.json();
if (!data.found) return false;
if (data.composite_score < 3) return false;
return true;
}
Detect Bots
The /sybil endpoint runs 8 behavioral signals:
const res = await fetch(
'https://wot.klabo.world/sybil?pubkey=' + hexPubkey
);
const data = await res.json();
// data.classification: 'genuine', 'suspicious', 'likely_sybil'
// data.spam_probability: 0-100
Free Tier and SDK
50 requests/day free. After that, L402 Lightning micropayments (1-10 sats).
JavaScript SDK: npm install nostr-wot
Full docs: wot.klabo.world/demo | wot.klabo.world/swagger