Ethereum Projects for Beginners
eBook - ePub

Ethereum Projects for Beginners

Build blockchain-based cryptocurrencies, smart contracts, and DApps

  1. 92 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Ethereum Projects for Beginners

Build blockchain-based cryptocurrencies, smart contracts, and DApps

About this book

Understand the Ethereum platform to build distributed applications that are secured and decentralized using blockchain technology

Key Features

  • Build your own decentralized applications using real-world blockchain examples
  • Implement Ethereum for building smart contracts and cryptocurrency applications with easy-to-follow projects
  • Enhance your application security with blockchain

Book Description

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.

What you will learn

  • Develop your ideas fast and efficiently using the Ethereum blockchain
  • Make writing and deploying smart contracts easy and manageable
  • Work with private data in blockchain applications
  • Handle large files in blockchain applications
  • Ensure your decentralized applications are safe
  • Explore how Ethereum development frameworks work
  • Create your own cryptocurrency or token on the Ethereum blockchain
  • Make sure your cryptocurrency is ERC20-compliant to launch an ICO

Who this book is for

This book is for individuals who want to build decentralized applications using blockchain technology and the power of Ethereum from scratch. Some prior knowledge of JavaScript is required, since most examples use a web frontend.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2018
Print ISBN
9781789537406
eBook ISBN
9781789531640

Creating Your Own Cryptocurrency on the Ethereum Blockchain

In this chapter, we are going to have a look at how we can create our own ERC20 token project. An ERC20 token is a cryptocurrency built on top of the Ethereum blockchain. We will have a look at its specifications, and how you can do an initial coin offering. We will also learn how to handle token transactions and transfer value.
The topics that we'll be covering in this chapter are as follows:
  • Creating a cryptocurrency/ERC20 token project
  • ERC20 standard/specification
  • Initial coin offerings
  • Handling token transactions

Creating an ERC20 token

In this section, you will learn how to create an ERC20 token. We will start by setting up a new project—we are going to use the OpenZeppelin Solidity framework to create our project.

Installing OpenZepplin Solidity

OpenZeppelin is basically just a collection of smart contracts that you can import into your own smart contracts in order to speed up your development. They can also make your smart contracts much more secure from the get-go.
You can visit the OpenZeppelin GitHub page at OpenZeppelin Github:
If you have been browsing through the Truffle website—truffleframework.com—then you have probably come across Ganache. We will be using it throughout this section. Ganache is a GUI that is basically easier to navigate with than TestRPC, but while doing all the same things as TestRPC. You can download it for Windows or any other OS if you go to Ganache's GitHub page at Ganache GitHub.
The ethereumjs-testrpc has been deprecated and it has been renamed to ganache-cli. For detailed information you can visit the following link: https://www.npmjs.com/package/ethereumjs-testrpc.
After downloading it, you can run it. Upon opening the application, you will see a UI similar to the following screenshot:
Ganache
This should be familiar: These are your 10 accounts that are generated by TestRPC. You can see your blocks, your transactions, and your logs.

Setting up new project

To set up a new project, go through the following steps:
  1. Create a new folder for the project.
  2. On the console, run the truffle command, truffle –cli unbox webpack.
  1. Run the npm install –E command. Because OpenZeppelin recommends specifying –E and will pull a specific version of OpenZeppelin, it will never update it, and will keep the same version. This is because it doesn't have semantic versioning yet.
  2. Run npm install –E zeppelin-solidity. OpenZeppelin is a lot more secure because it has been built with security in mind from the very start.
  3. Let's switch over to the editor now. Here, we will find our starter project.
  1. Lets start by removing things that we don't need. Under migrations, click on deploy contracts and remove the deployment of the ConvertLib by deleting the ConvertLib variable and the deployer.deploy() variable; allow to deployer.link() keep the MetaCoin variable:
  1. Go into the contracts folder and delete ConvertLib.sol by right-clicking on it and then clicking Delete File.
  2. In the MetaCoin Solidity file, remove ConvertLib. Remove all of the function code.
  1. Import the standard token from OpenZeppelin. OpenZeppelin is a basic ERC20 interface that we can use by running the command import ‘zeppelin-solidity/contracts/tokens/ERC20/StandardToken.sol';. This imports the StandardToken Solidity file from the OpenZeppelin framework, and it knows to look inside of your node modules folder:
  1. We can now define MetaCoin for this. Ahead of contract MetaCoin add is StandardToken.
  2. Now let's migrate MetaCoin. Make sure that Ganache is running. Under RPC server, you should see that Ganache runs on localhost or port number 7545. Truffle by default runs on 7545; you should be able to see this in the editor:
  1. Now, to migrate the MetaCoin, we can run the truffle -cli migrate command:
  1. You should now see that it's compiling your MetaCoin, migrations, and also a lot of files from the OpenZeppelin framework.
After performing all of these steps, our Ganache should look something similar to the following:
Ganache after making contract calls
You should now see that your transactions have gone through. Ganache has made a contract call, creating contracts. We are all set to proceed further.

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 MetaCo...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Packt Upsell
  4. Contributor
  5. Preface
  6. Workflow Setup and Thinking Blockchain
  7. Developing Your First Decentralized Application with Ethereum
  8. Creating Your Own Cryptocurrency on the Ethereum Blockchain
  9. Signing Legal Documents on Blockchains and Identity Verification
  10. Ethereum Outside the PC/Web Environment
  11. Other Books You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Ethereum Projects for Beginners by Kenny Vaneetvelde in PDF and/or ePUB format, as well as other popular books in Informatica & Intelligenza artificiale (IA) e semantica. We have over one million books available in our catalogue for you to explore.