-
Notifications
You must be signed in to change notification settings - Fork 501
Create offchain::ipfs speculative grant #283
Conversation
Co-authored-by: Joonas Koivunen <[email protected]> Co-authored-by: ljedrz <[email protected]> Co-authored-by: vvp <[email protected]> Co-authored-by: teempai <[email protected]>
I'm not really sure how useful this will be in practice, can you provide an example of how this might be used? A better approach might be to have the ipfs node bundled with a light client as demonstrated here: [0]. This allows sharing the db with ipfs. Transactions can take a As a further application it might make sense to store merkle tries in ipfs blocks so that inclusion proofs can be provided. Assume you have an identity module that stores a map from account-id => cid. A different module requires to know some field of the identity. The transaction of that module takes as arguments the value of the field and a proof that can be checked by the runtime. Another application useful might be a commit/reveal scheme, where the thing being commited/revealed is a cid. In this case also it's not very useful to have an ipfs api exposed to the runtime. cc @4meta5 |
@dvc94ch I'll open a separate grant that uses With that said, I do think that it makes more sense to follow David's approach and we've been doing a lot of work on this already. EDIT: here's a link to a previous related discussion |
I'm really curious what that feedback was exactly or how this is intended to be used. |
It seems to me that the proposed grant work exposes the full IPFS API to Substrate users, including IPLD. The proposed From that perspective, it looks to me that the work in the proposed grant will enable a wider set of primitives to the user and I believe exposing the IPFS API will have larger impact on enabling Substrate users to work with IPFS/IPLD. |
Any data essential to the runtime logic needs to be stored in the runtime. Any data not required by the runtime logic only requires a hash of the data to be stored to ensure immutability. |
My understanding of offchain workers is that their primary usecase is for building oracles. That means that with your approach, you'll fetch a block, read it's contents, and then perform an onchain vote to agree on the value. The inclusion proofs I suggested can avoid this voting process. I'm sure there are many things I haven't considered, I should have focused my initial comment on requesting clarification as opposed to proposing a different solution. Can you explain one or two use cases of how this will be used? |
Following Substrate's vision, it is not our intention to dictate how IPFS would be used. Same with voting - Substrate allows its users to tailor the consensus algorithm to their specific needs and we don't want to affect it. The goal is to enable DApp developers with the means to easily integrate IPFS into their custom pallets, which can offer a great host of functionalities, but are non-trivial to create. By integrating IPFS into the off-chain API we intend to make this process much simpler, which can benefit both the Substrate and IPFS ecosystems. |
That makes complete sense. David is just trying to understand the application architecture that can benefit from this structure. |
This is a really interesting proposal. It would be useful to have an IPFS integration close to Substrate logic of our pallets. For example it would let us validate whether provided IPFS CIDs of a newly created blogs and posts on Subsocial point to exisiting contents in IPFS. And in case of invalid CIDs, offchain worker would hide such blogs or posts from the news feeds of the end users. |
Grant Application
This application is (select one):
This application is (select one):
Abstract
Based on community feedback we received after announcing the Rust IPFS initiative, we would like to enable the Substrate off-chain worker to make IPFS calls via a relay on the Substrate host. While this was at best cumbersome and at worst infeasible for Substrate users before, the availability of a Rust-native IPFS implementation not only makes this possible without external HTTP servers, but also optimizes network usage and performance significantly.
Once embedded, offchain::ipfs would enable common IPFS operations such as
ipfs.add
,ipfs.dag.put
, andipfs.block.put
ipfs.get
,ipfs.dag.get
andipfs.block.get
ipfs.bitswap
This would benefit the ecosystem by bringing together two mission-critical pieces of Web3 technology, allowing content and data to be marshaled to and from Polkadot parachains, and improving availability in both networks. We believe that this would be a valuable addition to Substrate and as such, we’d like to propose this to be available within the official Substrate repository. Of course, we are willing to take Parity’s guidance on that.
While there are other implementations of IPFS (Go and JavaScript) we would prefer to natively embed IPFS in Rust to keep the codebase consistent and leverage the performance and resource utilization benefits that Rust provides.
Checklist