Why Nostr? What is Njump?
2024-03-19 20:21:31

hzrd149 on Nostr: Just wrote an article about Blossom Drive. a new nostr app I'm building for file ...

Just wrote an article about Blossom Drive. a new nostr app I'm building for file sharing and censorship resistant file hosting

If you want to give it a try its hosted at https://blossom.hzrd149.com/

While I was in Mediera with all the other awesome people at the first SEC cohort there where a lot of discussions around data storage on nostr and if it could be made censorship-resistent

I remember lots of discussions about torrents, hypercore, nostr relays, and of course IPFS

There were a few things I learned from all these conversations:

  1. All the existing solutions have one thing in common. A universal ID of some kind for files
  2. HTTP is still good. we don’t have to throw the baby out with the bath water
  3. nostr could fix this… somehow

Some of the existing solutions work well for large files, and all of them are decentralization in some way. However none of them seem capable of serving up cat pictures for social media clients. they all have something missing…

An Identity system

An identity system would allow files to be “owned” by users. and once files have owners servers could start grouping files into a single thing instead of a 1000+ loose files

This can also greatly simplify the question of “what is spam” for a server hosting (or seeding) these files. since it could simply have a whitelist of owners (and maybe their friends)

What is blossom?

Blossom is a set of HTTP endpoints that allow nostr users to store and retrieve binary data on public servers using the sha256 hash as a universal id

What are Blobs?

blobs are chunks of binary data. they are similar to files but with one key difference, they don’t have names

Instead blobs have a sha256 hash (like b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553) as an ID

These IDs are universal since they can be computed from the file itself using the sha256 hashing algorithm ( you can get a files sha256 hash on linux using: sha256sum bitcoin.pdf )

How do the servers work?

Blossom servers expose four endpoints to let clients and users upload and manage blobs

  • GET /<sha256> (optional file .ext)
  • PUT /upload
    • Authentication: Signed nostr event
    • Returns a blob descriptor
  • GET /list/<pubkey>
    • Returns an array of blob descriptors
    • Authentication (optional): Signed nostr event
  • DELETE /<sha256>

What is Blossom Drive?

Blossom Drive is a nostr app built on top of blossom servers and allows users to create and manage folders of blobs

What are Drives

Drives are just nostr events (kind 30563) that store a map of blobs and what filename they should have along with some extra metadata

An example drive event would be

{
  "pubkey": "266815e0c9210dfa324c6cba3573b14bee49da4209a9456f9484e5106cd408a5",
  "created_at": 1710773987,
  "content": "",
  "kind": 30563,
  "tags": [
    [ "name", "Emojis" ],
    [ "description", "nostr emojis" ],
    [ "d", "emojis" ],
    [ "r", "https://cdn.hzrd149.com/" ],
    [ "x", "303f018e613f29e3e43264529903b7c8c84debbd475f89368cb293ec23938981", "/noStrudel.png", "15161", "image/png" ],
    [ "x", "a0e2b39975c8da1702374b3eed6f4c6c7333e6ae0008dadafe93bd34bfb2ca78", "/satellite.png", "6853", "image/png" ],
    [ "x", "e8f3fae0f4a43a88eae235a8b79794d72e8f14b0e103a0fed1e073d8fb53d51f", "/amethyst.png", "20487", "image/png" ],
    [ "x", "70bd5836807b916d79e9c4e67e8b07e3e3b53f4acbb95c7521b11039a3c975c6", "/nos.png", "36521", "image/png" ],
    [ "x", "0fc304630279e0c5ab2da9c2769e3a3178c47b8609b447a30916244e89abbc52", "/primal.png", "29343", "image/png" ],
    [ "x", "9a03824a73d4af192d893329bbc04cd3798542ee87af15051aaf9376b74b25d4", "/coracle.png", "18300", "image/png" ],
    [ "x", "accdc0cdc048f4719bb5e1da4ff4c6ffc1a4dbb7cf3afbd19b86940c01111568", "/iris.png", "24070", "image/png" ],
    [ "x", "2e740f2514d6188e350d95cf4756bbf455d2f95e6a09bc64e94f5031bc4bba8f", "/damus.png", "32758", "image/png" ],
    [ "x", "2e019f08da0c75fb9c40d81947e511c8f0554763bffb6d23a7b9b8c9e8c84abb", "/old emojis/astral.png", "29365", "image/png" ],
    [ "x", "d97f842f2511ce0491fe0de208c6135b762f494a48da59926ce15acfdb6ac17e", "/other/rabbit.png", "19803", "image/png" ],
    [ "x", "72cb99b689b4cfe1a9fb6937f779f3f9c65094bf0e6ac72a8f8261efa96653f5", "/blossom.png", "4393", "image/png" ]
  ]
}

There is a lot going on but the main thing is the list of “x” tags and the path that describes the folder and filename the blob should live at

If your interested, the full event definition is at github.com/hzrd149/blossom-drive

Getting started

Like every good nostr client it takes a small instruction manual in order to use it properly. so here are the steps for getting started

1. Open the app

Open https://blossom.hzrd149.com

2. Login using extension

You can also login using any of the following methods using the input

  • NIP-46 with your https://nsec.app or https://flare.pub account
  • a NIP-46 connection string
  • an ncryptsec password protected private key
  • a nsec unprotected private key (please don’t)
  • bunker:// URI from nsecbunker

3. Add a blossom server

Right now https://cdn.satellite.earth is the only public server that is compatible with blossom drive. If you want to host your own I’ve written a basic implementation in TypeScript github.com/hzrd149/blossom-server

4. Start uploading your files

NOTE: All files upload to blossom drive are public by default. DO NOT upload private files

5. Manage files

Encrypted drives

There is also the option to encrypt drives using NIP-49 password encryption. although its not tested at all so don’t trust it, verify

Whats next?

I don’t know, but Im excited to see what everyone else on nostr builds with this. I’m only one developer at the end of the day and I can’t think of everything

also all the images in this article are stored in one of my blossom drives here

naddr1qv…6jka

Author Public Key
npub1ye5ptcxfyyxl5vjvdjar2ua3f0hynkjzpx552mu5snj3qmx5pzjscpknpr