Book Image

Learn Ethereum - Second Edition

By : Xun (Brian) Wu, Zhihong Zou, Dongying Song
Book Image

Learn Ethereum - Second Edition

By: Xun (Brian) Wu, Zhihong Zou, Dongying Song

Overview of this book

Ethereum is a blockchain-based, decentralized computing platform that allows you to run smart contracts. With this book, you’ll discover the latest Ethereum tools, frameworks, wallets, and layer 2, along with setting up and running decentralized applications for the complete, end-to-end development experience. Learn Ethereum, 2nd Edition is a comprehensive overview of the Ethereum ecosystem, exploring its concepts, mechanisms, and decentralized application development process. You’ll delve into Ethereum's internals, technologies, and tools, including Ethereum 2.0 and the Ethereum Virtual Machine (EVM), gas, and its account systems. You’ll also explore Ethereum's transition to proof of stake, L1/L2 scaling solutions, DeFi protocols, and the current marketplace. Additionally, you’ll learn about EVM-compatible blockchains, connectivity techniques, and advanced topics such as sharding, off-chain scaling, DAOs, Metaverse, and NFTs. By the end of this book, you’ll be well-equipped to write smart contracts and develop, test, and deploy DApps using various tools, wallets, and frameworks.
Table of Contents (24 chapters)
1
Part 1: Blockchain and Ethereum Basics
7
Part 2:Ethereum Development Fundamentals
11
Part 3: Ethereum Development Fundamentals
15
Part 4:Production and Deployment
20
Part 5:Conclusion

Building frontend UI components

In this section, we will build our digital art market DApp frontend components. Before we start to write the code, we will install all the dependencies needed in the project.

Setting up project dependencies

In our DApp frontend, we will use the MDB framework as a UI CSS framework, react-route as a URL router navigation library, and truffle-contract as a utility to read the compiled contract ABI file. Web3 is used to communicate with the backend blockchain network. The following is the list of the npm dependencies defined in package.json:

Figure 10.22 – Project dependencies

Figure 10.22 – Project dependencies

Install all these dependencies by running the install command, as shown here:

npm install

After installing all the necessary dependencies, we will instantiate our smart contract instance.

Getting the instance of a deployed contract

In the Working with the Web3 JavaScript API section, we learned how to instantiate a Web3 instance...