nostr types and storage
Find a file
2026-04-27 09:48:34 +12:00
pocket-db Keep error variants at 48 bytes max 2026-02-21 12:07:48 +13:00
pocket-types More validation when creating tags; should fix panic 2026-04-27 09:48:34 +12:00
.gitignore Initial setup for pocket crates 2024-04-13 11:19:45 +12:00
Cargo.toml Initial setup for pocket crates 2024-04-13 11:19:45 +12:00
LICENSE-MIT More clearly indicate MIT license, add copyright to main code file, include license text file 2024-05-03 12:29:53 +12:00
README.md Update README.md 2025-01-30 12:24:16 +13:00

Pocket

Pocket is a super efficient nostr types library and event storage engine for relays only.

All datatypes are realized as a simple sequence of bytes. That is, there is no reason to serialize/deserialize them because they already are serialized. That means we can achieve zero copy and zero allocation (the caller must supply a pre-allocated area).

Datatypes are unsized based on a borrowed byte slice. References to an object are of course sized. Objects know their real size internally.

Because this library was developed for a relay which does not need to create data, most data types don't have any mutability. Therefore this library is a poor choice as a general-purpose nostr types library and would be unsuitable for use in nostr clients.

In some cases we have crated Owned data types for convenience, but these allocate.

JSON data is parsed via custom hand-coded nostr-specific parsing logic which is far faster than any general-purpose JSON library could possibly be.

Pocket DB stores events in a memory map. It then indexes these events by the offset of the event in that memory map. These indexes are stored using LMDB.