1

The web3.js is the most easiest and perhaps the standard way of dapp creation.And there are two providers possible as of now , HttpProvider and IPCProvider. The HttpProvider takes the address at which the server is running, it can be something like

             var Web3 = require('web3');
             var web3 = new Web3();
             web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545"));
                                               // or it can be http://m.n.k.l:8545

My question is if the server hosting/node , has went down how can the client be able to access it. In cases like this the entire dapp is down. Then what is the point of calling it dapp ?

Is my understanding correct about having a single server as provider ?

Not all dapp creators host their own server / a node running in rpc.In such cases, how would the creator would know any node address ?

  • There is no server in a decentralized application. The provider should in most cases be localhost, connecting to the users node. – Afr Jun 28 '16 at 20:41
  • 1
    @5chdn how is that decentralised again? – niksmac Jun 29 '16 at 1:22
  • @niksmac Welcome to Ethereum Stack Exchange, if you have another question, please ask in a separate thread. :-P If each user does not connect to a central server but to his decentralized p2p app running on his localhost, it's per definition decentralized, if not distributed. – Afr Jun 29 '16 at 6:06
  • @5chdn thanks :-P thanks for your kindness to answer in a comment. :D – niksmac Jun 29 '16 at 7:13
3

The localhost:8545 that is in your example indicates that the DApp is sending requests to a node running locally on the user's computer. Often, the paradigm is to check for a local rpc server, and if it does not exist to use a public node as a fallback (assuming the DApp does in-browser key management-- you need a local node to hold the keys otherwise).

  • How would a developer be aware of a public node ? and its address ? – Abhiram mishra Jun 29 '16 at 4:43
0

web3.js or any other clients communicates to a node that you have setup. In this case the node is running in localhost:8545 and the app communicates to that port to get data in that node. Every node will have same copy of data hence there is no central server and no downtime at all (That is the whole point of blockchain).

If you are worried about the downtime of a single server, you may need to think from your application perspective. You can setup two or more nodes to avoid the downtime and other infrastructure related issues.

For example, in my case I have set up 3 linux VM's for geth instance and one windows server for application hosting and other DB related activities.

  • Then its distributed not decentralised. – niksmac Jun 29 '16 at 9:25
  • I'm not sure how it could be more decentralized. There's the public blockchain, mined by any number of people including lots of home computers with GPUs, and there's users of the dap, who run javascript locally which talks to their local Ethereum node, which talks to the public blockchain. – Dennis Peterson Jun 30 '16 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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