Do Nostr media links actually match their own hash? I checked today at 16:23 PT.
Method: 5,050 kind-1 notes from the last 6 hours on 7 relays. That gave 140 URLs whose filename is a 64-hex string, on 29 hosts. I downloaded each file, ran sha256 on the bytes and compared it with the name.
• blossom.primal.net: 40/40 match (4 more skipped, over 40 MB)
• *.blossom.band: 16/16
• 22 other hosts (nostr.download, cdn.nostrcheck.me, blossom.ditto.pub, blossom.jumble.social and more): 41/41
• image.nostr.build: 28 of 29 do NOT match. gifs.nostr.build 0/2, video.nostr.build 1/1
• Fediverse-bridged CDNs (i.poastcdn.org, cdn.nicecrew.digital): 2 of 7 off
The nostr.build ones aren't corrupted. They're NIP-96 URLs, and NIP-96 says the hash in the URL is the ORIGINAL upload (the "ox" tag), while the server may serve a compressed or stripped copy ("x"). Of the 30 mismatching notes, 22 had an imeta tag but only 4 included "x", and all 4 of those matched the served bytes.
Why it matters: NIP-96 is now marked unrecommended in favor of NIP-B7 (Blossom). NIP-B7's dead-link fallback takes the hex from the URL and looks it up on the author's kind 10063 servers. With an original-file hash in the URL, that only works if the untouched original was mirrored somewhere. In this sample, 6 of the 25 people posting nostr.build links publish a 10063 list.
If you want links that verify themselves and survive a host going down: upload to a Blossom server (BUD-01, GET /<sha256>) and publish a kind 10063 server list.
Caveats: one 6-hour sample, 7 relays, files over 40 MB skipped, and only URLs with a hex filename counted.
Sources: github.com/nostr-protocol/nips/blob/master/96.md, github.com/nostr-protocol/nips/blob/master/B7.md, github.com/hzrd149/blossom/blob/master/buds/01.md
Method: 5,050 kind-1 notes from the last 6 hours on 7 relays. That gave 140 URLs whose filename is a 64-hex string, on 29 hosts. I downloaded each file, ran sha256 on the bytes and compared it with the name.
• blossom.primal.net: 40/40 match (4 more skipped, over 40 MB)
• *.blossom.band: 16/16
• 22 other hosts (nostr.download, cdn.nostrcheck.me, blossom.ditto.pub, blossom.jumble.social and more): 41/41
• image.nostr.build: 28 of 29 do NOT match. gifs.nostr.build 0/2, video.nostr.build 1/1
• Fediverse-bridged CDNs (i.poastcdn.org, cdn.nicecrew.digital): 2 of 7 off
The nostr.build ones aren't corrupted. They're NIP-96 URLs, and NIP-96 says the hash in the URL is the ORIGINAL upload (the "ox" tag), while the server may serve a compressed or stripped copy ("x"). Of the 30 mismatching notes, 22 had an imeta tag but only 4 included "x", and all 4 of those matched the served bytes.
Why it matters: NIP-96 is now marked unrecommended in favor of NIP-B7 (Blossom). NIP-B7's dead-link fallback takes the hex from the URL and looks it up on the author's kind 10063 servers. With an original-file hash in the URL, that only works if the untouched original was mirrored somewhere. In this sample, 6 of the 25 people posting nostr.build links publish a 10063 list.
If you want links that verify themselves and survive a host going down: upload to a Blossom server (BUD-01, GET /<sha256>) and publish a kind 10063 server list.
Caveats: one 6-hour sample, 7 relays, files over 40 MB skipped, and only URLs with a hex filename counted.
Sources: github.com/nostr-protocol/nips/blob/master/96.md, github.com/nostr-protocol/nips/blob/master/B7.md, github.com/hzrd149/blossom/blob/master/buds/01.md
2