I am building an app that spawns an IPFS node on every user’s machine. I want to add a file to IPFS from a node, get it’s CID, and then notify the others nodes that use the application that they have to get the file related to that CID. The only way I can think of right now is to add the CID to a centralized database’s table or collection, and make the other nodes search in that table or collection and get the content related to the CID’s that are there. Is there a better way to do this?
Edit: and by “make the other nodes search in that table or collection and get the content related to the CID’s that are there”, I can’t think of something else just for the db to notify the nodes somehow that the table or collection data has changed and they have to get the file asociated to the CID’s there, or just make a pretty boring cron job that takes the CID’s from the DB and then get’s the files.
What you describe could work; could also look at a message queue solution. Would love to understand your scenario here more broadly and how it will be used.
Hi there! I kind of want to simulate a blockchain on IPFS without the “chain” part. I want to add a file to IPFS, and make the other nodes that use my app download the file from IPFS, and the only thing that’s missing is how do I make the others know the CID of the file. The message queue is actually a really good idea, thanks for that. I was thinking also on how can I make this “notification” as decentralized as possible, because a DB or a message queue is a centralized approach, but I couldn’t find an answer yet. Until I can find something better, a message queue is the best I’ve got. Thank you!
Edit: I thought I should give a bit more info on my app. It’s a music streaming platform, and I’m trying to build it on top of IPFS and make it as decentralized as possible. So far, I implemented decentralized streaming using IPFS and Http Live Streaming. Now, I want to make the user data as decentralized as possible. In a centralized app, that user data is stored in a DB, associated to a user account. So, if a user want to use the app, the user has to create an account, then log in / authenticate. After authentication, the user uses the app, and that results in user data; in my case, a user, for example, can like a song, and this data should be stored somewhere, and in this approach, is stored in a centralized DB. I thought that I could make this user data decentralized by assigning a private key to each user (and they have to remember it, almost like a crypt wallet works), then keep the user data in a file, and If I want to save that data so that I can “authenticate” from another computer for example, I can symmetrically encrypt the file with my private key, then make all the other nodes that use my app download it through IPFS. Now, if I connect from another device for example, all I have to do is retrieve the file from one of the nodes, decrypt it with my private key, and have all my data back. So currently, my problem is how do I make the other nodes know (notify) that they have this CID that they have to use in order to download and keep my file?
I know you said you don’t want the blockchain part, but just imagine that you at least had access to an RPC endpoint so you could publish the hash you’re hoping to publish to a smart contract.
In that way, your end users (who just as likely have access to an RPC – everyone does these days), could read the hash from there.
The publication of the hash has gas costs, but that’s on you (the software developer). The cost of reading the hash is zero for the end users.
You can also “pin by default” as we do and in this way the CID gets naturally distributed to your end users.
We had the exact same problem a few years ago, and we developed these ideas into something we call The Unchained Index.
I’ve written about it in excrusiating detail here: https://trueblocks.io/papers/2023/specification-for-the-unchained-index-v0.51.0-beta.pdf and made a video about it here: Unchained Index · ETHGlobal Showcase