Is there a way to see what hashes does a peer have?

Hi!! I’m new to IPFS, just toying and learning. I’ve found that I can connect to a peer from the peer list, but once connected, I don’t know what else to do! Is it possible to see “what they have”? or the only way to access a content is to directly know the hash of it (and what it has)?

hello ,

with pubsub experimental feature you can send a direct message for example you can see ipfs-shipyard/pubsub-room on github. I’m not sure you can access for example DHT. if you need know if a peer know a CID you can use findprovs : https://ipfs.io/docs/commands/#ipfs-dht-findprovs

Regards

2 Likes

Thanks for the info!! I’ve tried the pubsub function… yet to find another (simmilar) problem… how to find pubs to subscribe? ahaha :stuck_out_tongue:

Also I guess it’s because how young IPFS is, but it’s difficult to find content to experiment…

Still there’s no way to find out what files do other peers have? Also, it’d be cool to know if there are repositories or if DHS could be accessed to find out contents out there.

Thanks for the help!!

Afaik that’s not possible. You can find out which nodes have a certain file (i.e. hash), as @josselinchevalay said above (dht findprovs), but listing any and all files on a remote node is not possible, I believe.

1 Like

Yeah, there is no way to ask a peer for what content they have. The closest you can get is to listen to the debug output of go-ipfs (since peers usually announce what content they have) and then build a index of your own. AFAIK, that’s what ipfs-search did to index the DHT. But that’s not neither very user-friendly to setup (you need to write code to parse the debug output of the go-ipfs daemon) or reliable since not all content is announced (content added with --local flag doesn’t get announced for example).

The general idea with IPFS is that you should now what content to request somehow. How this exactly works, depends on your application. To give you an idea, let’s imagine a Twitter application on IPFS. For every tweet the user does, a object with the content gets added to IPFS and the application then adds that hash to the users list of posts they have done. This list could be published under the nodes IPNS address, and then other peers can first make a query to the IPNS address to get the list of tweets, then iterate through the list of tweets and resolve them to show in the UI.

Furthermore, to discover the IPNS address, users could either share their list of other users they follow, so once you find a initial user, the rest of the users would be discovered via them. To find the initial user, doing gossip over pubsub could be one way, having a centralized rendezvous server could be another.

how to find pubs to subscribe?

This happens automatically when you start the daemon with pubsub activated. You just need to listen to the same topic someone is publishing to, to receive the messages. But the connection itself happens automatically.

If you just want some sample data to play around with, https://archives.ipfs.io/ would be a good starting point.

1 Like

Thaks! I was suspecting it, but had to ask just to make sure I wasn’t missing anything…

Hence, “content-finding” must be based on people voluntarily, publicly sharing hashes, right?

I know I am a total noob into the community, but the possibility to “explore the network” would be great. Might work on it if I get good enough :stuck_out_tongue:

thank you @VictorBjelkholm !!!

Hence, “content-finding” must be based on people voluntarily, publicly sharing hashes, right?

Basically, yeah. But applications can work around it with the various methods involving pubsub and IPNS if wanted. But the basic idea is that it’s voluntarily sharing the address for the content.

@VictorBjelkholm Thank you for the input, even if late!! sorry!!