Difference between revisions of "IPFS"
Line 29: | Line 29: | ||
[[File:Ipfsnr2.png]] | [[File:Ipfsnr2.png]] | ||
[[Category:Applications]] | [[Category:Applications]] [[Category:Node-RED]] |
Revision as of 15:39, 25 May 2022
IPFS is a peer-to-peer data storage system aimed at providing persistent data storage and better identification of data.
Files and data stored on IPFS are given a hash identifier that directly relates to content, so any changes in content result in a change of file name. This allows us to store data in various forms, including directory structures, with no possibility of filename duplication.
IPFS is used in numerous applications, including the 'off-chain' storage of data for blockchains. As long as someone somewhere has the data 'pinned' then it remains accessible to all. IPFS was recently used to backup the entire Turkish Wikipedia follow government plans to take it down. The site now persists in a fashion that cannot be taken down. https://en.wikipedia.org/wiki/InterPlanetary_File_System#Other_notable_uses
An example of IPFS in action can be seen on the Heat Network Designer where it is used to save the complete design as well as outputs into a JSON file, so it can be shared via a short URL.
e.g. https://hw7.ddns.net/ui/hndesign?loadCID=QmegcRKHhunR6ZR4Vvo65NEMHzau8c9CNrR1GMi7YfZT3N
The raw data for this is at... https://heatweb.mypinata.cloud/ipfs/QmegcRKHhunR6ZR4Vvo65NEMHzau8c9CNrR1GMi7YfZT3N
We are using Pinata as a pinning service - where we save our files and JSON data to IPFS. Pinata provide a set of libraries that can be used by Node-RED to upload files and data.
- https://friendsoflittleyus.nl/storing-data-on-ipfs-with-node-red/
- https://docs.pinata.cloud/pinata-node-sdk
The tutorial linked above provides Node-RED code similar to below.
The pinFileToIPFS() function is used to upload files on the server.
It is also possible, and easier, to upload JSON data directly, requiring no files to be first written to file. The Node-RED flow below is an example of how data can be posted to IPFS with email confirmation.