Security Tokens and Stablecoins Quick Start Guide
eBook - ePub

Security Tokens and Stablecoins Quick Start Guide

Learn how to build STO and stablecoin decentralized applications

  1. 234 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Security Tokens and Stablecoins Quick Start Guide

Learn how to build STO and stablecoin decentralized applications

Book details
Book preview
Table of contents
Citations

About This Book

A complete guide to understanding, developing, and testing popular security-token smart contracts

Key Features

  • 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

Book 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.

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

Who this book is 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.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Security Tokens and Stablecoins Quick Start Guide by Weimin Sun, Xun (Brian) Wu, Angela Kwok in PDF and/or ePUB format, as well as other popular books in Computer Science & Data Processing. We have over one million books available in our catalogue for you to explore.

Information

Year
2019
ISBN
9781838552640
Edition
1

Building a Security Token Dapp

In the previous chapter, Chapter 5, Security Token Smart Contracts, we learned about the popular security token standards and an overview of the basic Solidity smart contract language. We should be quite comfortable with the fundamentals of the security token smart contract. In this chapter, we are going to write a security token smart contract and build a Dapp. We will be utilizing the Truffle development tool to help develop, test, debug, and deploy our security token Dapp.
This chapter is organized around five major topics, as follows:
  • Security token offerings (STO) smart contract development tools
  • Setting up an Ethereum development environment
  • Creating a security token Truffle project
  • Developing and testing a security token smart contract
  • Writing Dapp web components

STO smart contract development tools

There are many popular smart contract tools available; in our STO sample contract, we chose Truffle and Ganache as our development environment tools. Truffle is one of the most popular Solidity Dapp development tools. Ganache provides you with a private Ethereum blockchain environment locally, which is very easy to set up.

Truffle

Truffle is a popular Ethereum development tool that provides a development environment, testing framework, and much other easy-to-use toolsets to make Ethereum development easier. With Truffle, you can have a compiled smart contract and automated smart contract testing with Mocha and Chai. The configuration supports deploying contracts to the local and public network.
You can write HTML, CSS, and JavaScript for the frontend; the web UI uses the web3.js API to interact with the smart contract in the Ethereum blockchain. Truffle Boxes provide helpful boilerplates, which contain useful configuration, JavaScript, Solidity contracts, libraries, and many other helpful files. The boxes help developers quickly set up and get started with their Dapp project.
The truffle command line uses the following format:
truffle [command] [options]
Here are the most frequently used options in command-line tools:
Command
Description
compile
Compile Solidity contract files
console
Command-line interface to interact with deployed smart contract
create
This command helps to create a new contract, new migration file, and a basic test
test
Run solidity smart contract tests
deploy/migration
Deploy contract to blockchain network
develop
Interact with a contract via the command line in a local development environment
init
Install a package from the Ethereum package registry

Ganache

Ganache is a private Ethereum blockchain environment that emulates the Ethereum network so that you can deploy and interact with smart contracts in your private blockchain. Here are some features that Ganache provides:
  • Displays blockchain log output
  • Provides advanced mining control
  • Built-in block explorer
  • Ethereum blockchain environment
  • Comes with a desktop application, as well as a command-line tool
Here is what the desktop version of Ganache looks like:
The command line uses the following format:
ganache-cli <options>
Here are some frequently used options in command-line tools:
Options
Description
-a or --accounts
How many accounts to generate at startup.
-e or --defaultBalanceEther
Configures the default test account ether amount; the default is 100.
-b or --blockTime
Specifies the block time in seconds as the mining interval. If this option is not specified, Ganache will instantly mine a new block when a transaction is invoked.
-h or --host or --hostname
Specifies the hostname to listen on; the default is 127.0.0.1.
-p or --port
Specifies the port number; the default is 8545.
-g or --gasPrice
Specifies the gas price in Wei (defaults to 20000000000).
-l or --gasLimit
The block gas limit (defaults to 0x6691b7).
--debug
Displays VM opcodes for debugging purposes.
-q or --quiet
Runs ganache-cli without any logs.

Setting up an Ethereum development environment

We just learned the basics of the Truffle and Ganache development tools. It is time to set up our development environment using the tools we mentioned previously.
Make sure you have installed Node.js and npm in your working environment. If you haven't set them up, please follow the official documentation, which is available at https://www.npmjs.com/get-npm.
We will install the following tools. This book's example runs in a Windows environment:
  • Installing Truffle: Open the command-line terminal window and run the following command:
npm install -g [email protected]
  • Installing Ganache: Open the command-line terminal and install Ganache's command-line interface:
npm install -g ganache-cli
  • Launching Ganache environment: Once Ganache is installed, verify and start Ganache by running the following command:
ganache-cli
You should see something like this in your console:
This will run ganache-cli on 8545 port; Ganache will create 10 default accounts for us. Each account will have 100 ether by default.

Creating a security token Truffle project

In this chapter, we will build ERC-1404—a Simple Restricted Token Standard (SRTS). We will utilize extendable standard code provided by https://erc1404.org/ to start our security token development based on the ERC-1404 standard. Here are the steps to start our security token development:
  1. Run the following command to download the project template:
git clone https://github.com/PacktPublishing/Security-Tokens-and-Stablecoins-Quick-Start-Guide.git
  1. Navigate to the simple-restricted-token project folder; you should see the following prebuild project structure:
  1. Install node libraries on the project root folder:
npm install
This will install project node dependencies.
  1. Update the truffle.js file configuration.
Since our Ganache runs on port 8545, we need to update the truffle.js file configuration to connect to the Ganache server.
Open truffle.js, and ...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. About Packt
  4. Contributors
  5. Preface
  6. Introduction to Blockchain
  7. STO - Security Token Offering
  8. Monetizing Digital Tokens Under US Security Laws
  9. Stablecoin
  10. Security Token Smart Contracts
  11. Building a Security Token Dapp
  12. Stablecoin Smart Contracts
  13. Other Books You May Enjoy