-
Notifications
You must be signed in to change notification settings - Fork 578
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
NIP-81 Modeling Files / Filesharing #417
Conversation
Same as #337? |
I investigated using NIP-94 for my filesharing app but realized there some pieces missing:
This is an alternative proposal that fixes those problems and provides greater extensibility. |
I think all of the issues you raised are valid and should be included in NIP-94 |
This seems to be a very well-thought proposal, we should merge it with NIP-94 for sure, or vice-versa. |
I think we can summarize both this and the other proposals as just pointer to files with optionally multiple ways of accessing these files and optional metadata. We just have to agree on the names of the tags for the metadata.
What do you think? @frbitten |
Some thoughts/questions:
|
Sorry, I forgot about that one. Modified above.
What if you just have a file hosted somewhere and want to use a Nostr filesharing client to broadcast it -- and your file is 10GB? You'll have to download the file to check the size? I agree with the magnet stuff. Also it's not a big deal to edit the NIP every time. People will certainly add new non-specified tags to the events anyway if the usage catches on. It's better to differentiate tags according to usage, I think. We lose nothing from doing that. |
I suppose in that case (you don't have the file locally to check the size) the same logic would apply to file hash and mime type. It seems likely that whatever source you are getting that metadata from would also provide the file size.
Ok yeah. If it's no big deal to edit the NIP then I agree it's better to use tags to differentiate usage. |
Good point. I guess the file size and mimetype can be fetched from a HEAD request in most cases. |
blurhash could also be merged into
|
@lovvtide If you don't use the full magnet link then you lose out on extra data like void.cat supports webtorrents with WebSeed & ExactSource, which are required to bootstrap a file from web, otherwise nobody will be able to load it |
The reason I thought to use
Ah yes, should probably change that then. Maybe
That was my original idea, but as @fiatjaf pointed out it might be better to have a separate tag for each type of hash, i.e. use tags to differentiate usage instead of markers
Well |
As I already put it in the NIP-94, I don't see a problem in changing the tags to be single letter and indexable. I didn't put them as indexable on purpose precisely so as not to overload the relays with indexes that we are not even sure if they will be used. I don't think hash lookup is viable. It will just be a way to confirm that the download was done correctly. In most cases, I imagine you won't even have this information at the event. The m tag really is a good thing to be indexable for searches by type. File name in NIP-94 I left open to use other tags that already exist in the protocol such as "subject" (NIP-14) instead of creating another tag. They can suggest changes in the NIP-94 that I accept them. Any other tag that you deem useful can be added. I tried to be as minimalist as possible to avoid limiting its use. There are numerous image metadata tags that can be included for example. |
@fiatjaf For the NIP-94 to work, it should be limited to only having one event-id in the "e" tag and it must be a NIP-95 event. I don't know what would be the best approach in this case. What do you think? |
Yea maybe its not necessary, in NIP-94 they use
I think it makes more sense to use just
Maybe, trying to imagine a scenario where you would want some other URL that would be different than the web seed...
Idk, you remove any of the flexibility of just having a plain Here is a random image uploaded to void.cat without
You need the torrent file in order to have the piecehash data, maybe this is a problem for void.cat to solve by hosting the metadata on trackers too idk, what do you think? |
But we have enough, right? If we consider that each kind has different meanings for each letter (besides some canonical ones like About the magnet I don't know, I think having the full contents of the magnet split between tags looks good to me, but having the full magnet too. Ideally file hosts (yes, voidcat.io) that provide webseed should also provide the torrent file at the same path, so while constructing the magnet we could just use the same URL pattern for the |
This is how void.cat does it, do you think that searching by infohash will be a thing? Will searching by any hash ever be a thing? I dont know, seems like just putting the full magnet link is a better option
Im in agreement with @frbitten |
In what cases will someone have a hash and want to look up the file that has that hash? Either someone gave me the hash to search or I already have the file and I want to see if it is already shared. If someone passed the hash they might as well pass the event id. Knowing if the file has already been shared can be a feature external to NOSTR that the client or relay implements in another way. What if we have the same file shared on more than one link. Are we going to have the same hash in multiple events, how will the indexing be in this case? I don't know how this databases are to know if this could be a problem or not. |
@v0l This is a really good point
@fiatjaf This seems like the best solution. It may result in duplicated information sometimes, but that's a small price to pay for clients not having to parse magnet links to read metadata while at the same avoiding any constraints on the usage of the full magnet spec.
@frbitten @v0l Yes. I'm thinking of the case where you have the file and want to query relays for event(s) containing the hash of the file to find out who published the event and/or verify it's authenticity. I think this is quite an important use case actually. For instance, suppose that all I have is a link to a file (or someone sends me a file as an attachment, or perhaps I downloaded the file from a torrent client that doesn't know about nostr) and, in any case, I want to verify that the file can be trusted. I want a nostr client to be able to download the file, compute the hash, and then query relays using that hash to find out if anyone has created an event the vouches for the authenticity of that file I just downloaded. With deep fakes and AI and all of that I imagine in the future this capability to "verify" media will only become more important. I want it to be possible to build a "trusted torrent client" using nostr that is interoperable with existing torrent clients but uses nostr as a way to get information about credibility/authenticity of files.
Won't be a problem at all, for the same reason that many events contain, for example, the same |
@lovvtide But a file already published does not guarantee its reliability. You will have to do a social analysis of who published it to see if it is a trusted user or not. If all this is automatic by the application, I understand the usefulness. But I don't see a common user calculating a hash of a file to search if it already exists in the nostr. But if it's important for your project, I don't see a problem with being an indexable tag. |
Yes, that's an important distinction. Being able to look up the author of an arbitrary file is not sufficient, on its own, to being able to trust the file. However (regardless of how people and up doing the social analysis part) it is still a necessary component of any such system. Like, I'm thinking of the file hash being sort of like a "primary key" that makes nostr more easily interoperable with other ways of distributing files, i.e. leaving the door open for applications in different contexts to talk to each other about that file by referencing that hash without all the applications having to know about nostr. |
This functionality has been incorporated by NIP-94. |
Here's my proposal for censorship resistant file sharing on nostr. The three main goals of this proposal:
I'm currently building a file manager app the implements this spec, so I should be able to show that soon as well. What do you guys think?
Here's the proposal https://github.com/lovvtide/nips/blob/NIP-81/81.md