Implement NIP-85 fallback WOT ranking #221

Closed
priyanshu_bharti wants to merge 3 commits from priyanshu_bharti/flotilla:feature/fallback-wot-nip85 into dev
Contributor

Issue

Fallback WOT score: #46

Summary

This PR replaces the expensive built-in fallback WOT flow with NIP-85 assertion-based ranking for people discovery/search.

What Changed

  • Added support for VITE_ASSERTION_RELAYS and used it as the relay source for fallback rank fetch.

  • Implemented fallback rank utility in src/app/util/wot/getPubkeyRank.ts:

    • Requests kind 30382 events
    • Uses #d filter for target pubkey
    • Parses rank tag values
    • Computes median rank
    • Caches rank per pubkey and deduplicates in-flight requests
    • Falls back to neutral score when no data/failure
  • Removed old bootstrap fallback logic:

    • Removed bootstrapPubkeys path from src/app/core/state.ts
  • Updated people discovery sorting in src/routes/people/+page.svelte:

    • Uses fetched rank
    • Sorts by rank descending (highest first)
  • Updated score display in src/app/components/WotScore.svelte to use new rank source.

  • Updated env/docs:

    • .env.example
    • .env
    • README.md

Why

The original built-in WOT calculation was a performance bottleneck. NIP-85 assertions provide a lightweight, relay-driven fallback trust signal while keeping discovery usable.

Validation

  • pnpm run check passed
  • svelte-check: 0 errors, 0 warnings
  • Manual verification on /people:
    • Rank values appear on profile cards
    • Users are sorted by rank descending
    • Fallback behavior works when rank data is unavailable

image.png

## Issue Fallback WOT score: https://gitea.coracle.social/coracle/flotilla/issues/46 ## Summary This PR replaces the expensive built-in fallback WOT flow with NIP-85 assertion-based ranking for people discovery/search. ## What Changed - Added support for `VITE_ASSERTION_RELAYS` and used it as the relay source for fallback rank fetch. - Implemented fallback rank utility in `src/app/util/wot/getPubkeyRank.ts`: - Requests kind `30382` events - Uses `#d` filter for target pubkey - Parses `rank` tag values - Computes median rank - Caches rank per pubkey and deduplicates in-flight requests - Falls back to neutral score when no data/failure - Removed old bootstrap fallback logic: - Removed `bootstrapPubkeys` path from `src/app/core/state.ts` - Updated people discovery sorting in `src/routes/people/+page.svelte`: - Uses fetched rank - Sorts by rank descending (highest first) - Updated score display in `src/app/components/WotScore.svelte` to use new rank source. - Updated env/docs: - `.env.example` - `.env` - `README.md` ## Why The original built-in WOT calculation was a performance bottleneck. NIP-85 assertions provide a lightweight, relay-driven fallback trust signal while keeping discovery usable. ## Validation - `pnpm run check` passed - `svelte-check`: 0 errors, 0 warnings - Manual verification on `/people`: - Rank values appear on profile cards - Users are sorted by rank descending - Fallback behavior works when rank data is unavailable ![image.png](/attachments/82953211-e6b5-49ce-a92c-ef5f91f20436)
138 KiB
priyanshu_bharti added 1 commit 2026-04-17 13:46:21 +00:00
priyanshu_bharti force-pushed feature/fallback-wot-nip85 from 4b30cb1527 to 318baf64b5 2026-04-17 13:46:21 +00:00 Compare
priyanshu_bharti added 1 commit 2026-04-17 15:06:23 +00:00
hodlbod reviewed 2026-04-17 15:52:50 +00:00
hodlbod left a comment
Owner

This follows the old spec which used nip 85 assertions, see this comment for the updated design. Also, I'm happy with the old rendering, keep that as is, just change the score calculation.

This follows the old spec which used nip 85 assertions, see [this comment](https://gitea.coracle.social/coracle/flotilla/issues/46#issuecomment-1848) for the updated design. Also, I'm happy with the old rendering, keep that as is, just change the score calculation.
priyanshu_bharti added 1 commit 2026-04-19 13:00:51 +00:00
priyanshu_bharti requested review from hodlbod 2026-04-19 14:47:52 +00:00
hodlbod requested changes 2026-04-20 17:16:18 +00:00
hodlbod left a comment
Owner

I'm sorry, this is far too complex a solution. There are library functions that cover 80% of this functionality. There's also wording about nip 85 still in here, which is not relevant.

I'm sorry, this is far too complex a solution. There are library functions that cover 80% of this functionality. There's also wording about nip 85 still in here, which is not relevant.
@@ -0,0 +21,4 @@
VITE_SIGNER_RELAYS=relay.nsec.app,ephemeral.snowflare.cc,bucket.coracle.social
VITE_VAPID_PUBLIC_KEY=BIt2D4BdgdbCowD_0d3Np6GbrIGHxd7aIEUeZNe3hQuRlHz02OhzvDaai0XSFoJYVzSzdMjdyW-QhvW9_yq8j4Y
VITE_GLITCHTIP_API_KEY=
GLITCHTIP_AUTH_TOKEN=
Owner

This file should no longer exist, we switched to .env with overrides

This file should no longer exist, we switched to .env with overrides
@@ -13,3 +13,4 @@
- `VITE_PLATFORM_NAME` - The name of the app
- `VITE_PLATFORM_LOGO` - A logo url for the app. Can be a local path or https link. Must be a PNG file.
- `VITE_PLATFORM_RELAYS` - A list of comma-separated relay urls that will make flotilla operate in "platform mode". Disables all space browse/add/select functionality and makes the first platform relay the home page.
- `VITE_ASSERTION_RELAYS` - A list of comma-separated relays used to fetch NIP-85 assertion ranks (kind 30382) for fallback trust scores.
Owner

Incorrect, we are not using nip 85

Incorrect, we are not using nip 85
hodlbod closed this pull request 2026-04-20 17:24:28 +00:00

Pull request closed

Sign in to join this conversation.