nostr

A minimal Go library for the Nostr protocol.

go get code.northwest.io/nostr

Why

1 dependency. Other Nostr libraries pull in 30+. This one has exactly one:

btcec/v2 — Schnorr signatures (required by protocol)

No WebSocket libraries, no logging frameworks, no kitchen sink. Just the core protocol, stdlib only.

What's Included

Example

key, _ := nostr.GenerateKey()
fmt.Println("npub:", key.Npub())

event := &nostr.Event{
    Kind:    nostr.KindTextNote,
    Content: "Hello Nostr!",
}
key.Sign(event)

relay, _ := nostr.Connect(ctx, "wss://relay.damus.io")
relay.Publish(ctx, event)

What's Not Included

This is a minimal core library. It implements NIP-01 and the basics. It doesn't implement every NIP, handle connection pooling, or manage relay discovery. Build that yourself, or don't.