DEV Community

Cover image for What is a decentralized application (DApp)?
Drayfocus
Drayfocus

Posted on • Originally published at drayfocus.hashnode.dev

What is a decentralized application (DApp)?

Developers build decentralized apps (DApps) to make smart contract functionalities available to the end users. In this article, we will discuss:

  • What are Decentralized Applications (DApps)
  • Components of a DApp
  • How these components work together

What are Decentralized Applications

Decentralized applications are softwares that exist and run on a decentralized blockchain system. Simple right? Yes, it is that simple.

They make use of smart contracts to execute actions and commands on a blockchain system. You can learn more about smart contracts in my previous article.

Components of a Decentralized Application

Let's relate a DApp to a small village with a King.

This King stays in a Palace, where he rules and controls the affairs of the village. He is responsible for communicating with his people and also taking care of their needs. His Palace has a highly guarded *Gate * that gives him the needed security and environment to perform all his tasks.

To pass information to his people, the king sends a group of Town Criers . The Town Criers carry information round the village and also takes the request of the people back to the King. Take note, only known and trusted Town Criers are allowed to pass through the Palace's Gate and access the King for security reasons.

In a DApp,

  • The Palace is the remote CPU which has a blockchain enviroment installed (e.g Ethereum Virtual Machine - EVM). It acts as a blockchain node, which is part of a large decentralized blockchain network like Ethereum.

  • The King is the Web3 Provider, which resides in the blockchain node. It is responsible for executing commands on the blockchain node. It has direct access and can communicate back and forth with the node.

  • The palace's Gate is the RPC (Remote Protocol Call) port through which requests to and response from the Web3 Provider passes. This port is usually well secured to protect the blockchain node from cyber attack.

  • The Town Criers are the Web3 Connectors. They connect to the Web3 Provider through the RPC port. It works like a simple API system that sends request (In JSON) to the Web3 Provider to execute and also recieve the response from the Web3 Provider. A popular example of Web3 Connector is Ethereum's Web3.js package .

Bringing everything together

Now that you know the components of a DApp, let's see how they work together.

  • The blockchain node is connected to a blockchain system (e.g Ethereum), thus having access to the transactions and blocks of the blockchain. We also deploy our smart contracts to the blockchain system using the blockchain node.

  • User accounts and wallets are created on this blockchain node and these accounts are responsible for sending and receiving transactions.

  • Actions and commands won't be auto executed on the blockchain node, so we need an executor. The executor is the Web3 Provider.

  • Web3 Connector acts as an initiator of an execution. The Web3 Connector can be an API or a User Interface like in MetaMask, Binance, e.t.c.

Conclusion

Every Decentralize Application (DApp) is made up a blockchain node that host accounts, help to deploy the smart contracts on a public or private blockchain system, and has a Web3 Provider that executes commands intiated by a Web3 Connector. I hope you now understand what a DApp is and how it works.

Bonus

There many questions I haven't answered yet. For example, how did I get to understand DApps?

Blockchain in Action by Bina Ramamurthy helped me in preparing this article and
you can get your own copy of Blockchain in Action with 35% discount.

Discount code: bldrayfocus

Let's connect on Twitter @drayfocus and Linkedin Akinola Ayomide.

Cheers!

Top comments (0)