Skip to content

Tag: zap

Overview

The zap tag is used to specify receivers of Lightning Network payments (zaps) on events. It enables content creators to receive payments from users via Lightning, with customizable splitting of payment amounts across multiple receivers.

Specification

PropertyValue
Tag Namezap
Defined inNIP-57
Required forGeneral use, particularly on content that can be "zapped" (tipped) with Lightning payments

Format

["zap", "<pubkey>", "<relay_url>", "<optional_weight>"]

Usage Description

The zap tag is used to define the recipients of Lightning Network payments (zaps) on an event. When an event includes one or more zap tags, clients should use this information instead of the event author's profile for determining zap recipients.

Each zap tag includes:

  1. The tag name zap
  2. The hex-encoded public key of the payment receiver
  3. A relay URL where the receiver's metadata (Kind 0 event) can be found
  4. An optional weight parameter that specifies the proportion of the payment amount this receiver should get

When multiple zap tags are present, clients should allocate the payment proportionally based on the provided weights. If weights are not present, clients should equally divide the payment among all recipients. If weights are only partially present, receivers without a weight should not receive any payment (weight = 0).

Examples

Basic Example with Single Receiver

json
["zap", "82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2", "wss://nostr.example.com"]

Example with Multiple Recipients and Weights

json
[
  ["zap", "82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2", "wss://nostr.oxtr.dev", "1"],
  ["zap", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", "wss://nostr.wine/", "1"],
  ["zap", "460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c", "wss://nos.lol/", "2"]
]

In this example, the first recipient gets 25%, the second gets 25%, and the third gets 50% of the total payment amount.

Client Behavior

When a client encounters an event with one or more zap tags, it should:

  1. Parse all zap tags present in the event
  2. Calculate the sum of all weights (if provided)
  3. Determine the percentage of the total payment each recipient should receive:
    • If all weights are provided, distribute proportionally to weights
    • If no weights are provided, distribute equally among all recipients
    • If only some weights are provided, only distribute to recipients with weights
  4. When a user decides to zap the event, generate zap requests for each recipient based on their proportion
  5. Optionally display the zap split configuration to the user

Clients should fetch the recipient's Lightning payment information (LNURL) from their Kind 0 metadata at the specified relay.

Relay Behavior

Relays do not have specific obligations regarding the zap tag, as the payment process occurs via Lightning Network infrastructure. Relays should pass events containing zap tags without modification.

References

  • bolt11 - Contains the Lightning invoice in zap receipts
  • amount - Specifies the payment amount in millisatoshis
  • lnurl - Contains the LNURL pay URL of the recipient

Notes

The zap tag system allows for flexible revenue sharing models for collaborative content. By specifying multiple recipients with different weights, event creators can ensure that contributors receive appropriate compensation when users appreciate their content.

The implementation of zap functionality requires integration with Lightning Network infrastructure, including LNURL servers that support the Nostr zap protocol as specified in NIP-57.