vitorpamplona / amethyst

Nostr client for Android
MIT License
1.08k stars 148 forks source link

[FEATURE] Web of Trust spam filtering for replies #509

Open DireMunchkin opened 1 year ago

DireMunchkin commented 1 year ago

Is your feature request related to a problem? Please describe. Reply spam is becoming an increasing issue on nostr. One solution is paid relays, but that excludes anyone who's not yet using Bitcoin to pay for the relay, which as a spam filtering method has a huge false positive ratio. I myself follow several real people who are only using free relays - so I don't want to remove all free relays. But I also don't want every discussion to be full of airdrop spam!

Describe the solution you'd like I want a web of trust filter for replies to a note, so that anybody who's too far from your social graph is not displayed in the thread.

It could be implemented something like this:

  1. At startup one time:
  2. Fetch profile events of all users you're following.
  3. Grab their following list from the profile type.
  4. Put all these npub into a single Set.
  5. When viewing replies, for each reply: Hide it if it's npub is not present in the network set.

This effectively means that anybody who's more than two degrees of separation away from you in your social graph is not shown.

If posts are hidden in a discussion you could have a button saying "Show all filtered replies" or something like that so you can efficiently compare the thread with it on or off.

Bounty (in Bitcoin sats) offered for the implementation None at current, but I could implement it myself if it's likely to be merged.

vitorpamplona commented 1 year ago

If you want to do this, you can add a following marker in the signature string here https://github.com/vitorpamplona/amethyst/blob/4e4e7981331595599b61d62eae2fe273763c2613/app/src/main/java/com/vitorpamplona/amethyst/model/Note.kt#L117 such that when the UI sorts all replies, it sorts by level, following status, date, instead of just level and date.

DireMunchkin commented 1 year ago

Thanks, I'll start reading the code and see if I can implement something

If I understand what that function is doing it mostly controls sorting order, so I could sort replies to the bottom of the replies feed. Is that correct? I was thinking more of a hard filter though, as in don't even show them.

After I requested this I also realized Iris already implements this feature. But they also use a social distance of 4 by default. Anecdotally I never see any spam in Iris, and it also seems to let through all of the real people. Iris also feels a bit sluggish to use though, which may be related to the large network set, not sure.

DireMunchkin commented 6 months ago

@vitorpamplona I haven't been able to find the time to work on this one...

However I've used Coracle a bit, which has a Web of Trust implementation that works like this:

  1. For each user you see, calculate their WoT score as number of your follows that follow them.
  2. Hide comments, interactions and so on from users below filter threshold.
  3. Filter threshold is configurable, and set to 1 by default.

I can offer a bounty of 140k sats if you implement a similar Web of Trust score filter in Amethyst.

DireMunchkin commented 6 months ago

See also https://coracle.social/help/web-of-trust