12<html lang="en">3<head>4<meta charset="utf-8">5<meta name="viewport" content="width=device-width, initial-scale=1">6<title>NIP-16 - Event Treatment — Nostr Instruction Manual</title>7<meta name="description" content="NIP-16: regular, replaceable, and ephemeral event kinds. Merged into NIP-01 in 2023. This page explains what it defined and where the rules live now.">8<link rel="preload" href="../assets/fonts/michroma-400-latin.woff2" as="font" type="font/woff2" crossorigin>9<link rel="preload" href="../assets/fonts/exo2-var-latin.woff2" as="font" type="font/woff2" crossorigin>10<link rel="preload" href="../assets/fonts/sairacondensed-600-latin.woff2" as="font" type="font/woff2" crossorigin>11<link rel="preload" href="../assets/fonts/sairacondensed-700-latin.woff2" as="font" type="font/woff2" crossorigin>12<link rel="preload" href="../assets/fonts/sairacondensed-500-latin.woff2" as="font" type="font/woff2" crossorigin>13<link rel="preload" href="../assets/fonts/sharetechmono-400-latin.woff2" as="font" type="font/woff2" crossorigin>14<link rel="preload" href="../assets/fonts/exo2-400i-latin.woff2" as="font" type="font/woff2" crossorigin>15<link rel="icon" href="../assets/favicon.svg" type="image/svg+xml">16<link rel="stylesheet" href="../assets/manual.css">17</head>18<body>1920<svg width="0" height="0" style="position:absolute">21 <defs>22 <marker id="arr" markerWidth="9" markerHeight="9" refX="7" refY="4.5" orient="auto">23 <path d="M1,1 L8,4.5 L1,8 Z" fill="#f26a00"/>24 </marker>25 <marker id="arrb" markerWidth="9" markerHeight="9" refX="7" refY="4.5" orient="auto">26 <path d="M1,1 L8,4.5 L1,8 Z" fill="#2e5f9e"/>27 </marker>28 </defs>29</svg>3031<div class="page">32 <span class="staple s1"></span><span class="staple s2"></span>3334 <header class="band">35 <a class="logo" href="../index.html">NOSTR<b>▸</b>PROTOCOL MANUAL</a>36 <span class="booklet-note">Chapter 16 - Core</span>37 </header>38 <nav class="tabs">39 <a href="../index.html">Contents</a>40 <a href="#overview" class="on">Overview</a>41 <a href="#spec">Spec</a>42 <a href="#examples">Examples</a>43 <a href="#history">History</a>44 </nav>4546 <div class="chapter">47 <div class="nipno" data-n="16">16</div>48 <div class="titles">49 <div class="kicker">Nostr Implementation Possibility - Hex № 16</div>50 <h1>Event Treatment</h1>51 <p class="sub">This chapter is closed. NIP-16 once defined regular, replaceable, and ephemeral events. That rule is now part of the core protocol in <a href="01.html">NIP-01</a>.</p>52 </div>53 <div class="stamp merged">Merged</div>54 </div>5556 <main class="spread">57 <div class="main">5859 <h2 class="bar" id="overview"><span class="num">1</span> Overview</h2>60 <p>NIP-16 answered one question: what should a relay do when it receives an event? The original <a href="01.html">NIP-01</a> only said a relay stores events. NIP-16 split events into storage classes, based on the <code>kind</code> number, and gave each class its own storage rule.</p>61 <p>Three classes existed at first: <strong>regular</strong> events, which a relay keeps in full; <strong>replaceable</strong> events, where only the newest event per author and kind survives; and <strong>ephemeral</strong> events, which a relay forwards but does not store at all.</p>6263 <div class="box hint">64 <span class="tag">Merged</span>65 <p>NIP-16 is closed and carries no separate rules of its own anymore. Its storage classes now live in <a href="01.html#kinds">NIP-01, section 4 (Kinds and Storage Classes)</a>. Read this page for history, then read NIP-01 for the current spec.</p>66 </div>6768 <h2 class="bar" id="spec"><span class="num">2</span> What NIP-16 Defined</h2>69 <p>NIP-16 stated these rules, restated here in Simplified Technical English:</p>70 <div class="tscroll"><table class="ref">71 <caption>NIP-16 event classes, as originally defined</caption>72 <tr><th>Class</th><th>Kind range</th><th>Rule</th></tr>73 <tr><td class="btn">Regular</td><td>1000 - 9999</td><td>The relay stores every regular event and forwards it to matching subscriptions. Newer events never affect older ones.</td></tr>74 <tr><td class="btn">Replaceable</td><td>10000 - 19999</td><td>For each author and kind pair, the relay keeps only the newest event. It discards older ones.</td></tr>75 <tr><td class="btn">Ephemeral</td><td>20000 - 29999</td><td>The relay forwards the event to matching subscriptions but must not store it.</td></tr>76 </table></div>77 <p>A later addition specified the tie-break rule for replaceable events: when two events share the same <code>created_at</code> timestamp, the relay keeps the one whose <code>id</code> sorts first, and discards the other. NIP-16 also recommended that clients use the relay's <code>supported_nips</code> field to check for support, and warned that ephemeral events sent to a relay without NIP-16 support would likely be stored by mistake.</p>7879 <h3>Where It Lives Now</h3>80 <p>NIP-01 kept the three classes and their names, and added a fourth: <strong>addressable</strong> events, absorbed separately from <a href="33.html">NIP-33</a>. NIP-01 also widened the replaceable range: it now treats kind 0 and kind 3 as replaceable too, alongside the 10000-19999 range. The same-timestamp tie-break rule that NIP-16 introduced carried over unchanged.</p>8182 <h2 class="bar" id="examples"><span class="num">3</span> Historical Example</h2>83 <p>NIP-16 suggested these use cases for its new event classes. They still apply under NIP-01 today.</p>84 <div class="crt">85 <div class="titlebar">Suggested use cases - from the original NIP-16 text</div>86<pre><span class="c">-- Replaceable: a profile status that overwrites itself --</span>87<span class="c">-- Ephemeral: a typing indicator in a chat app --</span>88<span class="c">-- Ephemeral: two pubkeys messaging live without relay storage --</span></pre>89 </div>9091 <h2 class="bar" id="history"><span class="num">4</span> Version History</h2>92 <ul class="patchnotes">93 <li><span class="ver">Closed</span><span class="when">2023-08-13</span>Merged into <a href="01.html">NIP-01</a> along with <a href="12.html">NIP-12</a>, <a href="20.html">NIP-20</a>, and <a href="33.html">NIP-33</a> (PR <a href="https://github.com/nostr-protocol/nips/pull/703">#703</a>). All four were already "final, mandatory" — folding them into the root spec meant a client or relay only had to read one document to reach baseline compliance.</li>94 <li class="minor"><span class="ver">2023</span><span class="when">2023-11-15</span>Repo-wide cleanup removed the per-file author badge from the now-stub page.</li>95 <li><span class="ver">2023</span><span class="when">2023-05-19</span>Doug Hoyte specified the same-timestamp tie-break rule: keep the event with the lowest <code>id</code>.</li>96 <li><span class="ver">2023</span><span class="when">2023-03-26</span>Leo Wandersleb clarified the wording: events are not truly replaced in place, older ones are simply discarded from what queries return.</li>97 <li><span class="ver">2022</span><span class="when">2022-12-08</span>Jonathan Staab clarified how kind 1 and the 1000-10000 range relate to the regular-event class.</li>98 <li><span class="ver">2022</span><span class="when">2022-11-10</span>alex clarified which pubkey's signature counts when a replaceable event is replaced.</li>99 <li><span class="ver">2022</span><span class="when">2022-05-27</span>Semisol switched the design from per-tag markers to numeric kind ranges.</li>100 <li><span class="ver">Origin</span><span class="when">2022-05-26</span>Semisol published NIP-16 as a draft.</li>101 </ul>102103 <div class="credits">104 <h3 class="cardhead">Original Proposal - Credits</h3>105 <table>106 <tr><td>Author</td><td>Semisol</td></tr>107 <tr><td>First commit</td><td>2022-05-26 — “nip16: create draft”</td></tr>108 <tr><td>Status</td><td><span class="chip final">final</span> <span class="chip mandatory">mandatory</span> — merged, no longer a standalone document</td></tr>109 <tr><td>Source</td><td><a href="https://github.com/nostr-protocol/nips/blob/master/16.md">16.md on GitHub</a> - <a href="https://github.com/nostr-protocol/nips/commits/master/16.md">full change history</a></td></tr>110 </table>111 </div>112113 <h2 class="bar"><span class="num">5</span> See Also</h2>114 <ul>115 <li><a href="01.html">NIP-01</a> — the current, canonical home of kind ranges and storage classes.</li>116 <li><a href="12.html">NIP-12</a> — generic tag queries, merged the same day as NIP-16.</li>117 <li><a href="20.html">NIP-20</a> — command results, merged the same day as NIP-16.</li>118 <li><a href="33.html">NIP-33</a> — addressable events, the fourth storage class, added after NIP-16's original three.</li>119 </ul>120 </div>121122 <aside>123 <div class="cartridge">124 <div class="inner">125 <h3 class="cardhead">Spec Card</h3>126 <div class="lights"><span class="led on"></span><span class="led on"></span><span class="led on"></span></div>127 <dl>128 <dt>Status</dt><dd><span class="chip final">final</span><span class="chip mandatory">mandatory</span></dd>129 <dt>Defined</dt><dd>regular - replaceable - ephemeral kinds</dd>130 <dt>Now lives in</dt><dd><a href="01.html#kinds">NIP-01 §4</a></dd>131 <dt>Requires</dt><dd><a href="01.html">NIP-01</a></dd>132 <dt>First commit</dt><dd>2022-05-26</dd>133 <dt>Merged</dt><dd>2023-08-13 (PR #703)</dd>134 <dt>Last updated</dt><dd>2023-11-15</dd>135 </dl>136 </div>137 </div>138 </aside>139 </main>140141 <nav class="navbtns">142 <a href="15.html">◀ NIP-15: Nostr Marketplace</a>143 <a href="17.html">NIP-17: Private Direct Messages ▶</a>144 </nav>145146 <footer class="pagefoot">147 <a href="../index.html">Nostr Protocol Manual</a>148 <span class="pageno">NIP 16 / F4</span>149 </footer>150</div>151152<script src="../assets/webmcp.js" defer></script>153</body>154</html>