4 From smart contracts to Dapps

 

This chapter covers

  • Designing the directory structure and code elements of a Dapp
  • Developing Dapps using the Truffle suite
  • Connecting a Dapp front end to a smart contract
  • Managing accounts with the MetaMask-enabled browser
  • Deploying and testing an end-to-end Dapp

In the preceding chapters, you designed and developed the core component of a blockchain application: the smart contract. But the logic coded in a smart contract cannot act alone. You need user-facing applications that will trigger the smart contract functions and blockchain services. These applications invoke smart contract functions, which in turn verify, validate, and record the resulting transactions and data on the distributed ledger of the blockchain. In this chapter, you’ll learn about the structure of this larger system, called a decentralized application (Dapp), and explore the techniques and tools for developing Dapps. Recall the Dapp stack and the definition of a Dapp from chapter 1, shown in figure 4.1.

Figure 4.1 Dapp stack
DEFinition

Dapps are web or enterprise applications that contain decentralized smart contract logic to invoke blockchain functions.

4.1 Dapp development using Truffle

 
 
 
 

4.1.1 The development process

 
 
 
 

4.1.2 Installing Truffle

 

4.1.3 Building the Dapp stack

 
 
 
 

4.2 Install Ganache test chain

 
 
 
 

4.3 Develop the smart contract

 
 

4.3.1 Create a project folder

 
 
 

4.3.2 Add smart contract and compile

 
 
 

4.3.3 Configure blockchain network

 
 
 
 

4.3.4 Deploy the smart contract

 
 
 

4.4 Develop and configure the web application

 
 
 

4.4.1 Develop ballot-app

 
 
 
 

4.4.2 Launch the ballot-app

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage