I want to identify the ipfs source node. Is it necessary to do that in IPFS?

up vote 2 down vote accepted

You can't find where a file comes from on IPFS. However, when you add a file to IPFS through your IPFS node like this:

$ ipfs add ~/helloworld.txt 
added QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u helloworld.txt

The file is automatically pinned on your node, it means it is permanently stored at least until unpinned. A non-pinned file is removed from the node after a certain amount of time (like a cache).

Any nodes can decide to also pin a content on IPFS (think replication):

$ ipfs pin add QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u
pinned QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u recursively

Then it is possible to discover all nodes (identifier of the node) that have pinned this content on the network using the following command:

$ ipfs dht findprovs QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u
QmQVricDKJeFWFvvyD3E7WwwRBkum54jmjdj5yv3NpdqAs
QmTGfEbUM1xz5Po6sVNj2KcMP6HjmrivRB9PLE13GxFZFG
QmV1eTGvh9vqT9vFzf593XAmTDroHZtZEuiUXBaJ53z6b5
QmV2ZonzMpvX3DfFi35uT3Frb4e4L8cATQrb4ZSM3jt3ZE
QmXM22ePEJMbJ1HhZR5khxaHK2PFfWM9gb7UsdHxSJEydP
QmaeUxeAK3N5fyU5o5W8eFeHGy7SUgcxfscewNNGgFak8L
Qmc2D7Wwuy8sGV19eAWg9tAtLUnSkEazkgjiYxP8NMD6k7
QmfLu1CARPvzSFvSrk1cc5yueT3DAvdckfdcDGsVgeJiH6
QmaJBMtVJhYnZzikiJqoWi4rDErVNnE6Y7xGLqAsVA2Z12
QmPrYfg99FYVzJ47eUBGde3STUDHoH1iQTPRfeo98K8Rzi
QmQ6qTyjnBETj3uRxXZb7xFFqqY1hpDwRSfWpbZNmzSk5B
QmSNXv7s6XsBHnyJgnZNApDC1yccjoR2Af6zmzqViNKS8z
QmT1cwtvuKknEaaRRr1oz5Up81Y9fhNQnwtHJ4wa319Q3E
QmUjqjKVmWiXJp9HxBJF7Z9Qke5ruNd6BGxwMGxgyM6Ry9
QmX15kSQGh5KgzQ5Qu2j39Yr1DRXLUQ7bUPAgRrCxbe2KQ
QmYxoZmhx5kiAd8MK5ZgMF2Co2GpH2xXWSm8T6JPnrwzUt
Qma8h47ZCpd575DkbTgtytZaBrMDGroGd6WgXU22sPQWWv

Notee:

  • I think the command output has a limit of 20 items.
  • Those aren't file hash but node ID

So in conclusion you can't find where a file is originated but you can at least know where its stored.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.