I created a subgraph for my app SkyDocs (decentralized Google docs app) to be able to share files with other users. SkyDocs uses Sia Skynet for storage and I have some feedback that would make integrating Sia (or IPFS) with The Graph easier.
I’d love to hear what others think about these suggestions.
This feedback is part of my final grant report available here:
The data from the smart contract goes through a mapping file which results in the data that will be indexed. In this mapping, it’s not possible to do a http request. What I wanted was to do a http request to get the referenced file from Sia Skynet and index data from that file.
This would result in less data on the blockchain, so a cheaper solution.
There is an IPFS package for The Graph, to get data from IPFS. A similar Sia package would be helpful.
A big limitation is that there has to be an on-chain action for The Graph to index. But on-chain transactions cost GAS and with high gas fees, there is no incentive to use this smart contract. Why would you pay gas to share a document?
As mentioned before, The Graph can already index data from IPFS. For example when an IPFS hash is posted to a smart contract, this hash will be available in your mapping. But this needs an on-chain transaction.
It would be really cool if The Graph could index immutable data on IPFS or Sia without an on-chain transaction. This would make The Graph useful for a lot more web3 scenario’s.
This is not an easy problem the solve. Even though data on IPFS or Sia is immutable. It makes the process non-deterministic. The network may fail, or IPFS data is not available anymore.
A possible implementation from a developer perspective could be something like this:
The Graph could create an API endpoint that accepts IPFS or Sia hash/file locations.
It then fetches the data and processes the data like it was a smart contract event. Maybe store this data on a private (sub)blockchain, so it’s similar to how The Graph indexes other blockchains. This can eliminate the need for on-chain transactions with gas fees.
Send file hash to The Graph API
Load data from sia://hash
Data is stored on a special The Graph blockchain, fees can be prepaid in GRT?
Mapping file gets the data on the blockchain as input and allows you to create subgraphs
More TheGraph metadata in Git
I like to store as much data as possible in source control / git. It would be nice if the description/logo and also example queries could be added to subgraph.yaml or another file that gets deployed to The Graph