Skip to main content

On-Behalf Zap Request (Kind 5522)

As an extension to the open protocol ecosystem, Kind 5522 (On-Behalf Zap Request) is a specialized variant of the standard NIP-57 ↗ Zap Request (Kind 5520). It was introduced by the Zapf protocol team to securely support "proxy" or "custodial" zaps made on behalf of external, off-chain users.

Standard NIP-57 ↗ assumes that the pubkey signing the Zap Request is the literal economic sender of the funds. When a custodial bot—such as the Tipf Discord server—generates a Zap Request, standard Nostr clients can incorrectly attribute the funds or social signal to the bot itself rather than the true user.

Kind 5522 solves this semantic ambiguity by enforcing that aware clients must ignore the event pubkey and strictly inspect the p (Recipient) and P (Sender) tags to ascertain the correct connection identities.

Structure

The event generally maps 1:1 with the standard Kind 5520 structure, except for its specific kind identifier (5522) and its rigid expectation that the attribution tags will utilize 3 elements instead of 2.

{
"kind": 5522,
"content": "Sent via Tipf Discord Bot",
"tags": [
["p", "<recipient_connection_key>", "discord"],
["P", "<sender_connection_key>", "discord"],
["amount", "100000"],
["relays", "wss://relay.zapf.app", "wss://relay.damus.io"],
["lnurl", "lnurl..."]
],
"pubkey": "<tipf_server_identity>",
"created_at": 1709424000
}

Tag Explanations

  • p (Recipient): Instead of a raw Nostr pubkey, this tag expects [ "p", "<connection_key_hash>", "<lidp_name>" ].
  • P (Sender): Instead of a raw Nostr pubkey, this tag expects [ "P", "<connection_key_hash>", "<lidp_name>" ].
  • amount: Must be requested strictly in Mloki (millisatoshis/milliloki) to secure the proxy callback flow.

Verification & Parsing

  1. Backend Integration: Zapf seamlessly respects 5522 alongside 5520 via its LNURL-Pay webhook callback, ensuring identical amount verification and wrapping the 5522 string seamlessly inside the resulting 5521 (Zap Receipt) description tag.
  2. Frontend UI Resolution: The Zapf frontend parses the description tag. Upon detecting a 5522 event, it invokes a network query for Kind 35521 using the #d filter (discord:<connection_key>). This permits the UI to translate the external connection key back into a native Nostr Kind 0 profile metadata object dynamically.