Avatar
Blake
b2dd40097e4d04b1a56fb3b65fc1d1aaf2929ad30fd842c74d68b9908744495b
#Bitcoin #Nostr #Freedom wss://relay.nostrgraph.net

I’ve just prototyped something. Would it be useful to use as a library? What else do you need or what wouldn’t work well? My main concern is slow network requests, otherwise it’s likely decent. Maybe this resembles a future API endpoint for event metadata.

At some point I’d likely need a rust version.. however typescript is a start.

nostr:note1kws8xh7gsjj5sf87d59zprgl4uq99mt6ap2ns66a8ef4kzuekdwsn76cwm

I’ve written a proof of concept Nostr Event Parser in typescript that ideally can be used universally by others to parse event content into html, or just extract metadata that can be used to render html however you like.

If anyone’s keen to use this, let me know. I think having a general purpose Nostr event parsing library is valuable. I’m not entirely sure how best to handle some of the performance critical parts, however I’m sure we can find a way.

## Features

* Extract hashtags (and convert to html a tags)

* Extract mentions (and convert to html a tags)

* Extract urls (fetch content-type, preview metadata, and convert to html a tags)

* Custom URL handlers

## Future

* Refactor into a library

* Query relays for mention pubkey kind0 metadata (possible caching)

* Root event and reply event lookup (with optional pubkey lookup)

* Handle different event kinds

* Support for NIP-27 - Text Note References

* Ideally more information on image urls like dimentions

https://github.com/blakejakopovic/nostr_event_parser

Happening now.

nostr:note1zq2vwg339dvktp5mjepad2g6h9kn0ttm0rytx87feplw0lf0tnxs8jfj4t

Discord captcha triggers me more. Apparently I don’t know what horses, lemons, or computer chips are.

The Fedimint team run open invite white paper Wednesdays, and today is about schnorr signatures. Starts in an hour.

https://meet.jit.si/fedimintdevcall

Discord link for anyone interested too.

https://discord.gg/QTN6eQeD

I’m guessing they will need rate limiting too - in case something blows up. Perhaps someone’s DMs go wild for example - maybe that’s ok for a back and forth, however not ok for a DM flood attack.

Strangely the rate limit may need to be dynamic per pubkey.

However, what is your event firehouse for notifications? A relay aggregation service? Targeting only a pubkey’s 10002 read relays? How do their private/encrypted relays work? It’s all very complex.

Personally I prefer async comms - and disable notifications.

I’m not actually using that sdk for event requests, so hard to say. It really depends on your use case.

Are you trying to dedupe for a timeline? If so, your timeline data model can ignore adding events that already exist.

Are you trying to dedupe for an archival backup process? You can fetch all the data first and then dedupe. Or maybe use sets to track seen.

There is also deduping across relays and relay subscriptions. Maybe that’s desirable, or maybe it isn’t - particularly if you want to count something thing like followers; you may have seen that following contact list before, however you need it to +1.

The main catch with deduping is you should use event ids and not the raw json, as the json can have the keys ordered differently.

Ultimately it would be nice to tell a relay a compacted hash of what you’ve seen and then they can skip sending those events. The issue being it’s a statistical model and may have false positives.. meaning it may not send 1 in 1,000,000 events.. which is likely fine. This doesn’t solve the multiple concurrent relay queries approach however.

Yeah. I was more so curious than it being a feature request, however I think it adds value.

What I’ve been looking for is a JS Nostr event parsing library that handles mentions, event references, Nostr:, #[], root event, reply event, images/media detection, etc. It doesn’t need to render anything, just parse and output an object.

#[0]​ did you have plans to render images in events too? Or is there any trick to get them to show?

https://nostr.band/note1nyurqppjzm0ry7tcx8xqun9nyd9tkn22teunfn97uw34093caftsps2syu

Don’t worry, I checked and NVK’s already on our list 👮‍♂️

Wish me well. I’m applying for the role to delay and sabotage their efforts.

https://bitcoinerjobs.com/job/910114-full-stack-developer

I can’t think of any successful creator subscriptions/memberships, where the content is solely text.

There are two kinds of text focused that seem common - either early access/preview to a post for members, or pay to read below the fold. However, they largely depend on media too.

#[2]​ did you have ideas on restricting access to media (images/videos) in the same way, when they are referenced in those events? Would it likely mean additional N events are needed per file? And that’s likely still dependant on the file storage NIP.

I’m prototyping a CDN approach that’s more web/dns focused. If there’s a better approach, I’d likely change focus.