/ethereum-ipfs-react

Integrate an Ethereum dApp with IPFS and React (front-end)

Primary LanguageJavaScript

ethereum-ipfs-react

Integrate an Ethereum dApp with IPFS and React (front-end)

What is it?

alt text

Storing data on a blockchain is very very expensive. So what if I love decentralization, and want to preserve a document? IN comes IPFS! A P2P distributed web, where you can store your files. Storing anything in IPFS returns a hash (that is the location of the file). Now I took this hash and put it on the ethereum blockchain, so now the file has been stored in a trustworthy manner in the cheapest way!

So in this project, you can select a file that you want to store on IPFS, and interact with metamask and ethereum to deploy the file onto the IPFS, and take the hash and store it in the dAPP.

##How to work with it?

  1. Ensure you have metamask installed.
  2. On a command prompt do: $ ganache-cli
  3. Login into the metamask account using the seed words generated by ganache.
  4. On another command prompt, cd into eth_ipfs_ui (this is where the front-end logic lives - written in React)
  5. $ npm run start - starts a web page at localhost:3000
  6. Enjoy!

The web-page also gives you relevant details on where the ipfs hash is stored in the blockchain, the ipfs hash itself!

NOTE: You don't need to install ipfs for this! I have used a node of infura.io (see eth_ipfs_ui/src/ipfs.js) To add a file to IPFS using the ipfs-api, the file must be converted into a buffer. This is done is eth_ipfs_ui/src/AppContainer.js