DApp Front End Development – How to Build a Front End for DApp

dappsweb3js

I am studying about DApps and Ethereum. I did get the Solidity part but I am confused about the front-end apps.

Is it possible that I use web framework like PHP Laravel/Rails for Frontend/Db operations and interact with backend Blockchain via web3.js or anything?

Best Answer

Yes.

There are two approaches to consider

You can interact with Web3 on the client side and JavaScript

  • The user uses Mist or Parity browser or MetaMask and are connected to their own Ethereum node

  • All interaction with the user wallet (private keys) happens on the client side, in JavaScript

  • This is safe because the user does not need to give the control of his or her private keys to the service provider

  • You can still render pages in whatever backend programming language you wish, but currently web browsers do not support other scripting languages besides JavaScript

Here is a tutorial to build a frontend.

Old fashioned way

  • You can interact with Ethereum node on the server-side as you would interact on the client side

  • Web3 has standardish implementation for all programming languages (except maybe not PHP). Web3.py allows interaction from Python, you can use Web3.js in Node.

  • These libraries speak to Ethereum node running locally on the server side over JSON-RPC

  • You might need to do accounting for your users, a non-trivial task that I would not recommend non-experienced programmer to try

Also see Executing a Smart Contract in a Mobile App

Related Topic