Skip to content

Tag: a

Overview

The "a" tag is used to refer to an addressable or replaceable event in the Nostr protocol. It allows events to reference parametrized replaceable events (addressable events) or regular replaceable events, enabling references to specific versions of evolving content.

Specification

PropertyValue
Tag Namea
Defined inNIP-01
Required forGeneral use across event kinds

Format

For an addressable event:

["a", "<kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>", "<recommended relay URL, optional>"]

For a normal replaceable event:

["a", "<kind integer>:<32-bytes lowercase hex of a pubkey>:", "<recommended relay URL, optional>"]

Note: In the case of a normal replaceable event, the format includes the trailing colon.

Usage Description

The "a" tag is used to reference an addressable or replaceable event. It combines three pieces of information into a single string value:

  1. The event kind (an integer)
  2. The public key of the event author (32-bytes hex string)
  3. For addressable events only: the d tag value that makes it uniquely addressable

These three components are separated by colons (:) in the tag value. For normal replaceable events, the third parameter (after the second colon) is left empty, but the trailing colon is still included.

As a convention, all single-letter key tags (including "a") are expected to be indexed by relays, enabling queries and subscriptions that filter for events referencing specific addressable events.

Examples

Example for an Addressable Event

json
["a", "30023:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:abcd", "wss://nostr.example.com"]

This references an addressable event with:

  • Kind: 30023 (long-form content)
  • Pubkey: f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca
  • d-tag: "abcd"
  • Recommended relay: wss://nostr.example.com

Example for a Normal Replaceable Event

json
["a", "10002:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:", "wss://nostr.example.com"]

This references a replaceable event with:

  • Kind: 10002 (relay list metadata)
  • Pubkey: f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca
  • Recommended relay: wss://nostr.example.com

Client Behavior

Clients should:

  1. Interpret "a" tags as references to addressable or replaceable events
  2. When displaying events with "a" tags, potentially link to or embed the referenced events
  3. Use the included relay URL (if present) as a hint for where to fetch the referenced event if it's not already available
  4. Be aware of the difference between addressable and replaceable event references

Relay Behavior

Relays should:

  1. Index events by the first value in their "a" tags
  2. Support filtering queries based on "a" tags using the #a filter parameter in subscription requests
  3. For a filter like {"#a": ["30023:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:abcd"]}, return all events that reference the specified addressable event

References

Notes

The "a" tag is one of the three standard tags defined in NIP-01, alongside the "e" and "p" tags. Together, these three tags form the foundation of referencing in the Nostr protocol.

The "a" tag is particularly important for referencing content that evolves over time, such as long-form articles (kind 30023), or other replaceable events where you want to refer to the most current version rather than a specific historical version.