27
  1. How can integration of IPFS with ethereum be done in DApps?
  2. Which parts of a DApp will be on IPFS?
  3. Do any examples exist?
  4. If a DApp's site is hosted on github, is it not centralized?

2 Answers 2

37
  1. Basically, you store any file into IPFS and then you store the IPFS hash in the Ethereum contract. Any user with an IPFS node is going to be able to access the file using that hash.

  2. You can store data, images, the front end, etc. whatever you want.

  3. Here you have an example: https://github.com/AdrianClv/ethereum-ipfs

  4. No. Even if your DAPP frontend (the HTML/JS code with web3) is on GitHub or in a private server, your contract code (the code written in Solidity) is going to be executed on Ethereum. The frontend is only the code that gives you access to that contract (it's a link between the HTML and the Ethereum node), but the contract itself has to be uploaded to Ethereum in order to be executed. In fact, you can access the contract without the frontend if you execute the code directly from the console.

6
  • Thanks a lot brother.very helpful. just what the doctor ordered. Commented Aug 2, 2016 at 10:20
  • @AdrianClv - where did you get the file ipfs.js in github.com/AdrianClv/ethereum-ipfs? Is it an official Javascript API for IPFS? If so, where is the official version made available? The IPFS Alpha Demo video youtu.be/8CMxDNuuAiQ (also on ipfs.io/media) mentions a Go library only. Commented Jan 18, 2017 at 2:14
  • Never mind, @AdrianClv - just scrolled down and found the link to the repo github.com/ipfs/js-ipfs-api - thanks to you for helping me find it :-) Commented Jan 18, 2017 at 18:51
  • Storing IPFS hash inside a string in the Ethereum contract is very expensive nearly costs 100,000 gas. @AjoyBhatia
    – alper
    Commented Jun 2, 2017 at 10:04
  • I have not checked that an IPFS hash costs 100,000 gas to store in Ethereum contract but, assuming that is true, here is what it works out to: 100,000 gas * 21 gwei/gas * 10^-9 ETH/gwei * $220/ETH = $ (21 * 220 * 10^-4) = $0.462 So that is 46 cents. I got the gas price in gwei from ethstats.net and the rounded ETH price in USD from Coinbase. Note that it is 46 cents at the currently historically high ETH price. Commented Jun 2, 2017 at 19:27
10
  1. Ethereum is too heavy/expensive to store large blobs like images, video, etc.. Hence some external storage is necessary to store such objects. This is where IPFS comes in. The Ethereum DAPP could hold smaller state variables.

  2. You can host static pages, data required for your app etc.. on IPFS.

  3. etherface.io is a DAPP built on Ethereum and IPFS

  4. Frontend is not DAPP - it is just one way to access your DAPP. Any person could develop a frontend for your APP and frontend here means accessible method - either a console, or a web GUI or from MIST.

5
  • yes i agree Dapp=frontend+ethereum Commented Aug 2, 2016 at 17:08
  • None of the links given above work
    – user4782
    Commented Oct 20, 2016 at 11:28
  • 2
    Can you elaborate on how etherfaces.com uses ethereum/ipfs? Looks like just a website to me...
    – Lee
    Commented Mar 11, 2017 at 18:21
  • That link for etherfaces now directs to potentially harmful malvertising. Are there any working examples that can be shared instead?
    – iyrin
    Commented Aug 7, 2018 at 23:33
  • @iyrin i think the new url is etherface.io BTW thanks for the flag
    – Badr Bellaj
    Commented Aug 8, 2018 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.