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

Deploying a smart contract to a test network using Truffle

In this section, we will learn how to deploy a smart contract to a test network using the Truffle tool. For the deployment, you will need to install the following:

  • Node.js: v12 - v16
  • Truffle

Let’s start with installing Truffle.

Installing Truffle

The system requirements for Truffle are as follows:

  • Node.js: v12 - v16
  • macOS, Linux, or Windows

We learned how to install Truffle in a previous section of the book, so will not dive deep into the installation here. Make sure you have @truffle/hdwallet-provider installed as well. If you haven’t, use the following command to install this:

$ npm install @truffle/hdwallet-provider

Visual Studio (VS) Code is the IDE we will be using for the rest of the chapter. VS Code is highly recommended, but feel free to use any IDE you prefer.

If you have VS Code installed, Truffle for VS Code is a highly recommended extension. It will...