Store on IPFS through DApp

Hey!

I’m developing a simple storage DApp, using truffle and Rinkeby network. Essentially I’m using App.js and index.html. (https://github.com/lguicarvalho/Inbox)

I’m trying to integrate IPFS to DApp (using infura node), so I can input a file through frontend, store it on IPFS, and then retrieve the hash on frontend

I’ve been searching for tutorials and examples for a long time, but they are mostly about react DApps, and are very different from mine. Since I’m not a programmer, it’s been very difficult to adapt their code to mine.

Could someone help me with that?

I appreciate the attention!

OBS1: for the moment, I do not intend to go into the merits of automatically storing IPFS hashes in the smart contract. Adding files to IPFS and returning them in html would already be a HUGE advancement.

OBS2: the closest article about that content: https://medium.freecodecamp.org/hands-on-get-started-with-infura-and-ipfs-on-ethereum-b63635142af0

IPFS is still a very new technology so the documentation and examples for non-programmers may be sparse. One idea you could try is to use the https://github.com/ipfs/js-ipfs-http-client library with Infura set as the provider using something like const ipfs = window.IpfsApi(‘ipfs.infura.io’, ‘5001’, {protocol: ‘https’})

1 Like