Skip to content

Kind 31234: Draft Event

Overview

Draft Event (kind 31234) is a private wrapper that allows users to save unpublished drafts of any Nostr event type. These events encrypt the draft content to the author's public key, ensuring that only the author can read them, while still enabling synchronization across devices and backup of work-in-progress content.

Specification

PropertyValue
Kind Number31234
Event RangeParameterized Replaceable
Defined inNIP-37

Content Format

The content field contains the entire draft event (JSON-stringified and NIP-44 encrypted to the signer's public key). An empty content field indicates that the draft has been deleted by the client.

Schema

json
"content": "<NIP-44-encrypted JSON string of the draft event>"

Tags

Tag NameDescriptionFormatRequired
dUnique identifier for the draft["d", "<identifier>"]Yes
kKind of the draft event["k", "<kind-number>"]Yes
eAnchor event (for replies)["e", "<event-id>", "<relay-url>"]No
aAnchor event address["a", "<kind>:<pubkey>:<d-tag>", "<relay-url>"]No

Client Behavior

Clients should:

  1. Create Draft Events when users want to save unpublished work
  2. Encrypt the entire draft event using NIP-44 encryption, with the user's own public key as the recipient
  3. Use a unique identifier in the d tag to distinguish between different drafts
  4. Include the k tag to identify what kind of event is being drafted
  5. When listing drafts, display them organized by the kind of content being drafted
  6. When a user wants to edit a draft, decrypt the content and present it in the appropriate editor
  7. When a user wants to publish a draft, decrypt it, create a proper event of the target kind, and publish it
  8. When a user wants to delete a draft, either:
    • Replace the Draft Event with a blank content version
    • Delete it completely using a deletion event (kind 5)
  9. Publish Draft Events to the user's preferred private relays as defined in kind 10013

Relay Behavior

Relays should:

  1. Store Draft Events as they would any other event
  2. For privacy-conscious relays, consider requiring authentication (NIP-42) and only serve a user's own Draft Events back to them
  3. For public relays, be aware that encrypted Draft Events may still reveal metadata about a user's drafting activities

Use Cases

  • Saving work-in-progress posts before publishing
  • Storing drafts of articles, notes, or other content
  • Synchronizing draft content between multiple devices
  • Creating templates or pre-written responses for later use
  • Backing up important content before finalizing
  • Developing complex content over multiple editing sessions

Example

json
{
  "id": "bcddf378532a6e35358337af6286b0d0bac6ac8d563979c1d12dae26ba4bc584",
  "pubkey": "79dff8f82963424e0bb02708a22e44b4980893e3a4be0fa3cb60a43b946764e3",
  "created_at": 1671217411,
  "kind": 31234,
  "tags": [
    ["d", "my-first-article-draft"],
    ["k", "30023"]
  ],
  "content": "AQBhhwmqvMyvLPe1YYbYJmvXZzZ9JXS9yTagjMBG+N8F/56bZnpB/7qN0lfv4zqzCu1NE7TzJXjA1xaPq6MiQj9cBcGhN5dz6...",
  "sig": "908a15e46fb4d8675bab026fc230a0e3542bfade63da02d542fb78b2a8513fcd0092619a2c8c1221e581946e0191f2af505dfdf8657a414dbca329186f009262"
}

Private Relay List

Draft Events are intended to be published to private relays that protect the user's content. These private relays are specified in a kind 10013 event:

json
{
  "kind": 10013,
  "tags": [],
  "content": "<NIP-44-encrypted JSON string of relay tags>",
  "pubkey": "79dff8f82963424e0bb02708a22e44b4980893e3a4be0fa3cb60a43b946764e3",
  "created_at": 1671217500,
  "id": "...",
  "sig": "..."
}

The encrypted content would decrypt to a list of relay tags:

json
[
  ["relay", "wss://private-relay.example.com"],
  ["relay", "wss://my-personal-relay.mydomain.com"]
]

References

Notes

  • Draft Events can contain drafts of any kind of event, not just text notes or articles
  • The content is encrypted to the author's public key, so only they can read it
  • An empty content field indicates the draft has been deleted
  • Relay choice is important for privacy - users should use trusted relays
  • Draft Events can be used as a flexible system for any type of private content backup