---
title: "Nosflare Anti-Spam and Content Filtering"
description: "Nosflare's spam defenses: NIP-05 validation, per-pubkey and global content hashing, rate limiting, blocked words and phrases, and pubkey/kind/tag allowlists."
canonical: "https://nosflare.com/docs/anti-spam.md"
---

# Anti-Spam and Content Filtering

Nosflare ships several independent spam defenses. All are optional and configured in `src/config.ts`.

## NIP-05 validation

Disabled by default. Set `checkValidNip05` to `true` to require a valid [NIP-05](https://github.com/nostr-protocol/nips/blob/master/05.md) Nostr address before an event is accepted. Validation is handled inside the `processEvent` function in `src/relay-worker.ts`, under the "NIP-05 validation" block.

Domain-level control is available through `allowedNip05Domains` and `blockedNip05Domains`, so a relay can accept only members of specific communities, or exclude domains known for abuse.

## Content hashing (duplicate detection)

Disabled by default. Set `enableAntiSpam` to `true` to hash each submitted event and reject duplicates.

- **Per-pubkey (default).** The hash combines the author's pubkey with the event content. A given pubkey can publish a given note exactly once; repeated identical notes from the same author are rejected.
- **Global.** Set `enableGlobalDuplicateCheck` to `true` to hash content alone. Once anyone publishes a piece of content, no one else can publish the identical content. This is aimed at spam waves that use disposable pubkeys but identical note bodies - the "ReplyGuy"-style attack.

`antiSpamKinds` controls which event kinds are subject to duplicate checking. A range of kinds is included by default and any can be removed to skip them.

## Rate limiting

Nosflare throttles the number of events accepted from a single pubkey. `excludedRateLimitKinds` exempts specific event kinds from the limit - useful for kinds that are legitimately high-volume.

At the platform level, Cloudflare rate limiting rules are also recommended in front of the Worker.

## Blocked words and phrases

`blockedContent` holds specific words or phrases; events containing them are rejected.

## Allowlists and blocklists

Filtering by pubkey, event kind, and tag:

- `allowedPubkeys` / `blockedPubkeys`
- `allowedEventKinds` / `blockedEventKinds`
- `allowedTags` / `blockedTags`

The rule is symmetrical: **if entries are in a blocklist, only those entries are blocked and everything else is allowed; if entries are in an allowlist, only those entries are allowed and everything else is blocked.**

Reference lists: [event kinds](https://github.com/nostr-protocol/nips#event-kinds) and [standardized tags](https://github.com/nostr-protocol/nips?tab=readme-ov-file#standardized-tags).

## Payment as a spam filter

Enabling [pay-to-relay](https://nosflare.com/docs/pay-to-relay.md) puts a cost on write access, which is on its own a strong deterrent against disposable-pubkey spam.
