My doubts have to do with an implementation where a user fills a form, form data is stored in IPFS. IPFS returns a hash which is stored on Ethereum Blockchain against email ID as primary key (Solidity array). My implementation uses truffle v2 (https://github.com/shivamdawer/ethereum-ipfs-storage), and has web3.js and ipfs.js on client side. My questions are :

  1. Should web3 be used on client side or on server side? I read somewhere that it was originally meant for server side, but I haven't found any boilerplate for the same.
  2. Current implementation works successfully on localhost (testrpc port 8545, ipfs ports 5001 & 8080). But on replacing localhost with https://servername.com, I get '

There was an error fetching your accounts.', 'The page was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint. This request has been blocked; the content must be served over HTTPS.

'IPFS XHR Error'. Is this because testrpc and IPFS are meant for HTTP only? How do I address this 3. Somebody suggested that I not use Truffle if i want to go into production mode. Is there a React Webpack boilerplate for Blockchain. If so, please point me in the right direction.

  • I suggest you post (3) as a separate question as it's not really connected to the first two. If possible include a link to the suggestion not to use Truffle in production as it probably needs some context. Aug 6, 2017 at 16:33

1 Answer 1


Normal practice for a DApp is to use client-side JavaScript to connect directly to an IPFS daemon and Ethereum node on the internet. However, these libraries should also work as-is in server-side JavaScript executed with nodejs. You will need to load an ipfs JavaScript module with require().

If doing this on the client side, since the IPFS daemon will normally be listening on a different IP/port to the domain that is serving your DApp's static HTML pages, the IPFS daemon will need to be configured to send CORS headers to avoid the XHR error you describe. The way to do this is explained here: https://github.com/INFURA/tutorials/wiki/IPFS-and-CORS

The code you link also seems to store the file on a server with an insecure-looking PHP script. Don't do that - just copy the IPFS part.

  • 1) Okay, so I take it you are implying that client-side web3 and IPFS are acceptable practise? 2) CORS for IP/Port makes sense. Can the same be handled through proxy? Read this somewhere but couldn't piece it together well. 3) You are correct about the PHP script. It seems you are suggesting IPFS can store data directly, not just a file. New point for me. Thankyou!
    – Shivam D
    Aug 6, 2017 at 19:22

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.