-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft for file archival and retrieval NIP #1098
base: master
Are you sure you want to change the base?
Draft for file archival and retrieval NIP #1098
Conversation
@fiatjaf, @jb55, I had some thoughts on decentralized media storage and other file-related applications, so I decided to write this NIP draft to get some feedback and hopefully give something to the community. it would mean a lot to me to hear your thoughts on this draft whenever you have to skim over it! Thanks! |
Looks really good! If we're not using TLVs for gateways we can just use URIs and hex ids instead of nblob: nostr+file:hexid?gateways= I never liked the TLV thing, so maybe we can simplify the spec by avoiding nblob here and just use URIs? |
Hi! I've been working on Nostr in my own bubble for a while, and something that I implemented was a reference to the id of an existing nip-94 post. For example, my user metadata had a 32-bit hexstring as its 'avatar' entry, and my client would look for the matching files metadata and decide how to resolve that request. It leaves the option for querying a URL, but it also opens up the potentials of loading the blurhash first, pulling that particular file over torrent, or even something like querying an IPFS endpoint. The only issue I had with it is the potential ambiguity of leaving it as a regular hexstring - I think that bech32-encoding it would be better but I never got around to implementing that. |
this seems way more complicated tbh. a post should not be needed for referencing files on remote gateways. then you have to do 2 lookups. |
Can the spec be integrated with NIP-96 servers? Then most image servers we use today would already respond to +1 for your use of inline metadata like #521 did. It's easy for users to switch gateways if they need to change the server when resharing a link. |
I see your point, as someone getting a post with an attached image in this form would have to look up the referenced event and then resolve it from there. and I would argue that it's more complex, but not necessarily more complicated. Provided you store your NIP-94s in a hash table, it's an O(1) lookup. Provided users are loading and storing data as it gets sent in (the file metadata would be published alongside the post itself), I see it as a dictionary lookup to pre-loaded information about the file you're looking for. I think that the idea that @danieldaquino has drafted is great - archiving file data and resolving it locally whenever possible is a good idea. I also think that using the event kind that has already been proposed for file metadata would be a good thing to integrate at a core level. If you're concerned about having two lookups, I could implement an endpoint that allows you to directly query for the hexstring on the relay server and get the relevant file back directly, either from a local archive or by resolving the url server-side and stashing it. |
This seems prescient. I think that it might be as simple as maintaining a map of all the file uploads and their bech32 identifiers. If the identifier is a hit, return it. Otherwise, resolve it and then return it. It is probably better to reference the file directly by its hash compared to the id of the file metadata event, but I still think that we should keep NIP-94 in mind if we're doing anything related to file upload & sharing. |
we should call this blobstr (blobs and stuff transmitted by relays) because it doesn't have any hard depedency on nostr :) |
That's what I was going to say. This looks great but it shouldn't even be a NIP. It should be its own thing. |
What do you think of adding another, optional, layer of indirection in there, for "routing servers" that just stores where each thing is, but not the files themselves, and you can query it to get a list of servers? I can already feel the DHT lovers agonizing when they hear about this. |
What do you think of SOLAR, which is Storage and Other Layers Added to Relays? Codebase is still mostly a pile of spaghetti, but if there's interest then I can make cleaning it up into a priority. |
so a blob tracker? starting to sound like if bittorrent and nostr had a child. |
I'm currently in conversation with some people in a major private tracker community, they're going to need to swap systems in the coming years because of some fundamental changes brought on by moving towards IPv6. I think I'm going to direct my dev capacity towards laying out the infrastructure for SOLAR as a distributing torrent tracking system. |
@jb55, thanks, I like your suggestion! The protocol portion of the URI can provide the necessary context that the hash refers to a blob in this spec. When it comes to the encoding itself, I do prefer bech32 to pure hex because it includes error correction and Base32 is made to avoid human typos and mistakes. I imagine these URIs might be something people copy-paste around or type in somewhere, so it would be nice to have a way to check for address errors. So perhaps something that looks like this?
or even
|
Thanks @vitorpamplona for your feedback! If I understood your question correctly, I believe the answer is yes. If a server implemented NIP-96, it would probably not take much work to adopt this NIP as well. That's because one of the things required by NIP-96 is for a server to make available the route Therefore, adopting this NIP would probably be a matter of registering a new route, a bit of logic to convert bech32 into a hex format, and then connecting to their existing NIP-96 logic. |
Thank you @ZenenTreadwell for your feedback!
Regarding your point about NIP-94 and storing file metadata on a Nostr event or on a URI, I believe both methods can co-exist, and I can see each method being more suitable on particular use cases:
|
I believe NIP-94 could be one way to accomplish this Example:
There might be other ways that reduce hash repetition, but it is definitely interoperable enough that it could work even with no modifications to any of the two specs |
@mleku what's your cold eyes review of blobstr? |
This a draft for a NIP that describes how immutable files can be referenced, located, and retrieved in a way that is decentralized yet flexible, extensible, and easy to implement.
I think it would be useful not only to decentralize media storage, but also unlock other Nostr use cases that require dealing with files archives (or any immutable binary data)
I tried to explain everything in the NIP, but please let me know if there is something incomplete on unclear in the spec, or any other feedback! (This is the first time I draft up a NIP)
Thank you very much!
Daniel