Nostr Media Cache

Many people complain that Damus and other nostr apps consume a lot of traffic. A problem not many talk about is profile pics: those are huge! Many popular profiles have 10-20 Mb sized gifs.

Top 1k accs have >1Gb of pfps in total.

At Nostr.Band it took 50Mb just to load the homepage, because of profile pics.

So we built a media server to solve this. It looks through all nostr profiles and downloads all profile pics and banners, then resizes them, then places at pre-defined urls on this server.

Then you can get pics from here at:|banner)-size
HHHH being the last 4 chars of pubkey (not first, because PoW will make them zeroes).

It's 169Kb, instead of 10Mb for @BTCSessions.

We have 2 sizes for pictures (64 and 192 width) and 2 for banners (600 and 1200). On average, pictures are 90% smaller, and banners are 75% smaller.

Supported formats are png, jpg, gif and webp. You can append one of these extensions to the url if you know the type of file that's supposed to be there. These are static files behind nginx, all caching and headers are served properly.

Our crawler collects notes from all relays, and this server loads new profile pics in real time, so it should all be up-to-date and provide full coverage. If you want to check which kind:0 event our server is caching, you can check:

One caveat though: we do not download pics for brand new accounts that had no interactions from other members of nostr, to avoid being abused and spammed. So some lowest-quality pics might actually be missing, and you will get 404. In that case you can just fall-back to downloading the pic from the user profile.

Oh and another caveat: we download files up to 64Mb in size. Anything bigger is just too costly to process.

If any client wants to use this server to save your users' bandwidth, feel free to do that. To discuss this, contact on Nostr.