https://wiki.wellorder.net/post/nostr-intro/ Logo Well Ordered Wiki Posts Wiki SrcHut Github --------------------------------------------------------------------- Nostr, an Introduction 2022-02-15 nostr decentralization web4 Nostr is a new system that brings me joy to work on and use, so I'd like to take a few moments to share a few words about it. Nostr tries to solve the problem of publishing short notes ("and other stuff") on the Internet. Twitter solved this problem neatly, then complicated it through API and client restrictions, advertising, and a clumsy interface. Finally, they fully unsolved it by inserting themselves as the arbiters of what speech is allowed. That's fine, their platform, their rules; clumsy censorship is just a feature I don't want. An "unfollow" button is all I need. Twitter is only going to get worse, the Bluesky initiative is an acknowledgement that something fundamental needs to change. Software for chatting on the Internet should be small and fun. We are just putting little snippets of text on computers, minimalism should be de rigueur. I ran across Nostr when I was looking for an excuse to do some network programming. I have a thing for small standards, and the Nostr spec was 75 lines of exactly what I was looking for. Notes and Other Stuff, Transmitted by Relays Nostr is all about censorship-resistant publishing of "events". In this context, I'll be referring to notes, events that contain plain text. Nostr is extensible to arbitrary event data, and part of the fun is imagining what can be built using these events. Nostr authors create notes, digitally signed and timestamped. Nobody can speak for you or impersonate you, but anyone can repeat and republish what you said. Authors are identified by a public key, also used to verify their notes are authentic. My public key is 35d26e4690cbe1a898af61cc3515661eb5fa763b57bd0b42e45099c8b32fd50f. A bit unwieldy, but that is what nicknames are for. Nostr clients are the software tools that people use to publish and receive notes, implemented either with desktop software, or in-browser apps. Clients create short-lived subscriptions to indicate what kinds of notes they are interested in, which can be based on attributes such as an author's public key, time ranges, or tags. The final component is the Nostr relay. Relays provide the note storage and searching infrastructure for clients. Nostr is distributed, but is not peer-to-peer. Relays can act as clients to share notes with other relays, but this is not required. Relays can charge a fee for note storage, or limit publishing to specific authorized users. Relays are numerous and diverse (and, generally described as "dumb"). Clients select relays based on the community and policies associated with them. Solving the Right Problems There is no blockchain. No proprietary social sign-in. No "real-name policy" No distributed hash table, onion routing, raft consensus, or peer-to-peer protocol. There is just a method of providing simple digitally signed text, and a simple, scalable search service. Resilience is provided by the protocol being simple enough to implement in a weekend, in your language of choice. Platform lock-in is impossible, since any client can republish any note to a different relay if one misbehaves or enacts a disagreeable policy. Want to make a simple Nostr client? Open a web browser javascript console, and enter the following. You'll see all my notes. I get "sending mail with a telnet client" vibes when I do this. // connect to a relay var ws = new WebSocket("wss://nostr-pub.wellorder.net"); // send a subscription request for text notes from authors with my pubkey ws.addEventListener('open', function (event) { ws.send('["REQ", "my-sub", {"kinds":[1], "authors":["35d26e4690cbe1"]}]'); }); // print out all the returned notes ws.addEventListener('message', function (event) { console.log('Note: ', JSON.parse(event.data)[2]["content"]); }); To save you the trouble, here is what you might find. You may notice that yes, notes can be replies to other notes (through special note tags). > Note: I am now - welcome! > Note: Nice, let me know if you have any feedback on the rust relay! > Note: Found you from stacker.news; welcome! > Note: Worst case, you can just run your own relay! > Note: Very nice; great find. Can't wait to watch. ... Want to retrieve all notes from one relay, and publish them to another? A one-liner shell command does the trick, and will keep the destination up-to-date as long as you let it keep running: $ echo '["REQ", "mirror-everything", {}]' | \ websocat -n 'wss://source.example.com' | \ jq -c '[.[0,2]]' -M --unbuffered | \ websocat 'wss://destination.example.com' When it is this easy to make clients talk to relays, or turn relays into clients, we can have fun working with the system. Prototypes of new ideas can happen in an evening. And, you can have fun sharing and refining your ideas with others. Just The Beginning This is just a small peek into Nostr. The protocol is extensible, and already there are working extensions that provide: * Public follower lists and nicknames (NIP-02) * Private direct messages (NIP-04) * "Verified" accounts (NIP-05) * Event deletion (author-initiated) (NIP-09) There is much work to be done, and lots of exciting progress being made every day. Nostr works today though, so pick up a client and send me a note! More Resources * Nostr Github - official Github project for the specification * Telegram Group - where development chat happens * Awesome Nostr - curated list of Nostr resources * Nostr-rs-relay - my Nostr relay, written in Rust (c) Greg Heartsfield 2022 | Last update: 2023-04-18 | Commit: 161ff9b