PIP 002 - IPFS file hosting as-a-service
The scope of this proposal is to suggest an implementation for a web service that would automate the paid hosting of IPFS data, using BCH as the payment method. Having an automated IPFS hosting service would enable many other kinds of apps that need a decentralized, permissionless method of uploading persistent data that can be retrieved at a later date.
The general workflow for the proposed scheme is as follows:
An end user would utilize a web UI to select an IPFS hosting provider from a drop-down list.
The users browser instantiates an IPFS node and connects to the selected hosting provider over secure websockets.
The users browser hashes the file and uploads it to IPFS.
The users browser makes an API call to the hosting server. This call triggers a download of the content with
ipfs getand also specifies a time for storing the file. The cost in BCH for hosting based on file size and storage time is returned.
This may need to be split into two API calls. One for file retrieval, one to poll for a quote after the file has been downloaded and analyzed by the hosting provider.
The user is presented with a QR code and BCH payment amount in the browser.
The file is immediately available on the IPFS network.
If the payment transaction is not broadcast to the blockchain within a specified time (24 hrs), the files are deleted.
Research and Links
This YouTube video is a walk through on how to build a front-end UI for uploading files to IPFS: https://www.youtube.com/watch?v=KkjAktAA4M4
The IPFS http API can be used to control an IPFS node: https://github.com/ipfs/js-ipfs-http-client
Or a service like Temporal can be used for paid hosting: https://gateway.temporal.cloud/ipns/docs.api.temporal.cloud/ipfs.html#ipfs-api
A hosting service like Temporal could be used to bootstrap the app, and then a more decentralized hosting model could be developed using js-ipfs-http-client.