Understanding DApps
A DApp refers to an application that utilizes smart contracts for its operations. These smart contracts are deployed and executed on an Ethereum Virtual Machine (EVM). It is similar to a client-server two-tier architecture, where there is no need for any middlemen to operate. A DApp typically consists of a web-based frontend that interacts with its backend, which is implemented using a smart contract. The frontend makes calls to the backend using the web3.js API.
In order to engage with a smart contract on the blockchain, web3.js commonly interfaces with a wallet. MetaMask is one of the most widely used browser wallets for this purpose. The wallet establishes a connection with a backend blockchain node and submits a request to the blockchain. The following diagram shows a typical DApp architecture and the flow interactions between the frontend and backend:
Figure 10.1 – DApp architecture
In this chapter, we are going to follow...