Book Image

Ethereum Projects for Beginners

Book Image

Ethereum Projects for Beginners

Overview of this book

Ethereum enables the development of efficient, smart contracts that contain code. These smart contracts can interact with other smart contracts to make decisions, store data, and send Ether to others.Ethereum Projects for Beginners provides you with a clear introduction to creating cryptocurrencies, smart contracts, and decentralized applications. As you make your way through the book, you’ll get to grips with detailed step-by-step processes to build advanced Ethereum projects. Each project will teach you enough about Ethereum to be productive right away. You will learn how tokenization works, think in a decentralized way, and build blockchain-based distributed computing systems. Towards the end of the book, you will develop interesting Ethereum projects such as creating wallets and secure data sharing.By the end of this book, you will be able to tackle blockchain challenges by implementing end-to-end projects using the full power of the Ethereum blockchain.
Table of Contents (12 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributor
Preface
Index

Deploying and testing ERC20 tokens


In this section, we will have a look at how we can deploy and test our ERC20 token, or cryptocurrency. We will have a look at some of the pitfalls and security concerns that you may encounter when you are transferring tokens, and we will look at the Solidity and JavaScript that will be required to transfer those tokens. We will also be testing them out using Ganache and MetaMask.

 

Deploying ERC20 tokens

First of all, we need some data to enter into the editor. In the MetaCoin.sol, we need to define a name, a symbol, the number of decimal places, and INITIAL_SUPPLY. We will also assign our INITIAL_SUPPLY to the totalSupply in the constructor. We will also give the creator of the token theINITIAL_SUPPLY.

We know that we need totalSupply because if you go to StandardToken, found under node modules | zeppelin-solidity | contracts | token | ERC20 | StandardToken, then you can see that this imports ERC20 and BasicToken. Now, if we go to the ERC20 folder, we can...