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

eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to Italy

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Italy

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

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 the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela