π

Getting Started in nostr

Show Sidebar

Nostr is a simple protocol for microblogging and more. This is the best summary of it I have seen so far: https://sebastix.nl/blog/why-nostr-resonates/

The Protocol

A few months ago, a fellow student from university shared a project of developing an own nostr client. I had never heard of nostr but quickly realized it filled a valuable gap. Not bound to one host like E-Mail and ActivityPub but also not limited like full peer to peer applications, the relay model creates maximum flexibility and enables efficiency. One of the beautiful elements I saw right away was that nostr relays can be "dumb", i.e. they need not know many semantics. This means that development of relays and clients happens independently unlike in the ActivityPub-Fediverse where clients usually depend on the API of the server implementation, creating an indirection between users as ActivityPub is only used between servers. On the other hand nostr clients essentially communicate directly with each other, with the relays mainly serving as a forwarding instance.

Furthermore, the simplicity of the protocol makes it very flexibly extensible, with the NIPs creating a similar ecosystem like XEPs, which for me is one of the great ideas of XMPP. So unlike ActivityPub and Matrix, in which servers need to agree on a lingo and implementations have to be kept up to date to stay usable, nostr really might become the spiritual successor of XMPP with great backwards compatibility.

Don't get me wrong, the other two might still have their place, but I reckon especially ActivityPub could be surpassed by nostr in many use-cases. I sort of see nostr like git, a step from centralised VCS to distributed VCS. Because after all a nostr relay could be like a copy of a git repository, with the notes being the commits, but not needing to be aware of contents beyond what is needed to verify their integrity.

Thus I think its options could go far beyond, including offline edits and live editing even on more complex content like tasks on a Kanban board synchronized to a task. Then you could take a CMS like Servus and rather than restricting people to the admin interface use the nostr protocol in a way that I can use my preferred editor to post to my blog! Most importantly, you wouldn't need accounts all over the place, especially when interweaving with SOLID Web3. For more on that concept see https://code.ftt.gmbh/janek/nodal.

Setting Up

I put off setting up my account for months because I like to do things right. Since relays hosted by other parties are free to discard old content, I want my own relay to preserve full history. Neither did I want to setup some relay implementation mentioned in a guide but find a fitting one, which I finally did through https://www.nostr.net/#relays.

nostream seems to be the classic (setup guide with nginx), but typescript isn't the most performant backend technology. knostr is interesting because I am comfortable with Kotlin but does not support a few newer NIPs as development seemingly stalled. So I went with a docker setup of rnostr which seems to be performant, feature-rich and well-maintained. A friend also recommended strfry. Either way, unlike when choosing an ActivityPub server, my decision is not set in stone because all bigger relay implementations facilitate easy import & export via jsonl!

I took some inspiration from this guide on setting up a relay with Caddy and ended up with this simple docker compose file, supplemented by a simple caddy proxy config similar to the guide:

version: '3'
services:
  rnostr:
    image: rnostr/rnostr:latest
    ports:
      - 8080:8080
    volumes:
      - ./rnostr:/rnostr
      - ./rnostr/data:/rnostr/data

  caddy:
    image: caddy
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile	  

For the frontend, I set up satellite-web, editing src/constants.ts to point to my own relay. I opted for satellite because I wanted a clean profile focused on the content and without any kind of "trending" section. As for sharing a profile, I found https://nosta.me very elegant as it includes guided account creation suitable for non-techies. https://njump.me is also decent but the various codes would only confuse the relatives I share my content with.

Clients

For the client side, I generated a keypair with Amethyst on mobile and then setup nos2x-fox as signer in Firefox so I could use it from my browser without entering my private key. I also found the Spring mobile app installed via Obtainium helpful for trying out various webapps. Then I put json-files onto my own domains managed in HestiaCP to get verified.

I uploaded my profile pic and banner next to the nostr.json on the webserver, compressed as jpg - one thing to mind here is that clients seemingly reject non-square profile pictures. Amethyst and Primal seem to have an equivalent list of default relays that is not synced to the profile by default, as Snort did not show them even though you are supposed to be fully portable between clients with your account. Also, sometimes my profile info would take a few reloads to propagate from one client to the other. So there is still some things to figure out, an edit of the relays to use my own seemed to propagate fine. Overall I am very happy I can finally ditch ActivityPub for something even better - much more simple and flexible.

Comment via email (persistent) or via Disqus (ephemeral) comments below: