Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Ethereum Blockchain Developer - The Bootcamp
Ethereum Blockchain Developer - The Bootcamp
Ethereum Blockchain Developer - The Bootcamp
Ebook306 pages3 hours

Ethereum Blockchain Developer - The Bootcamp

Rating: 5 out of 5 stars

5/5

()

Read preview

About this ebook

In this book, you will not only learn the basics, but also proper Solidity development and Ethereum Smart Contract best practices. Instead of in-depth technical theory, you will learn these skills as we walk you through completing a project. In easy-to-understand chapters, you will learn everything you need to know about the Ethereum blockchain and Smart Contract Development. We will walk you through how to create, test, and troubleshoot Smart Contracts; and then deploy these contracts to various networks. Additionally you will learn how to use the Smart Contracts in various scenarios and environments.

LanguageEnglish
Release dateOct 4, 2018
ISBN9781386365877
Ethereum Blockchain Developer - The Bootcamp

Related to Ethereum Blockchain Developer - The Bootcamp

Related ebooks

Computers For You

View More

Related articles

Reviews for Ethereum Blockchain Developer - The Bootcamp

Rating: 5 out of 5 stars
5/5

2 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Ethereum Blockchain Developer - The Bootcamp - Thomas Wiesner

    Book Overview

    In this book, you will not only learn the basics, but also proper Solidity development and Ethereum Smart Contract development workflows. Instead of in-depth technical theory, you will learn these skills as we walk you through completing a project. In easy-to-understand how-to-style chapters, you will learn everything you need to know about the Ethereum blockchain and Smart Contract Development. We will walk you through how to create, test, and troubleshoot Smart Contracts; and then deploy these contracts to various networks. Additionally, you will learn how to use the Smart Contracts in various scenarios and environments.

    Goal:

    ●  Understand the tools needed to create smart contracts

    ●  Write and understand secure Solidity code

    ●  Avoid accidentally introducing Bugs and Blockchain Programming Errors

    ●  Understand the development and deployment workflow

    ●  Use and create private networks, test networks and the public main network

    ●  Understand how transactions are structured

    ●  Understand how Gas and gas costs can be calculated correctly

    ●  Write, Deploy and Interact with your Smart Contract on the Ethereum Blockchain

    ●  Understand the difference between Web3.js and truffle-contract

    ●  Install, configure and use the Truffle Framework

    ●  Write Smart Contract tests with the Truffle Framework

    ●  Deploy to IPFS

    Who is this book for?

    ●  People who have heard of Ethereum, but do not know how to start

    ●  People who have some experience with programming, but no Solidity experience

    ●  People who want to know how this technology works

    ●  People who have written simple Solidity contracts, but want to delve deeper into the subject matter.

    Requirements for this book:

    ●  Absolutely necessary: ​​basic knowledge in JavaScript / HTML

    ●  Absolutely necessary: ​​A computer (Windows / Linux / Mac)

    ●  Advantageous: basic knowledge in C ++ / Java, data types

    ●  Advantageous: basic knowledge with git repositories

    ●  Advantageous: basic knowledge of Solidity

    Introduction

    Who are we what we will create during this course

    Hi, I'm Thomas.

    I have over 15 years hands-on development experience in various environments, a masters’ degree in computer science and years of in-depth applied knowledge of blockchain technology, Solidity and the Ethereum platform.

    I also co-created the industry standard Ethereum certification program CBDE with the Blockchain Training Alliance (BTA).

    So far there are 6 in-depth best-selling blockchain developer video courses which I authored or co-authored online available. And I am currently consulting and training Fortune 500 companies in blockchain technologies and Ethereum development.

    In this book I’m going with you through the different aspects of Ethereum development. I’ll demonstrate the tools available and workflows that worked best for me and my projects.

    Hi, I’m Colleen.

    https://media.licdn.com/dms/image/C5603AQGrdGSVNjMDpA/profile-displayphoto-shrink_800_800/0?e=1544054400&v=beta&t=5KE_FEA_8kBrm_kCBBnp0H78w5X9bvuIGmmSUzBMqtE

    I have over 20 years in the tech industry, in various roles: from tech support to web developer to business analyst to project manager to CTO. I got interested in Blockchain, Bitcoin and Ethereum several years ago, and I have been working as a teaching assistant for Thomas’ courses for the past year.

    Code repository and sample code

    For each example in this course there is sample code. This code is located in a repository located here: https://goo.gl/faLDdD

    We try to keep the code updated to the best extend we can. That means it should run on the most up to date solidity versions until there are breaking changes that need a complete overhaul. To give you an example, that would’ve been the jump from Truffle 3 to Truffle Version 4. The command line interface changed, as well as the folder structure. We’ll keep note of such changes in the FAQ document located in the repository. Of course you can always post issues, which are more than welcome!

    How to get in touch with us

    You found a bug? Something is not working right? The code seems outdated? No problem! You can find us and talk to us - we’re just humans and mistakes happen.

    If you found a bug in the code, best course of action would be to simply raise an issue on GitHub. This way we can look into it and fix it accordingly.

    There is a private Facebook group for Ethereum enthusiasts which you can reach here: http://bit.ly/2NbAC6X

    You can also find us on LinkedIn!

    Thomas: www.linkedin.com/in/thomas-wiesner

    Colleen: https://www.linkedin.com/in/colleenwtorek

    Formatting in this book

    Let’s keep this short, just remember:

    Words in italics are keywords in Solidity

    Words in bold are key concepts to remember throughout the book

    Solidity Basics and the Remix Environment

    In this chapter we are going to lay out the basics to write a smart contract. It is neither a complete reference of Solidity, nor a complete reference of Remix, but a starting point to the most important functions to get you started quickly.

    What is Remix?

    Remix is ​​an integrated development environment (IDE) for Solidity development, which runs completely in any modern browser. Simply connect to: http://remix.ethereum.org and you're ready to start.

    At first, Remix doesn’t connect to any private or public blockchains. It has an in-memory representation of a blockchain, purely for Solidity development testing purposes. This is quite handy as the overhead and resources needed to create a local blockchain, or the cost to interact with the live chain, can be prohibitive to someone new starting in this ecosystem. We will describe how to connect to a real chain works in subsequent sections, but for now, Remix help us to get up and running with Solidity development quickly!

    Let's take a look around.

    When you start Remix for the first time, you already have a demo Smart Contract. You see this in the center top area. This is the editor window where you write the actual code.

    The Code Editor has some features that make working with Solidity easier.

    On the left side you will find your files. This works in a similar way to normal code editors.

    In the center bottom you will find a transaction log window. The next section will describe how to work with the log.

    On the right, there are several ways to interact with your smart contracts. Remix has a built-in blockchain simulation and can also connect to other blockchains. We will cover this in another section.

    Something to understand with this IDE; Remix saves all changes locally in your browser window, this is called the localStore. This means that you can shut down your machine, but the site will persist your code.

    openhttp://remix.ethereum.org and edit some files and do some changes and then

    openhttpS://remix.ethereum.org

    (sometimes the browser automatically redirects if he detects the same website running SSL enabled)

    all your edits will not be visible if just one single piece of the URL or the protocol changes. (http vs https).

    ––––––––

    If you open http://remix.etherum.org, this is a different localStore than https://remix.ethereum.org. So, if suddenly your Smart Contracts are gone, then look at the address first!

    Remix File Management

    In this chapter, let's take a look at how we can interact with Remix. To do this we will remove the standard Smart Contract, delete the file and create a new one.

    First, we close the already opened smart contract. Click on the little X next to the name. But the smart contract is not gone. We still need to delete the associated file. This can be found here in your file overview. Right-click on the file and it will be deleted.

    ––––––––

    Let’s create our own contract. Click on the ‘Create New File’ button. We give the file a name - in our example ex1.sol.

    The following example will describe the absolute minimum for a Smart Contract.

    Each file should start with the pragma line.

    This is actually for the compiler, and should specify for which compiler version the smart contract was written.

    The ecosystem evolves so fast and solidity changes constantly, there is often no backwards compatibility for solidity, so you need to take care and ensure that your contract’s pragma is aligned with the compiler version that the code was developed for.

    The pragma line specifies which version this solidity file was written for. This follows the so-called Semantic Versioning. You can find out more at this link: https://docs.npmjs.com/misc/semver

    If you took an older Contract and attempted to compile it with a newer solidity version, you would likely get compiler warnings or errors that would prohibit contract deployment.

    This particular line says that the file was written for Solidity 0.4.24 or greater. But a maximum of 0.5, with compiler version 0.5 would not compile.

    After the pragma-line, the actual contract code is included. This starts with the word contract and then in CapWords style the smart contract name. This means that all words are written together, but the words themselves begin with a capital letter. For example, MyContractExampleOne. Or here: ExampleOne. Then come curly brackets, and that's it.

    This is the actual contract code, which could be compiled and deployed on the Ethereum blockchain.

    Starting, Stopping and Interacting with Smart Contracts

    Let’s take a look at how we can use Remix to interact with smart contracts. We want to be able to test and use them during the development phase.

    For this I have extended the smart contract from the last section to write a simple variable.

    Note that the contract should automatically compile, and any errors or warnings will appear on the right panel.  If it doesn’t compile automatically then head over to the Compile tab and turn Auto compile on.

    Notice the variable and the function here. The variable is a Storage variable of the type unsigned integer 256. It can only store positive values ​​in the range up to 256 bits, so 0 to 1.1579209e+77. Any number larger than this, and the variable will wrap around and start at 0 again, similar to a car odometer that has reached 999,999 miles, and you keep driving it. The function is public. That means you can call it from outside the contract, it expects an argument, and then writes it into the storage variable.

    Let’s test this out. The first thing we see is here on the right: our contract is green. That means there are no errors or warnings.

    We also see on the right side the Remix has more tabs.

    Now important for us is the second tab, called Run. Select it and we see that we have more options.

    The first setting is the selection in which environment we want to deploy our Smart Contract. We can leave that on Javascript VM, as this is the in-memory blockchain that Remix provides for rapid development. If you have something else selected, then please choose the JavaScript VM now.

    The next select field is the account. When we choose a JavaScript VM environment, Remix will automatically give us some accounts with enough Ether to deploy contracts

    Enjoying the preview?
    Page 1 of 1