Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Security Tokens and Stablecoins Quick Start Guide
Security Tokens and Stablecoins Quick Start Guide

Security Tokens and Stablecoins Quick Start Guide: Learn how to build STO and stablecoin decentralized applications

Arrow left icon
Profile Icon Sun Profile Icon Angela Kwok Profile Icon Xun (Brian) Wu
Arrow right icon
$32.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (2 Ratings)
Paperback Apr 2019 234 pages 1st Edition
eBook
$15.99 $22.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Sun Profile Icon Angela Kwok Profile Icon Xun (Brian) Wu
Arrow right icon
$32.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (2 Ratings)
Paperback Apr 2019 234 pages 1st Edition
eBook
$15.99 $22.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$15.99 $22.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.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

Security Tokens and Stablecoins Quick Start Guide

Introduction to Blockchain

In this chapter, we give an overview of blockchain technology, along with its key concepts, such as the distributed ledger, transactions, blocks, proof of work, mining, consensus, and so on. We will cover bitcoin, the mother of blockchain technology, and Ethereum, which was developed out of bitcoin, in detail. We will then proceed to the discussion of initial coin offerings (ICOs) and security token offerings (STOs) in Chapter 2, STO – Security Token Offering. Chapter 3, Monetizing Digital Tokens Under US Security Laws, is dedicated to STO-related laws and regulations. We will cover the basics on stablecoins in Chapter 4, Stablecoin. Chapter 5, Security Token Smart Contracts, and Chapter 6, Building a Security Token Dapp, demonstrate how to build frontend and backend applications to issue security tokens, along with examples. The last two chapters talk about how to build a stablecoins frontend and backend applications.

In this chapter, we cover the following specific topics:

  • A brief overview of the blockchain technology
  • Bitcoin basics
  • Ethereum basics
  • Miscellaneous comments

A brief overview of the blockchain technology

In October 2008, Satoshi Nakamoto published a landmark white paper titled Bitcoin: A Peer-to-Peer Electronic Cash System. Although the true identity of Satoshi has not been ;revealed, this paper triggered a gold rush to cryptocurrency and led to the birth of a new technology—blockchain. While the initial rush to cryptocurrency has suffered a severe setback due to dramatically descending prices of main cryptocurrencies such as BTC (bitcoin), XRP (Ripple), and ether (Ethereum), blockchain as a technology is alive. Numerous blockchain projects are being worked on worldwide. The technology will fundamentally change the way most businesses will be conducted and how people will live. ICOs, a primary fundraising method used in the cryptocurrency and blockchain world, have played the main role in this gold rush, driving up the BTC's price to an unprecedented level, by over USD 19,000 in December, 2017. The cryptocurrency bubble burst in late 2018 as BTC's price crashed. It is below $4,000 as of January, 2019. The dramatic drop in price of the main cryptocurrencies led to the death of ICOs.

It is not coincidental that the ICO bubble burst. A similar event occurred in the financial world over ten years ago—the 2008 financial crisis. The primary reason for the 2008 crisis was the lack of control in lending standards, resulting in the issuances of many loans to unqualified borrowers. The loans were then packaged via a financial-engineering process called securitization, and sold to unsuspecting investors worldwide. When enough borrowers started to default on their mortgages, a worldwide financial crisis broke out. The ICO fundraising model is fundamentally flawed in its lack of control on many of the proposed projects, for which funds were raised. Via an ICO, an entrepreneur can raise tens of millions of US dollars within minutes without a real product or even a company! All it has is a white paper, sometimes only a few pages long. To address the issues of ICOs and support the blockchain industry's future growth, the blockchain community has proposed and promoted the STO idea. STO has attracted a lot of attention and it is expected to play a promising role in the replacement of ICOs.

Bitcoin

In his paper, Satoshi Nakamoto pioneered a way to integrate several key ingredients and develop an electronic payment application. This application offers a more efficient and low-cost solution to fulfill a payment through the removal of intermediaries. These key ingredients include digital money, encryption, decentralization, consensus mechanism, chained blocks, and a peer-to-peer network. Many people responded to Satoshi's idea. They formed the core team to implement the idea.

In January 2009, Satoshi Nakamoto released the first software and blockchain platform. This blockchain platform is referred to as bitcoin, which minted the first coins of the bitcoin cryptocurrency—BTC coins. Many of the key ingredients have evolved. Satoshi's main contribution is to put them together to address the pain points of the existing business model, such as high cost and long execution time for facilitating cross-border payments.

When relying on an existing business solution, it usually takes three days to complete a cross-border payment transaction. With Satoshi's proposed solution or its variations, it takes a few minutes or seconds to finish the same transaction at a tiny fraction of the costs of non-blockchain-based solutions.

For the rest of our discussions, we will use the term blockchain industry to refer to both cryptocurrency and blockchain technology. The word blockchain refers to a sequence of encrypted blocks chained linearly. Bitcoin's platform shares many of the same characteristics as a genealogy tree. They are summarized as follows:

  • Like a clan consisting of many related families, a blockchain network (a clan) consists of nodes. Each node is like a family.
  • While every family keeps a copy of the clan's genealogy, each bitcoin node maintains a copy of all transactions that occurred on the chain, starting from the very beginning. The collection of all these transactions is a distributed ledger. Since every node keeps a copy of the ledger, blockchain is essentially a decentralized data repository.
  • A genealogy starts with a common ancestor of the clan. The ancestor has offspring. The equivalent of a common ancestor is called the genesis block. The genesis block is followed by one child block, which, in turn, is followed by its own child block, and so on. The collection of all blocks is the blockchain (or in business terms, the ledger). Each block contains one or multiple transactions.
  • Adding a new name to a genealogy requires a consensus of families within a clan. Similarly, bitcoin relies on a consensus mechanism to decide whether a newly built block is valid, and can be added to the chain.
  • Like a genealogy, after a block is added to a chain, it is difficult to change. This is the immutability feature of bitcoin.
  • Genealogy provides transparency regarding a clan's history. Similarly, a blockchain allows a user to query the ledger on BTC transactions. This is bitcoin's transparency feature.

The bitcoin blockchain design is restricted to resolve one specific business problem—the cash payment. Its value is therefore limited. A generic blockchain platform, called Ethereum, is then implemented by adding new ingredients such as smart contracts, as well as generic programming languages.

Ethereum

As is being pointed out, bitcoin has shortcomings, such as the following:

  • Bitcoin serves a specific purpose—cash payment.
  • Bitcoin's scripting language is not Turing complete; for example, it has no looping statement, and so on. Here, the Turing completeness refers to the ability of a programming language to resolve any computational problems.
  • Bitcoin does not have a state. Consequently, to answer a question such as What is the total number of minted BTCs?, you have to search the entire ledger.

To address these issues, Vitalik Buterin, a Canadian cryptocurrency researcher and programmer, proposed the idea of Ethereum in late 2013. Funded by an online crowdfunding sale—an ICO—the system went live on July 30, 2015, with 11.9 million coins premined for the crowdsale.

The core idea for Ethereum is to implement a general purpose blockchain. With that, users can address a wide range of business problems. Ethereum introduced a few key concepts:

  • A Turing complete programming language, such as Solidity.
  • Smart contracts, which define business logic and are deployed on the blockchain—every node maintains and runs the same code at almost the same time. Thus, smart contracts are immutable and are guaranteed to be executed and yield the same outcomes.

The idea of Solidity was initially proposed in August 2014 by Gavin Wood. The Ethereum project's Solidity team led by Christian Reitwiessner later developed the language. It is one of the four languages (Solidity, Serpent, Lisp Like Language (LLL), Viper, and Mutan) that was designed for Ethereum virtual machine (EVM).

The introduction of the smart contract concept, along with others, has significant implications:

  • A smart contract is a scripted legal document, since it is immutable and enforceable.
  • The code built into the contract is stored on the Ethereum blockchain and cannot be tampered with or removed. This makes the scripted legal document credible.
  • After being triggered, smart contracts cannot be stopped, meaning no one can easily influence the running code. As long as triggering conditions are met, the code will be guaranteed to run and the legally defined actions will be fulfilled.
  • Ethereum to blockchain is like an OS to a computer. In other words, the Ethereum is a general purpose platform.
  • It now has a Turing complete language—Solidity.

Bitcoin and Ethereum, along with many of their variations, are collectively called public blockchain, since they are open to everyone who is interested in participating in the network. No approval is required. Public blockchains cannot satisfy the needs of many companies. As per these firms' business models, a participant has to receive approval before being authorized to join a network. To satisfy their needs, private blockchain platforms are implemented by modifying public blockchain platforms such as Ethereum and adding an authorization and entitlement component.

Since the membership of a private blockchain network is tightly controlled, several things can be simplified. For example, the consensus algorithm is simplified. Consequently, a primary blockchain platform has much better performance. Also, a private blockchain does not require that you issue a coin so that it gets its work done. Hyperledger is a well-known private blockchain. It is also referred to as an enterprise blockchain.

Ethereum greatly expanded the blockchain technology's capabilities. However, there are many scenarios where Ethereum is not enough, as we just pointed out. The issues of Ethereum are restated here:

  • Enterprise applications, for example, credit card transactions, require high-performance, as there are potentially billions of transactions a day. The current form of Ethereum has a maximum capacity of handling around 1.4 million transactions a day. Bitcoin is even worse: 300,000 transactions a day.
  • Many financial markets, for instance, over-the-counter (OTC) derivatives or foreign exchange contracts, are permission-based. A public blockchain supported by Ethereum or bitcoin does not satisfy such a need.

Big companies across industries are addressing these issues. They form consortia to work on enterprise blockchain projects. With a permission-based enterprise blockchain network, a node has to receive approval before it can join the network. Hyperledger is one of them.

The Linux Foundation (LF) created the Hyperledger project in December 2015. Its objective is to advance cross-industry collaboration by developing blockchains and distributed ledgers. On July 12, 2017, the project announced its production-ready Hyperledger Fabric (HF) 1.0.

Currently, Hyperledger includes five blockchain frameworks:

  • HF: A private blockchain, initially contributed by IBM and Digital Asset, is designed to be a foundation for developing applications or solutions with a modular architecture. It takes plugin components to provide functionalities such as consensus and membership services. Like Ethereum, HF can host and execute smart contracts. However, HF uses the term chaincode instead of smart contract. An HF network consists of peer nodes, which execute smart contracts (chaincode), query ledger data, validate transactions, and interact with applications. Transactions entered by users are channeled to an ordering-service component, which essentially serves to be HF's consensus mechanism. Special nodes called orderer nodes validate the transactions and ensure the consistency of the blockchain and send the validated transactions to peer nodes, as well as to Membership Service Provider (MSP) services. MSP is the certificate authority.
  • Hyperledger Iroha: Based on HF, it is designed for mobile applications. Iroha was contributed by Soramitsu, Hitachi, NTT Data, and Colu. It implemented a consensus algorithm called Sumeragi.
  • Hyperledger Burrow: Contributed initially by Monax and Intel, Burrow is a modular blockchain that was client-built to follow EVM specifications.
  • Hyperledger Sawtooth: Contributed to by Intel, it implemented a consensus algorithm called Proof of Elapsed Time (PoET). PoET was invented by Intel and is designed to achieve distributed consensus as efficiently as possible. Sawtooth supports both permissioned and permissionless networks. Sawtooth is designed for versatility.
  • Hyperledger Indy: Initially contributed by the Sovrin Foundation, it is to support independent identity on distributed ledgers. Indy provides tools, libraries, and reusable components to support digital identities.

Evolution of blockchain

The blockchain technology is still in its early stages. It may take many years before it becomes mature and its potential has been fully explored. At the moment, there is no universally agreed way to classify generations for the technology.

In her book on blockchain, Melanie Swan defined blockchain 1.0 – 3.0. According to her view, these phases can be described as follows:

  • Blockchain 1.0 refers to the cryptocurrency phase. During this phase, the blockchain applications focus mainly on cash payment, such as currency transfer, remittance, and digital payment systems.
  • Blockchain 2.0 refers to the smart contract phase. During this phase, the blockchain applications focus in certain areas of the financial industry, for example, currency, financing, and security markets.
  • Blockchain 3.0 refers to the blockchain technology being applied to areas beyond currency, financing, and security markets. For example, blockchain technology is utilized in areas such as non-profit organization causes, the health industry, the supply chain, manufacturing activities, and so on.

Some others divided the blockchain evolution into four generations:

  • Blockchain 1.0: Bitcoin is the most prominent example. Financial transactions are executed based on distributed ledger technology (DLT). Cryptocurrency is used as cash for the internet.
  • Blockchain 2.0: Ethereum is the most prominent example. The key concept is smart contracts, which are stored and executed on a blockchain.
  • Blockchain 3.0: The keyword is Dapps (decentralized applications). Dapps use decentralized storage and decentralized communication. Unlike a smart contract, which only involves a backend or server-side code, a Dapp can have a frontend code, also called client-side code, for example, user interfaces, to interact with its backend code in a blockchain. In summary, Dapp is a frontend and has smart contracts.
  • Blockchain 4.0: Blockchain platforms are being built to serve Industry 4.0. Industry 4.0 refers to automation, enterprise resource planning, and the integration of different execution systems.

Regardless of how the generations are defined, it is certain that the growth of this technology is far from over. New ideas and implementations will be incorporated into the existing platforms to deal with challenges from real-life problems. In other words, blockchain technology will be nimble and is self-adjusted to be an enabler in resolving business problems.

Issuing a cryptocurrency or a token is more relevant to public blockchains. In the next two sections, we discuss bitcoin and Ethereum in detail.

Bitcoin basics

The bitcoin platform is a peer-to-peer network. It connects computers around the world. Each computer is a node with equal status, except for a subset of nodes called miners. Mining nodes play the role of collecting/validating transactions, creating a new block, and adding a validated block to the blockchain. A transaction refers to an action such as issuing bitcoin or transferring BTC from one address to another, and so on.

A peer-to-peer network can connect worldwide nodes and allow participants to trade with one another. However, the physical connection is not enough to make two untrusting parties trade with each other. To make them trade, bitcoin takes the following measures:

  • Every node saves a complete copy of the ledger. Thus, any alteration to a transaction on the chain becomes practically not feasible.
  • Transactions are grouped into blocks. A non-genesis block is linked to its previous block by storing that block's hash. Consequently, a change to a transaction requires changes to be made to all subsequent blocks, and these changes have to be repeated on all nodes where a copy of the ledger is saved. This clever design makes hacking the distributed ledger extremely difficult.
  • Bitcoin built in a consensus mechanism to address the double-spending issue; that is, the same BTC is spent twice.
  • Hashes are extensively used to protect identities of parties, and to detect any changes that are occurring in a block.
  • It uses public/private keys and addresses to mask identities of trading parties.
  • Signs a transaction digitally.

With these measures, untrusting parties feel comfortable to trade because of the following reasons:

  • The transaction is immutable and permanent. Neither party can nullify a transaction unilaterally.
  • No double-spending is possible.
  • Transaction and settlement occur simultaneously; therefore, there is no settlement risk.
  • Identities are protected.
  • Transactions are signed by both parties, which minimizes the possibility of legal disputes in the future.

The distributed ledger

At a financial institution, the ledger is the principal book for recording all financial transactions. Bitcoin maintains a ledger for bookkeeping transactions of coins and other transactions. The difference is that a bank's ledger is centralized, and bitcoin's ledger is distributed. Consequently, a bank's ledger is at risk of being manipulated for nefarious purposes, that is, cooking the book. On the other hand, bitcoin's ledger is very difficult to be changed.

Blockchain's ledger consists of entries resulting from transactions entered by users, where users submit transactions. Each transaction contains the following information:

  • Sources (from the address) of the coins to be transferred from
  • The number of coins to be transferred
  • Destinations (send-to address) where coins should be transferred to

Both source and destination addresses are 64-character hashes. Here is an example:

979e6b063b436438105895939f4ff13d068428d2f71312cf5594c132905bfxy1

An address is like a customer's bank account number. However, there are fundamental differences between them. For example, a bank has a centralized place for saving metadata on an account, for example, the customer name, account open date, and account type, and so on. Also, the balance of an account is calculated and saved. A bitcoin address does not have metadata and maintains no balance. Addresses are referred to only in bitcoin transactions. When an address does not contain any unused coins, a new request for transferring a coin from the address will fail a transaction validation due to an insufficient fund error.

A bitcoin coin does not associate with a physical object such as a file or a physical coin. Only transactions and addresses support its existence. For example, if you want to know the total number of coins that have been minted so far, you have to go through all addresses with unused coins and add them up.

When a user enters a transaction request at a node, bitcoin software installed at the node broadcasts the transaction to all nodes. Nodes on the network will validate the transaction by retrieving all historical transactions containing the input addresses and ensuring that coins that are transferred out from these addresses are legitimate and sufficient. After that, the mining nodes start to construct a block by collecting the validated transactions. Normally, one block contains between 1,500 and 2,000 transactions. If a miner wins a race for resolving a difficult puzzle, the miner gets the role for adding the new block to the blockchain. Bitcoin takes approximately every 10 minutes to add a new block.

A bitcoin blockchain can diverge due to protocol change, software upgrade, or fixing hacked blocks. The splitting point where the divergence starts is called a fork. There are temporary forks and permanent forks. If a permanent fork occurs due to, for example, malicious attacks, it is called a hard fork. If a permanent fork occurs due to configuration or a software upgrade, it is called a soft fork. A hard fork makes previously invalid blocks/transactions valid, and a soft fork makes previously valid blocks/transactions invalid.

The consensus mechanism

The double-spending issue refers to the act of using the same coin more than once. If this problem is not resolved, a bitcoin coin loses its scarcity. Scarcity is a key feature of a currency. Without it, the coin can no longer be called a cryptocurrency. The consensus mechanism is designed for resolving the double-spending problem. To understand how the mechanism works, you need to know the concepts of proof of work (PoW) and mining.

As we learned earlier, a miner has to solve a mathematical puzzle ahead of other miners to receive the role of being a builder of the next block and receive an award for doing the work. The work of resolving the mathematical problem is called the PoW. The mathematical problem itself does not have a value. The main purpose is to give a sufficient window of time to miners validating transactions. This window of waiting time is maintained at 10 minutes. A miner can query its copy of the distributed ledger and validate the following facts:

  • The requester of a transaction has the coins
  • Any other transactions in the ledger have not spent the same coins
  • Other transactions within the candidate block do not spend the same coins

The process of repeatedly guessing an answer to the puzzle is called mining. Hardware that is manufactured and dedicated to the mining work is called a mining rig.

As per bitcoin protocol, mining is the only way to issue a new coin. Rewarding a miner serves several purposes:

  • Compensates a miner's investments on hardware
  • Covers mining operation costs such as utility bills, human salaries, site rentals, and so on
  • Gives miners incentives to safeguard the network from being attacked by malicious hackers

The total number of mintable bitcoin coins is fixed at 21 million. Currently (January 2019), close to 17.5 million coins have been issued. The bitcoin protocol defines a rule for dynamically adjusting the payout rate to the mining work, and the remaining 3.5 million coins will need another 122 years to be mined completely.

The mining payout rate is dynamically adjusted and follows the following rule:

The rate changes at every 210,000 blocks. It is a function of the block height on the chain with genesis=0, and is calculated using 64-bit integer operations as (50 * 100,000,000) >> (height / 210,000). The rate that initially started with 50 coins has fallen to 25 coins at block 210,000. It fell to 12.5 coins at block 420,000 and will eventually go down to 0 when the network reaches the size of 6,930,000 blocks.

Bitcoin adjusts the difficulty level of the puzzle for maintaining the 10-minute window. Based on the most recent rate of a new block being added, the difficulty level is calculated or adjusted accordingly. If the average rate of new blocks being added is fewer than ten minutes, the difficulty level will be increased. If the average rate takes more than ten minutes, it's decreased. The difficulty level is updated every 2,016 blocks.

With the relevant concepts being explained, we are ready to talk about the mining steps. For illustration purposes, we assume that the mathematical puzzle is to find the first hash value whose first character is 0 in order to maintain the 10-minute per new block window. Per the bitcoin protocol, a miner follows these steps to solve the puzzle:

  1. First, obtain the SHA-256 hash of a block in construction.
  2. If the resulted hash has a leading 0, the miner solves the puzzle. The miner adds the block to his/her copy of the distributed ledger on the node and claims the coin rewards. The winner broadcasts the news to other nodes. Other miners of the network check the answer and validate that the new block contains valid transactions.
  3. If passing the checks, all nodes on the network add the block to their copies of the ledger. Miners start to work on the next block.
  4. If the winner is a hacker and includes bad transactions such as double-spending a coin, the validation on transactions will fail. Other miners will not include the block in their ledger copies. They will continue to mine on the current block. As time passes, the path containing the bad block will no longer be the longest path. Per bitcoin protocol, the longest path is considered to be the blockchain and should be copied by all nodes. In other words, the path containing the bad block becomes an orphan, and will eventually be dropped. This is essentially how all nodes on the network reach a consensus to add only good blocks to the blockchain and prevent bad blocks from being included.
  1. If the resulted hash does not start with 0, per protocol, a miner adds a sequence number, known to be a nonce, starting from 0 at the end of the input text and retries the hash.
  2. If a resulted hash still does not contain a leading 0, change the nonce to 1, and obtain a new hash. Repeat the steps until a miner finds a new hash with a leading zero.

The following is a hypothetical example. The original plaintext is input string and a nonce varying from 0 to 3. Their corresponding SHA-256 hashes are as follows:

  • input string: f23f4781d6814ebe349c6b230c1f700714f4f70f735022bd4b1fb69421859993
  • input string0: 5db70bb3ae36e5b87415c1c9399100bc60f2068a2b0ec04536e92ad2598b6bbb
  • input string1: 5d0a0f2c69b88343ba44d64168b350ef62ce4e0da73044557bff451fd5df6e96
  • input string2: 7b8fe11e193f835e37301f20416c76c9cd55d962a5ad009f4302ee2607ba8d1a
  • input string3: c37e5a2e94575060277e3b1abf9d3ebbe44274e72bb86f2a526266c9c5aa3722

The algorithm for adjusting the difficulty level is to change the required number of leading 0s, along with some minor tuning. Requiring additional leading 0s will increase the average trying times, and therefore the difficulty level is higher. The current bitcoin difficulty level is 18 leading 0s to maintain the 10 minute window.

Keys and digital wallets

When a bitcoin address is created, a pair of public and private keys are generated as well. The public key is made known to the public, and the address owner keeps the private key. To spend coins associated with the address, the owner provides a digital signature that's generated with the private key and sends a transaction request to the network. In other words, you have to pose both the address and the private key to spend the corresponding coins.

If an owner loses the address and the private key, the person then permanently loses the coins. Hence, it is important to save the information at a secured place. Digital wallets are available for assisting users in managing public/private keys and addresses. You can use a wallet to do the following:

  • Generate addresses and their corresponding public/private keys
  • Save and organize information such as keys, addresses, coins owned, and so on
  • Send a transaction request to the bitcoin network

A private key is a 256-bit long hash, and a public key is 512-bit long.

They can be converted into shorter lengths in hexadecimal representation. The following screenshot is a pair of sample public/private keys, along with an address:

A private key can also be expressed in a string of 51 characters starting with a 5 and a public key in a string of 72 characters. Here are some examples:

private key:
5Jd54v5mVLvyRsjDGTFbTZFGvwLosYKayRosbLYMxZFBLfEpXnp;
public key: BFCDB2DCE28D959F2815B16F81798483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68

Ethereum basics

Ethereum was developed on top of the bitcoin blockchain and shares many key features, such as the distributed ledger and PoW, and so on. However, Ethereum introduces new and critical ingredients. In this section, we will cover them, along with other useful facts.

Ethereum cryptocurrency and tokens

Ether is Ethereum's native cryptocurrency. In other words, ether to Ethereum is like BTC to bitcoin. Due to the forking for handling a hacking event in 2016, two competing Ethereum coins were generated, and both are currently traded at cryptocurrency markets. Their symbols are Ethereum (ETH) and Ethereum Classic (ETC). ETH is priced a lot higher than ETC.

Unlike BTC (that has only one denomination but can be divided into fractions), ether has many denominations. An ether is the biggest unit. The smallest unit is a Wei, named after a digital money pioneer, Wei Dai. Wei invented B-money. Other units include a Gwei, microether, and milliether. They are known by other names as well. For example, a milliether is also called Finney, named after another digital money pioneer, Harold Thomas Finney II, who in 2004 implemented the world's first cryptocurrency, reusable proofs of work (RPOW) before bitcoin. The following table lists conversion rates between ether and other units:

In addition to the native cryptocurrency, Ethereum allows users to issue their tokens. The issuance of a customized token needs to follow predefined technical standards. One well-known standard is the ERC-20 token. ERC refers to Ethereum Request for Comment, and 20 is the number assigned to the request. ERC-20 standard defines a list of rules for issuing ERC-20 tokens. By doing so, it allows for interaction and conversion among Ethereum tokens, and also with Ether. There are many other standards, for example, ERC-223, ERC-721, and so on.

Smart contract

In 1994, Nick Szabo first used the term smart contract. Szabo is a computer scientist and the inventor of Bit Gold. In his blog, Nick Szabo describes it as similar to the vending machine, which is the granddaddy of all smart contracts. A vending machine is built with hard-coded rules that define what actions are to be executed when certain conditions are fulfilled. For example:

  • If Susan inserts a dollar bill, then she will receive a bag of pretzels
  • If Tom inserts a five-dollar bill, then Tom will receive a bag of pretzels and change of four dollars

In other words, rules are defined and enforced by a vending machine physically. Similarly, a smart contract contains rules in program code that are triggered and run on the Ethereum platform when certain conditions are met.

Some important facts about smart contracts are summarized as follows:

  • A smart contract is immutable.
  • A smart contract is permanent.
  • A smart contract is timestamped.
  • A smart contract is globally available.
  • A smart contract is a digitized legal document.
  • A smart contract defines the protocol for facilitating, verifying, or enforcing an agreement among trading parties.
  • Smart contracts allow for the execution of transactions without an intermediary. The transactions are auditable and irreversible.
  • Smart contracts are applicable in many cases.
  • For deploying and running a smart contract, you need to sign it digitally.
  • Smart contract code is visible to everyone. This makes smart contracts vulnerable, as a hacker can tap the flaws in the code and initiate vicious attacks.

Ethereum virtual machine

An Ethereum's smart contract can be developed in one of four languages: Solidity (inspired by JavaScript), Serpent (inspired by Python, and no longer used), LLL (inspired by Lisp), and Mutan (inspired by Go, and no longer used). Since all of them are high-level programming languages, smart contracts need to be compiled into a low-level, machine-runnable language. Ethereum uses a VM approach, similar to the concept of Java Virtual Machine (JVM), to meet this need. The Ethereum erosion of VM is called EVM. Smart contract codes are converted to EVM-runnable bytecodes called opcode. The opcode is then deployed to the Ethereum blockchain for execution. Furthermore, currently, a research-oriented language is under development, called Viper—a strongly-typed Python-based language.

Ethereum gas

An Ethereum transaction can call a smart contract, which can, in turn, call another smart contract and then another, and so on. Thus, an improperly written smart contract may lead to circular calls and result in infinite loops. Stopping a smart contract infinite loop is almost impossible, since thousands of nodes worldwide run the same looping code. To stop the infinite loop, all running nodes need to be shut down within a short time window. Even if one node fails to comply, the infinite loop is still alive. When other nodes are back to the network, the running infinite loop is brought back to these nodes as well. It is a logistical nightmare to coordinate and shut down all nodes worldwide at approximately the same time.

To resolve this issue, the concept of gas was introduced. A vehicle relies on an engine, which depends on gas for energy. If an engine runs out of gas, the vehicle stops. When a transaction is submitted, a requester is required to provide the max gas amount. Each execution step of a smart contract uses a certain amount of gas. An infinite-looping smart contract will eventually lead to the maximum gas amount being used up, and a node will no longer execute the contract. Another advantage of using gas is that it makes hacking prohibitively expensive and, therefore, deters hacking activities.

Gas is a metering unit for measuring consumption just like a kilowatt is the unit for measuring electricity usage. Suppose in a month a family uses 210 KW. Before sending a bill to the family, the utility company first converts 210 KW into US dollars based on a predefined conversion rate. Suppose a unit of KW costs $0.20 USD; the total charge for the month is 0.2 × 210 = $42 USD.

Similarly, gas usage is converted into ether for being charged to a requestor. Ethereum allows a requester to specify the conversion rate when the transaction is submitted. A validator (Ethereum's equivalent to the miner for bitcoin) has the option of giving a preference to transactions with higher rates. If a requester does not specify a rate, EVM uses a default rate, which varies. For example, in 2016, the rate for 1 gas was 0.00001 ETH. In 2018, 1 gas was 0.00000002 ETH.

Account

Unlike bitcoin where the term address is used, Ethereum uses the term account. However, Ethereum accounts can have addresses. That is, for bitcoin, the concepts of account and address are combined into one, while Ethereum separates them. Ethereum supports two types of accounts: externally owned accounts (owned by users who keep private keys of the accounts) and contract accounts.

The key facts about externally controlled accounts are listed as follows:

  • They maintain ether balances
  • They can initiate transactions for either transferring ether coins or triggering smart contracts
  • They are controlled by users via private keys
  • They have no associated smart contract code

Facts about contract accounts are as follows:

  • They keep ether balances
  • They have associated smart contract code
  • Smart contract code execution is triggered by transactions or calls that are received from other contracts

For both types of accounts, they consist of four components:

  • Nonce: For an externally owned account, it refers to the number of transactions sent from the account; for a contract account, it is the number of contracts associated with the account
  • Balance: It is the number of Wei owned by this account
  • StorageRoot: A 256-bit hash of contents of an account
  • CodeHash: The hash of the code of this account in EVM—this is the code that gets executed when the code is called

When ether is transferred from contract accounts to an externally owned account, there is a fee, for example, 21,000 unit of gas. When ether is sent from an externally owned account to a contract account, the fee is usually higher, which depends on the smart contract code and the data being sent along with the transaction.

Ethereum addresses of accounts have the following format:

  • They start with the prefix 0x, a common identifier for hexadecimal, followed by the number string to be constructed by following these steps:
    1. First, take the Keccak-256 hash (big-endian) of the elliptic curve digital signature algorithm (ECDSA) public key
    2. Then, take the last 20 bytes of the hash

Since, in hexadecimal, two digits are stored in one byte, a 20-bytes address is represented with 40 hexadecimal digits. The following is an example of an Ethereum address: 0xe99356bde974bbe08721d77712168fa074279267.

With a browsing tool, you can retrieve Ethereum account balances. For example, you can go to https://www.etherchain.org to obtain the top account balances in ether.

Oracle

Ethereum smart contracts are executed on nodes worldwide. To yield the same outcomes, nodes have to take the same set of inputs. This is called determinism. Ethereum relies on the determinism property validating smart contract outputs. That is, validating nodes have to yield the same results while running the same code. In this sense, the determinism property plays a key role in enabling nodes reaching a consensus.

Maintaining determinism can be a challenging task. On the one side, Ethereum is a general-purpose platform. Its smart contracts require data or inputs from external sources such as the internet. Without access to these sources of information, use cases for smart contracts will be restrictive. On the other side, even with a tiny time difference, validating nodes may retrieve different information from an external source. With different inputs, nodes will end up with different outputs.

Consequently, the determinism property does not hold. For avoiding the issue, smart contracts are not permitted to call an internet URL or pull data from an external source directly. To resolve the paradox, Ethereum relies on Oracle.

A definition of Oracle is as follows:

"A shrine in which a deity reveals hidden knowledge or the divine purpose through such a person."
– Merriam-Webster

In blockchain, oracle refers to the third-party or decentralized data feed services that provide external data. Oracle provides interfaces from the real world to the digital world. Oracle data is not part of blockchain and is available off-chain.

There are different types of oracles. Two of them are software oracles and hardware oracles:

  • Software oracles: This normally refers to easily accessible online information such as stock index prices, FX rates, economic news, weather forecasts, and so on. Software oracles are useful since they provide smart contracts with a wide range of information and up-to-date data.
  • Hardware oracles: This normally refers to scanned information such as UPS delivery scanning, registered mail scanning, supplier goods delivery scanning, and so on. This feed can be useful to activate a smart contract acting on an event's occurrence.

Off-the-chain data

There are multiple scenarios where data cannot be stored on a chain:

  • State variables: Data stored on an Ethereum blockchain is immutable. However, contents of state variables vary as account balances change. A solution is to save them off-the-chain.
  • Oracle: We have just talked about that.
  • Digitized assets: Commonly digitized assets require a large dataset to describe/define them. Given a limited size of blocks, it is not feasible for hosting complete asset information on a chain.
  • Trimmed blocks: For optimization, Ethereum full nodes need to keep a portion of the distributed ledger, that is, to trim a ledger. The trimmed blocks are saved off-the-chain at a centralized location for supporting future inquiries.

PoS

Proof of Stake (PoS) is an algorithm for choosing a validator to build the next block. Per the PoS algorithm, when a validator owns more coins, the validator has a higher chance to be chosen. Compared to PoW, PoS is much more energy efficient and quicker.

A pure PoS will lead to the richest validator being selected frequently, causing a supernode problem, referring to a node validating the majority of the blocks being added to the chain. This obviously will not work. Additional randomness is required to give other validators better chances. Several randomization methods are available:

  • Randomized block selection: Uses a formula to look for the lowest hash value in combination with the size of the stake for selecting a validator.
  • Coin age-based selection: Coins owned long enough, say 30 days, are eligible to compete for the next block. A validator with older and larger sets of coins have a better chance of being granted the role.
  • Delegated PoS: This implementation chooses a limited number of nodes to propose and validate blocks being added to the blockchain.
  • Randomized PoS: Each node is selected randomly using a verifiable random beacon for building the new block.

Ethereum is working on replacing PoW with PoS in future releases.

Performance considerations

Ethereum is inherently slow. The average waiting time for a validator building a block is 17 seconds. It usually requires 12 blocks in depth before a transaction (containing the first block) is confirmed. This is 12 × 17 = 204 seconds or 3.4 minutes of waiting time for a transaction to be confirmed. The 12-blocks-in-depth rule is necessary. When a block is newly added to the blockchain by a validator to its ledger copy, there could be a competing path worked on by other validators. The validator may lose the competition for building the longest blockchain. Per blockchain protocol, the validator has to drop its own block being worked on and add the winning block to its ledger copy. The 12-blocks-in-depth rule assures that a transaction does not end up in a block to be dropped later.

Throughput is a measure of how many units of information a system can process in a given time window. For measuring the performance of a transaction platform, the throughput is expressed in terms of throughput per second (TPS). To calculate Ethereum TPS, we take the approximate number of transactions in a block (using 2,000). Then, we divide it by the waiting time in seconds for a transaction to be confirmed, 204 seconds. So, Ethereum TPS is approximately 9.8, that is, almost 10 transactions per second. By applying the same approach, we can estimate the TPS for bitcoin, which is about 0.5 transaction per second. On the other hand, Visa has a TPS of 2,000 with a peak TPS of 40,000. A high performance database such as VoltDB can handle over a million insertions a second. A stock exchange can match thousands of trades a second. It clearly shows a gap that needs to be closed by the blockchain community.

Ethereum is working on multiple solutions to increase TPS. PoS is worked on as a replacement of the computationally inefficient PoW algorithm. PoS is not fully implemented and upgraded on mainnet due to concerns regarding the emergence of a set of supernodes (which receive an outsized role in building the new blocks). Casper is the Ethereum community's attempt to transiting out of PoW and into PoS. Per Casper protocol, validators set aside a portion of their ether as a stake. When a validator identifies a candidate block, ether is bet on that block by the validator. If the block is indeed added to the chain, the validator is rewarded based on the size of its bet. Validators acting maliciously will be penalized by having their stakes removed.

Led by Vitalik, the Ethereum Foundation is also working on the sharding approach, which is aiming at increasing TPS by 80 times. Sharding splits up the state of the network into multiple shards, where each shard has its transaction history and portion of the network's state.

Another idea to increase TPS is Plasma. Plasma is a technique for conducting off-the-chain transactions while relying on the underlying Ethereum blockchain to provide its security. Therefore, Plasma belongs to the group of off-chain technologies. Truebit is another example of this.

Miscellaneous comments

Ethereum has three main ingredients:

  • Decentralization: For guaranteed execution
  • Hashes: For safeguarding the world state
  • Signature: For authorizing programs and transactions

Some other useful, Ethereum-specific facts are listed as follows:

  • Like a transaction, a digital signature is required for deploying a smart contract. A deployed smart contract is permanent and is immutable.
  • A smart contract is assigned an address. If a smart contract has a bug, the corrected smart contract will be deployed with a newly assigned address, and therefore it is treated as a completely new smart contract. In other words, the corrected contract has no relationship to the old one. Consequently, the history of the old smart contract gets lost.
  • Unlike a full node, a light node does not store the whole distributed ledger, but it stores the parts it cares about from someone it trusts.
  • Since smart contract scripts are stored at nodes worldwide, it provides an additional layer of security.
  • Ethereum provides fault tolerance. As long as at least one full node survives during a catastrophic attack, the network can be rebuilt from the surviving node and grows to a full network.
  • The scalability issue is one of the main criticisms of Ethereum, as all full nodes run the same smart contract code.

Summary

Blockchain is an emerging technology. Thanks to its immutability; transparency; and the consensus mechanism, along with other clever designs such as blocks chained with the hashes of the previous blocks, the technology allows untrusting parties to trade with each other. In this chapter, we explained the basic concepts of two popular public blockchain platforms—bitcoin and Ethereum. Most of the discussions were about bitcoin, which is the mother of the technology. We also talked about Ethereum in detail, which extended bitcoin and introduced the concept of smart contracts. The introduction of smart contracts makes the Ethereum platform generic and allows us to develop applications beyond bitcoin's cash payment use case. The concept of an enterprise blockchain, along with one of the examples, Hyperledger, was mentioned as well. In addition, we briefly touched on the evolution of blockchain to give readers an idea on trends in the blockchain industry.

In the next chapter, Chapter 2, STO – Security Token Offering, we will discuss the concepts of ICO and STO in detail.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand key Blockchain and Ethereum platforms concepts
  • Step-by-step guide to developing STO smart contracts on Ethereum
  • Monetize digital tokens under various U.S. securities laws

Description

The failure of initial coin offerings (ICOs) is no accident, as most ICOs do not link to a real asset and are not regulated. Realizing the shortcomings of ICOs, the blockchain community and potential investors embraced security token offerings (STOs) and stablecoins enthusiastically. In this book, we start with an overview of the blockchain technology along with its basic concepts. We introduce the concept behind STO, and cover the basic requirements for launching a STO and the relevant regulations governing its issuance. We discuss U.S. securities laws development in launching security digital tokens using blockchain technology and show some real use cases. We also explore the process of STO launches and legal considerations. We introduce popular security tokens in the current blockchain space and talk about how to develop a security token DApp, including smart contract development for ERC1404 tokens. Later, you'll learn to build frontend side functionalities to interact with smart contracts. Finally, we discuss stablecoin technical design functionalities for issuing and operating STO tokens by interacting with Ethereum smart contracts. By the end of this book, you will have learned more about STOs and gained a detailed knowledge of building relevant applications—all with the help of practical examples.

Who is this book for?

This book is ideal for blockchain beginners and business user developers who want to quickly master popular Security Token Offerings and stablecoins. Readers will learn how to develop blockchain/digital cryptos, guided by U.S. securities laws and utilizing some real use cases. Prior exposure to an Object-Oriented Programming language such as JavaScript would be an advantage, but is not mandatory.

What you will learn

  • Understand the basic requirements for launching a security token offering
  • Explore various US securities laws governing the offering of security digital tokens
  • Get to grips with the stablecoin concept with the help of use cases
  • Learn how to develop security token decentralized applications
  • Understand the difference between ERC-20 and ERC-721 tokens
  • Learn how to set up a development environment and build security tokens
  • Explore the technical design of stablecoins
Estimated delivery fee Deliver to Turkey

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 30, 2019
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781838551063
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 Turkey

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$34.95
(Includes tracking information)

Product Details

Publication date : Apr 30, 2019
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781838551063
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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
$279.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 $ 130.97
Security Tokens and Stablecoins Quick Start Guide
$32.99
Hands-On Blockchain for Python Developers
$48.99
Blockchain Development for Finance Projects
$48.99
Total $ 130.97 Stars icon

Table of Contents

8 Chapters
Introduction to Blockchain Chevron down icon Chevron up icon
STO - Security Token Offering Chevron down icon Chevron up icon
Monetizing Digital Tokens Under US Security Laws Chevron down icon Chevron up icon
Stablecoin Chevron down icon Chevron up icon
Security Token Smart Contracts Chevron down icon Chevron up icon
Building a Security Token Dapp Chevron down icon Chevron up icon
Stablecoin Smart Contracts 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 Full star icon Full star icon Empty star icon 4
(2 Ratings)
5 star 50%
4 star 0%
3 star 50%
2 star 0%
1 star 0%
Dry golfer Aug 13, 2023
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
All but the last (stablecoin) chapter are very good though books like this should try harder to maintain updated code bases (the testing environment is out of date). It would be nice to have some intuitive descriptions or flow diagrams of standard use cases, or be walked through some of the smart contract source in parallel with what the user(s) are doing.The last chapter is grim. Seems to have been written by a different person. The English is shocking and it's barely more than a list of function interfaces. Very disappointing. Should have an extended example as in the previous chapter. Barely any intuition.
Amazon Verified review Amazon
Mohamed Achraf Oct 04, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Je conseille
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