2

Is it possible to store / catalogue every file which is being published over IPFS ? Is only encryption the viable way to securely publish files over the internet ?

1 Answer 1

2

Is it possible to store / catalogue every file which is being published over IPFS ?

I like to use IPLD (IPFS Linked Data) to link IPFS files together. This way, you only have to keep track of one unique hash. Example...

i. Let's create and store 3 files on IPFS

$ echo "hello world 1" > helloworld1.txt
$ ipfs add helloworld1.txt 
added QmWyRPTS2QnuvkKepR2DTqo5uRbyRt62wpudkskYsxG7Di helloworld1.txt

$ echo "hello world 2" > helloworld2.txt
gjeanmart@ganymede:~$ ipfs add helloworld2.txt 
added Qme8ZwRMpYMzPe6pyc18vwPoN4bxuTWD8CWmaGvFMjNtVN helloworld2.txt

$ echo "hello world 3" > helloworld3.txt
gjeanmart@ganymede:~$ ipfs add helloworld3.txt 
added QmRge51jhC6tVCi7yyDVEsdpTx3dP97SfnC81UBTyvq5nU helloworld3.txt

ii. I will now create an IPLD file which is simply a JSON file that references and links all files together like this:

{
  "helloworld1.txt": {
    "/": "QmWyRPTS2QnuvkKepR2DTqo5uRbyRt62wpudkskYsxG7Di"
  },
  "helloworld2.txt": {
    "/": "Qme8ZwRMpYMzPe6pyc18vwPoN4bxuTWD8CWmaGvFMjNtVN"
  },
  "helloworld3.txt": {
    "/": "QmRge51jhC6tVCi7yyDVEsdpTx3dP97SfnC81UBTyvq5nU"
  }
}

o The IPLD file has a CID (Content Identifier) like any other objects on IPFS

o I chose to format my file using the file name as key but it could literally anything. The only syntax required make the link is {"/": "QmWyRP...7Di"}

$ echo '{"helloworld1.txt":{"/":"QmWyRPTS2QnuvkKepR2DTqo5uRbyRt62wpudkskYsxG7Di"}, "helloworld2.txt":{"/":"Qme8ZwRMpYMzPe6pyc18vwPoN4bxuTWD8CWmaGvFMjNtVN"},"helloworld3.txt":{"/":"QmRge51jhC6tVCi7yyDVEsdpTx3dP97SfnC81UBTyvq5nU"} }' | ipfs dag put
zdpuAzajtbGXpwM35MhsnnwvPFPgstxjPG3MpePkynnMNb9y6

Of course, every time, you add a file to the catalog, the hash (CID) changes, so you need to store this new hash somewhere (you can use IPNS, the Ethereum blockchain or a simple database).

iii. The beauty of IPLD, it's very easy to browse the content:

$ ipfs dag get zdpuAzajtbGXpwM35MhsnnwvPFPgstxjPG3MpePkynnMNb9y6
{"helloworld1.txt":{"/":"QmWyRPTS2QnuvkKepR2DTqo5uRbyRt62wpudkskYsxG7Di"},"helloworld2.txt":{"/":"Qme8ZwRMpYMzPe6pyc18vwPoN4bxuTWD8CWmaGvFMjNtVN"},"helloworld3.txt":{"/":"QmRge51jhC6tVCi7yyDVEsdpTx3dP97SfnC81UBTyvq5nU"}}

$ ipfs cat zdpuAzajtbGXpwM35MhsnnwvPFPgstxjPG3MpePkynnMNb9y6/helloworld1.txt
hello world 1
$ ipfs cat zdpuAzajtbGXpwM35MhsnnwvPFPgstxjPG3MpePkynnMNb9y6/helloworld2.txt
hello world 2
$ ipfs cat zdpuAzajtbGXpwM35MhsnnwvPFPgstxjPG3MpePkynnMNb9y6/helloworld3.txt
hello world 3

Is only encryption the viable way to securely publish files over the internet

As far as I know I don't see any other solution to securely protect files over Internet than encryption.

2
  • Thank you greg, my viewpoint for the question was a bit different. Considering that the blockchains are inherently open in nature, is it possible to index every file that is being added into IPFS ? What would be the entry point for it ? I am trying to understand if vulnerability like this exists.
    – okp
    Dec 14, 2018 at 4:47
  • Not sure to understand your point. But yeah you can index your files (hash) on the Ethereum blockchain which would be as you mentionned public. The entry point would be a smart contract (if it's what you're asking). In terms of vulnerabilities in this pattern (store file on IPFS and index on Ethereum), I think the risk is more on the IPFS side, if your file isn't replicated (pinned) on the IPFS network and you lost your unique node, nobody would be able to get the file. Dec 14, 2018 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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