Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Mastering Blockchain Programming with Solidity
Mastering Blockchain Programming with Solidity

Mastering Blockchain Programming with Solidity: Write production-ready smart contracts for Ethereum blockchain with Solidity

eBook
€17.99 €26.99
Paperback
€32.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
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Mastering Blockchain Programming with Solidity

Introduction to Blockchain

Blockchain technology was born with the invention of Bitcoin—a new form of peer-to-peer (P2P) electronic cashback in 2008. The Bitcoin white paper was released on October 31, 2008 and the first release of Bitcoin came on January 3, 2009. The blockchain space is still a toddler in terms of adoption and the tools available. It has some unique properties that did not exist before in any of the previous systems or software applications. The most important property of blockchain is establishing trust between two or multiple parties without needing any intermediaries, which opens a new era in programming.

Ethereum is one of the implementations of blockchain. Ethereum is an open source, public, and distributed computing platform. On Ethereum, developers can deploy smart contracts written in the Solidity...

Understanding blockchain

A blockchain is a timestamped series of immutable transactions that is managed by a cluster of computers using special computer algorithms. These immutable records are not owned by any single entity. A blockchain is a decentralized P2P network of nodes. Each node in a blockchain shares the same copy of data, also called the digital ledger. Each node present in the network uses the same algorithm to reach a consensus.

A blockchain, by design, is resistant to the modification of data. The ledger can record transactions between two parties in a verifiable and permanent way. Whenever there is a change in the ledger using transactions, changes are distributed to all the nodes, to verify and update their own copy of the ledger. Once a transaction is stored and verified by all the nodes in the network, then it is not feasible...

Introduction to Ethereum

Ethereum was proposed in 2013 by Vitalik Buterin, a cryptocurrency researcher and programmer. The first production release launched in 2015. Ethereum is an implementation of blockchain, and is an open source, public, and decentralized computing platform. Ethereum gained popularity because of its smart contract's features. Developers can program their smart contracts and execute them on the blockchain platform so that the full potential of the blockchain's different properties can be used.

Ethereum is for writing decentralized applications

As discussed before, Bitcoin uses blockchain technology for payments using bitcoins as a currency. Bitcoin also supports a scripting language, with which...

Smart contracts

Nick Szabo coined the term smart contract in 1994. Smart contracts are self-executing contracts. They eliminate intermediaries and allow direct P2P transactions. A smart contract has the power to automatically enforce some obligations. One of the best examples of this is a vending machine: when you need an item from a vending machine, you pay into it and it gives you that item without needing any middleman.

Smart contracts are very different from traditional software programs. Smart contract code is immutable once deployed on the blockchain. Because of this immutable property, we have to think twice before deploying it; otherwise, it could end up with critical flaws in production. A different mindset is required for writing smart contracts. Some smart contracts present in decentralized applications handle the flow of ETH or other ERC20 tokens, which have real...

Introduction to the Solidity language

Solidity is high-level language oriented for smart contracts. It is a Turing-complete language, influenced by C++, Python, and JavaScript.

Solidity is a statically typed language that supports inheritance, libraries, and complex user-defined types. Solidity is a bit different from the other languages; for example, Solidity does not have null values. Variables are initialized with their default values. Solidity also does not have any exception-handling mechanism to propagate exceptions.

Solidity support different data types including uint, int, address, and many more. As developers, we must know that Solidity does not have boundary checks for the uint and int data types. This makes these data types vulnerable to overflow or underflow.

At the time of writing this book, a major release of Solidity, version 0.5.0, has come...

Solidity data types

The Solidity language is statically typed. When writing a contract or library definition, all of the state variables and local variables must have the data type specified along with its declaration. There are many data types supported by Solidity. You can create your own custom type by using the data types supported by Solidity; for example, you can define your complex struct variable.

Solidity also has a support for the var keyword, used for dynamic data type. However, since Solidity version 0.4.20, the var keyword has been deprecated because of security concerns.

If we look at the Java language, it has primitive data types and reference data types. For reference data types, especially for instantiable class, the default value is null while initialization. However, in Solidity, there is no concept of null values. Instead of null, the...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Delve into Solidity and understand control structures, function calls, and variable scopes
  • Explore tools for developing, testing, and debugging your blockchain applications
  • Learn advanced design patterns and best practices for writing secure smart contracts

Description

Solidity is among the most popular and contract-oriented programming languages used for writing decentralized applications (DApps) on Ethereum blockchain. If you’re looking to perfect your skills in writing professional-grade smart contracts using Solidity, this book can help. You will get started with a detailed introduction to blockchain, smart contracts, and Ethereum, while also gaining useful insights into the Solidity programming language. A dedicated section will then take you through the different Ethereum Request for Comments (ERC) standards, including ERC-20, ERC-223, and ERC-721, and demonstrate how you can choose among these standards while writing smart contracts. As you approach later chapters, you will cover the different smart contracts available for use in libraries such as OpenZeppelin. You’ll also learn to use different open source tools to test, review and improve the quality of your code and make it production-ready. Toward the end of this book, you’ll get to grips with techniques such as adding security to smart contracts, and gain insights into various security considerations. By the end of this book, you will have the skills you need to write secure, production-ready smart contracts in Solidity from scratch for decentralized applications on Ethereum blockchain.

Who is this book for?

This book is for developers and data scientists who want to learn Ethereum, blockchain, and Solidity to write smart contracts and develop production-ready code. Basic knowledge of Solidity is assumed.

What you will learn

  • Test and debug smart contracts with Truffle, Ganache, Remix, and MetaMask
  • Gain insights into maintaining code quality with different tools
  • Get up to speed with ERC standards such as ERC-20 and ERC-721
  • Become adept at using design patterns while writing smart contracts
  • Use MultiSignature (MultiSig) wallets and improve the security of contracts
  • Use Oracle services to fetch information from outside the blockchain
Estimated delivery fee Deliver to Germany

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 02, 2019
Length: 486 pages
Edition : 1st
Language : English
ISBN-13 : 9781839218262
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
Product feature icon AI Assistant (beta) to help accelerate your learning
Estimated delivery fee Deliver to Germany

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : Aug 02, 2019
Length: 486 pages
Edition : 1st
Language : English
ISBN-13 : 9781839218262
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 154.97
Learn Ethereum
€53.99
Mastering Blockchain
€67.99
Mastering Blockchain Programming with Solidity
€32.99
Total 154.97 Stars icon

Table of Contents

20 Chapters
Section 1: Getting Started with Blockchain, Ethereum, and Solidity Chevron down icon Chevron up icon
Introduction to Blockchain Chevron down icon Chevron up icon
Getting Started with Solidity Chevron down icon Chevron up icon
Control Structures and Contracts Chevron down icon Chevron up icon
Section 2: Deep Dive into Development Tools Chevron down icon Chevron up icon
Learning MetaMask and Remix Chevron down icon Chevron up icon
Using Ganache and the Truffle Framework Chevron down icon Chevron up icon
Taking Advantage of Code Quality Tools Chevron down icon Chevron up icon
Section 3: Mastering ERC Standards and Libraries Chevron down icon Chevron up icon
ERC20 Token Standard Chevron down icon Chevron up icon
ERC721 Non-Fungible Token Standard Chevron down icon Chevron up icon
Deep Dive into the OpenZeppelin Library Chevron down icon Chevron up icon
Using Multisig Wallets Chevron down icon Chevron up icon
Upgradable Contracts Using ZeppelinOS Chevron down icon Chevron up icon
Building Your Own Token Chevron down icon Chevron up icon
Section 4: Design Patterns and Best Practices Chevron down icon Chevron up icon
Solidity Design Patterns Chevron down icon Chevron up icon
Tips, Tricks, and Security Best Practices Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Most Recent
Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.9
(8 Ratings)
5 star 37.5%
4 star 0%
3 star 12.5%
2 star 12.5%
1 star 37.5%
Filter icon Filter
Most Recent

Filter reviews by




corey magin Jan 31, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
For the discount, the book is in amazing condition.
Amazon Verified review Amazon
RD May 24, 2022
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
The book is already way outdated but that's not the real problem, nor is the confusing language, nor the random bits of information that are randomly introduced (without sufficient explanation) at odd times in places where they are not relevant to the topic. The very first rule of publishing a technical book should be not to include any long code the reader should not understand yet at that point, without explaining the code in detail. Pages 64-66 are full of code but the author is like, "look here at these lines in bold" to understand the concept, but those lines are meaningless without the non-bold lines. Trying to read the whole contract is an exercise in frustration because you lack the knowledge at this point, and really what you want is someone to walk you through it. I'm trying to become an expert on Smart Contracts. So do I go further on in the book without understanding the example, or do I spend more time on it than the hour I have already spent? No, I trashed this book and fell back on the Solidity docs online. The last thing I need when learning something new is an confusing book with confusing examples and a lot irrelevant and out of place information everywhere. I could give more examples but this was the one that got me, right in chapter 2. I pride myself on my ability to read poorly-written technical books, so I view my frustrations here as the author's failure.EDIT: Another thing I've realized is that the book often describes topics by mentioning other topics that haven't been explained. For example, in Chapter 2 there are that are described as producing packed bytes. The book mentions packed data multiple times but never explains or defines it, so all you can really do is ignore what they're saying. And then in some cases they give textbook definitions of things that a beginner wouldn't understand, and then they're like "here is an example of how to use it." But the example they give really doesn't give you any idea how or why it would be used. Ultimately, if these things were cut out of the book entirely it would not change the amount of usable information contained in the book, but it would be much easier to read. This is one of those books where it takes FOREVER to get through a section because you're trying really hard to actually understand it, and half the time when you've completed the section you didn't really learn anything at all.EDIT 2: I'm changing my review to one star. There are obvious bugs that are guaranteed to confuse people and waste their time. In Ch. 3 there is an example for child contracts, where the function to create a child contract returns an address. However, in the code it returns a ChildContract type. So this launched me on a search (outside of the book) to figure out why a ChildContract is (or returns) an address. I was going to ask some devs, so I looked for the codebase on Github to show them the example, and I found it. Interestingly, in the same code on Github, that error is not present. So it seems the author is correcting these errors for a future edition. I only wish the author had tested his code a bit and maybe had someone else take a look at this edition before it was published. I wonder how much of my other difficulty wading through the book was due to small errors that I wasn't knowledgeable enough to catch. This poor editing of technical books is becoming the norm in the industry for some reason, even though these kinds of books make a lot of money and absolutely need to be accurate.
Amazon Verified review Amazon
kagaya Jan 03, 2022
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
sample codes in this book using -> pragma solidity 0.5.3That's pretty old, and library talked in this book like openzeppelin which current name openzeppelin-contracts is too old.So basically you need to learn by yourself with the newest documents github, after that you are able to know what changed.It's a good book to get the knowledge for ethereum in a certain degree, but not to do code work practically.
Amazon Verified review Amazon
nadtech Dec 15, 2021
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Poor and incomplete explanations and solidity version is too old. Looks like book was put together too hastily and the the editor did not do a good review or wasn't technical. Going to buy a different book after being frustrated with the first 135 pages.
Amazon Verified review Amazon
Ryan G. Aug 13, 2021
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Alright book. Several lazy/sloppy mistakes, including nonsensical sentences that were just not reviewed prior to publishing. The content is decent, but presented in a very interesting or compelling way. I'd suggest just following online tutorials over buying...
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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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