7 Web3 and a channel Dapp

 

This chapter covers

· Web3 API for accessing Ethereum client node functions

· Programming with web3 modules and web3 provider

· Designing a Dapp with a channel, an off-chain feature

· Implementing a micropayment channel for a global cleanup problem

· Connecting off-chain operations with on-chain operations

The focus of this chapter is on web3. Using web3, you can pretty much set your Dapp on auto-pilot. If so, what is web3? Web3 API, simply called web3, is a comprehensive package for accessing blockchain functions. Blockchain infrastructure provides services for account management, recording of transactions (Txs), and smart contract execution, all of which you explored in previous chapters. Web3 exposes the functions of the Ethereum blockchain client node; it facilitates the interaction of external applications and the blockchain node. Web3 API facilitates programs to access blockchain services. You’ve been using web3 in Dapp application development in earlier chapters, where web3 usage was discussed at a high level. In chapter 4, you used web3.js in the Dapp development as part of the glue code (app.js) between the web application and the smart contract and included web3 (the minified version in web3.js.min) in the Dapp.

Definition

web3.js is a JavaScript library—commonly referred to as web3—that enables applications to access the services offered by the Ethereum blockchain client node.

What will you learn in this chapter

7.1       Web3 API

 
 

7.1.1   Web3 in Dapp stack

 
 

7.1.2   Web3 packages

 
 
 

7.2       The channel concept

 
 
 
 

7.2.1   Micropayment channel

 
 
 

7.3       Micropayment channel use case: MPC

 
 
 
 

7.3.1   Traditional banking solution

 
 
 
 

7.3.2   Users and roles

 
 

7.3.3   On-chain and off-chain operations

 
 

7.3.4   MPC smart contract (MPC-contract)

 

7.3.5   MPC application development (MPC-app)

 
 

7.3.6   MPC Sequence diagram

 
 
 

7.3.7   Demonstration of MPC execution

 
 

7.3.8   Accessing the web3 provider

 
 
 

7.3.9   Extensions of MPC

 
 

7.3.10    The relevance of micropayment channel

 

7.3.11    Other web3 packages of interest

 
 
 
 

7.4       Wrapping it up

 

7.5       Best Practices

 
 

7.6       Summary

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest