Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Ethereum Smart Contract Development
Ethereum Smart Contract Development

Ethereum Smart Contract Development: Build blockchain-based decentralized applications using solidity

Arrow left icon
Profile Icon Mayukh Mukhopadhyay
Arrow right icon
€18.99 per month
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2 (3 Ratings)
Paperback Feb 2018 288 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Mayukh Mukhopadhyay
Arrow right icon
€18.99 per month
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2 (3 Ratings)
Paperback Feb 2018 288 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Ethereum Smart Contract Development

Grokking Ethereum

In this chapter, we will try to understand Ethereum. We will study what decentralization means and whether Ethereum is truly decentralized. We will also cover its core technological stack and get familiar with various jargon such as mist, Ethereum Virtual Machine (EVM), swarm, whisper, ether, and gas. We will briefly discuss solidity and the notion of a Turing complete language. We'll then revisit forking, mining, and block architecture from the perspective of Ethereum. We'll end this chapter by getting an understanding of Ethereum wallets and client interfaces, which will serve as a firm base for smart contract development.

After studying this chapter, you will be able to:

  • Understand the concept of Ethereum
  • Appreciate the notion of decentralization
  • Be familiar with Ethereum related jargon
  • Know about solidity and Turing complete languages
  • Comprehend...

Understanding Ethereum

What does Ethereum really mean to us? Is it just another cryptocurrency imitating bitcoin or is it just a distributed software platform that can run various applications on a public blockchain? As a software developer, I can assure you that Ethereum is much bigger than how it is currently defined in the standard Wikipedia article.

Take your time to read the following definition. Pause, close your eyes, and think about it. The following definition broadcasts a subtle but very powerful message. It says to us:

Here is a 24/7 computing system, which you can have with zero upfront cost. You can copy it, use it, imitate it, tinker with it, play with it, and tweak it to meet your needs. Not only that, you can invent your own personalized currency with it and offer it whoever is willing to own it. In return, you will provide them with some service, which is permanently...

The notion of decentralization

Why do we need to build something that is decentralized by nature at all?

To understand this, let me walk you through a real-world use case based on a centralized economy with a central authority of control.

Sofia is the owner of a pub in Cardiff, UK. To penetrate the liquor market, she decides to allow her loyal consumers—most of whom are heavy drinkers—to drink now but pay later (DNPL). She keeps track of the pints consumed on a ledger. Sofia's DNPL business model gets rave reviews from her clients, new consumers flood into Sofia's pub, and soon she has the largest sales, volume of any pub in Cardiff.

By providing her clients with freedom from immediate payment, Sofia gets no resistance when she substantially increases her prices for whisky and rum, the most consumed beverages. Her sales, volume increases massively.

A young...

The Ethereum ecosystem

In Chapter 1, Blockchain Basicswe studied how an Ethereum blockchain is represented as a giant Merkle tree with the leaves of the tree being the state of execution of a code. We also learned that blockchains are distributed ledgers with a web 3.0 framework.

Figure 2.4 depicts such a framework for an Ethereum technological stack. Things are going to get tricky now, so please pay close attention:

Figure 2.4: Web 3.0 tech stack for Ethereum, Source: Ethereum stack exchange

Mist

Let us start with the mist browser, which will be easiest to understand. This is the user-facing layer of the Ethereum platform. If you are a smartphone user and have used Android or iOS phones, you can think of a mist browser...

Hardware clients and internet

As we have wrapped up our under-the-hood session on swarm, whisper, and EVM, let us move on to the remaining elements of the Ethereum tech stack, which are hardware clients and the internet. The hardware clients will be covered in greater detail in the Ethereum mining section. As of now, it is sufficient to know that normal commodity hardware like CPUs and GPUs are used as hardware clients for Ethereum.

Let us now discuss the internet layer of the Ethereum tech stack, which is basically the Ethereum blockchain. As we have already discussed the blockchain structure for Ethereum in Chapter 1, Blockchain Basics, here we will cover only the logical positioning of Ethereum blockchain over the surface web.

We will revisit the blockchain structure when we discuss the Ethereum block architecture, later in this chapter.

The internet as we know is mainly the...

Turing completeness and the magic sauce

As we discussed in the previous section, Ethereum is a platform for decentralized applications. That means that we can write programs that can execute in a decentralized manner, where there is no central server or central entity that is going to execute our programs. The programs are going to be executed on many different computers, and this means that there is no way to take down such a decentralized application. In order to write such applications, we need to develop smart contracts, and smart contracts are written in a programming language called solidity. So, on the Ethereum blockchain, if you want to write a smart contract you need to learn solidity. Solidity is Turing complete. So, what does that mean? To understand this, we need to go back 60 or 70 years.

During that time, people had different calculation machines. The problem was...

Ethereum block, mining, and forking

Before we dive into the details of Ethereum block architecture, we need to revisit the blockchain structure of Ethereum. In Chapter 1, Blockchain Basicswe learned that an Ethereum blockchain is a Merkle tree where the leaves represent execution states of a code. For the sake of simplicity, a finer detail was suppressed. The Merkle tree of Ethereum is not a binary Merkle tree, as we saw for the bitcoin blockchain. You see, binary Merkle trees are great data structures when it comes to authenticating information that is in a list format, that is, a series of data chunks placed one after another. For such a transaction tree, it really doesn't matter how long it takes to edit the tree after it gets created. This is because the transactions remain in a form of one frozen tree which can only keep growing.

Ethereum, on the other hand, is...

The Ethereum wallet and client interface

An Ethereum client refers to any node which can parse and verify the Ethereum blockchain and execute smart contracts on top of it. As we have seen in the early sections of this chapter, the main purpose of user-faced clients is to authorize user credentials and provide an interface to conduct various operations. They also provide interfaces to create transactions and mine blocks, which is crucial for blockchain interaction. Figure 2.16 illustrates the classification of Ethereum client interfaces:

Figure 2.16: Ethereum client interface classification

A wallet provides a service of sending, storing, and receiving funds. The main parameters of a good wallet service are security and trust. Users must feel that their funds are secure and the administrator of the wallet will not steal the funds. Such wallets are known as hot wallets, because...

Understanding Ethereum


What does Ethereum really mean to us? Is it just another cryptocurrency imitating bitcoin or is it just a distributed software platform that can run various applications on a public blockchain? As a software developer, I can assure you that Ethereum is much bigger than how it is currently defined in the standard Wikipedia article.

Take your time to read the following definition. Pause, close your eyes, and think about it. The following definition broadcasts a subtle but very powerful message. It says to us:

Here is a 24/7 computing system, which you can have with zero upfront cost. You can copy it, use it, imitate it, tinker with it, play with it, and tweak it to meet your needs. Not only that, you can invent your own personalized currency with it and offer it whoever is willing to own it. In return, you will provide them with some service, which is permanently defined via a contract on a public ledger, so neither you nor your clients can cheat. Depending on your service...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand the Ethereum Ecosystem and its differences from its rich cousin Bitcoin
  • Explore the Solidity programming language and smart contract optimizations
  • Get a developer’s perspective of Blockchain-as-a-technology with exposure to common challenges faced while building decentralized applications

Description

Ethereum is a public, blockchain-based distributed computing platform featuring smart contract functionality. This book is your one-stop guide to blockchain and Ethereum smart contract development. We start by introducing you to the basics of blockchain. You'll learn about hash functions, Merkle trees, forking, mining, and much more. Then you'll learn about Ethereum and smart contracts, and we'll cover Ethereum virtual machine (EVM) in detail. Next, you'll get acquainted with DApps and DAOs and see how they work. We'll also delve into the mechanisms of advanced smart contracts, taking a practical approach. You'll also learn how to develop your own cryptocurrency from scratch in order to understand the business behind ICO. Further on, you'll get to know the key concepts of the Solidity programming language, enabling you to build decentralized blockchain-based applications. We'll also look at enterprise use cases, where you'll build a decentralized microblogging site. At the end of this book, we discuss blockchain-as-a-service, the dark web marketplace, and various advanced topics so you can get well versed with the blockchain principles and ecosystem.

Who is this book for?

If you want to know the ins and outs of the Ethereum network and build your own decentralized applications, then this book is what you need! This book is for anyone who is interested in blockchain and wants to become an Ethereum developer. It’s ideal for existing Ethereum developers who want to develop Ethereum using smart contracts. Basic knowledge of cryptography is expected but is not mandatory.

What you will learn

  • Know how to build your own smart contracts and cryptocurrencies
  • Understand the Solidity language
  • Find out about data types, control structure, functions, inheritance, mathematical operations, and much more
  • See the various types of forks and discover how they are related to Ethereum
  • Get to know the various concepts of web3.js and its APIs so you can build client-side apps
  • Build a DAO from scratch and acquire basic knowledge of DApps on Ethercast
  • Be guided through the project so you can optimize EVM for smart contracts
  • Build your own decentralized applications (DApps) by taking a practical approach

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 23, 2018
Length: 288 pages
Edition : 1st
Language : English
ISBN-13 : 9781788473040
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Feb 23, 2018
Length: 288 pages
Edition : 1st
Language : English
ISBN-13 : 9781788473040
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 108.97
Mastering Blockchain
€41.99
Blockchain By Example
€36.99
Ethereum Smart Contract Development
€29.99
Total 108.97 Stars icon
Banner background image

Table of Contents

12 Chapters
Blockchain Basics Chevron down icon Chevron up icon
Grokking Ethereum Chevron down icon Chevron up icon
Hello World of Smart Contracts Chevron down icon Chevron up icon
A Noob's Guide to DApps and DAO Chevron down icon Chevron up icon
Deep-Diving into Smart Contracts Chevron down icon Chevron up icon
Solidity in Depth Chevron down icon Chevron up icon
Primer on Web3.js Chevron down icon Chevron up icon
Developing a Cryptocurrency from Scratch Chevron down icon Chevron up icon
Enterprise Use Cases Chevron down icon Chevron up icon
BaaS and the Dark Web Market Chevron down icon Chevron up icon
Advanced Topics and the Road Ahead Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
(3 Ratings)
5 star 0%
4 star 0%
3 star 33.3%
2 star 33.3%
1 star 33.3%
Tim S. May 28, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Ethereum Smart Contract Development: Build blockchain-based decentralized applications using solidity This book was pretty good, it covered material on the web3 api (there are a-lot of functions), it covered may other areas and had snippets of code. What I like most about this was the use of the remix editor in detail, that was nice.However it did not cover some of the development tools that much that I could see e.g. truffle, solc (solidity compiler), parity etc.Could be worse, or better but should be enough to get you started :D
Amazon Verified review Amazon
Pei Deng Mar 20, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I've reached 75% of the book, and I'm pretty disappointed about the book - even to the extent that I want my money back.1 star for the content. The author might be a good developer but not a qualified teacher at all.- "The code works on my machine": When showing how to deploy a private blockchain on a local machine, there is no in-depth illustration about how Mist & Geth commands work (like which file is the socket that Mist will read from to view the private blockchain), I'm a developer myself and live in command lines every day. In the end, I need to figure out how to fix the issue myself because of the different configuration file locations.- "We will talk about it later in-depth": Fine. But even in the later parts, there is no in-depth discussion. The book asked you to copy & paste some code blocks, but never show you why. For example, `function MyFunc() public constant return unit`, as a developer (again!) I wonder what `constant` means here. But after searching in the whole Kindle book, I don't see any illustration regarding the `constant` modifier.1 star for novelty, blockchain development is still a pretty new topic, it's great that the author has the motivation in sharing the knowledge.In short, the book is more like an introduction to Ethereum development, not an in-depth discussion at all. I would say this is an OK starting point but it's just OK. "Your one-stop guide to learning about Blockchain and Ethereum Smart Contract development"? NO WAY!
Amazon Verified review Amazon
JH Oct 30, 2018
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This is typical of some of the newer Packt releases where they just cram some content together just to publish *something* on a given topic. I have found a few other ML related books to be similar in content -- just really low quality, hard to follow and seemingly not even proof read at all.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.