Build a simple Ethereum + InterPlanetary File System (IPFS)+ React.js DApp.

A simple DApp to upload a document to IPFS and then store the IPFS hash on the Ethereum blockchain.

Once the IPFS hash number is sent to the Ethereum blockchain, the user will receive a transaction receipt.

In the code comments, you can also choose to run your own IPFS daemon if you install IPFS as a global dependency.

Const IPFS = require(‘ipfs-api’);const ipfs = new IPFS( );//run with local daemon// const ipfsApi = require(‘ipfs-api’);// const ipfs = new ipfsApi(‘localhost’, ‘5001’, );export default ipfs;App.

Send IPFS hash to etheruem contract //return the transaction hash from the ethereum contract//see, this https://web3js.

If you are connected to an IPFS node via your localhost:3000, then you should be able to see your file at one of the IPFS gateways.

A note about IPFS, is that unless your file is picked up by another node or you pin it, IPFS will eventually be garbage collect your file.

This article was summarized automatically.

Original link