Building Blockchain Projects

Author: Narayan Prusty  

Publisher: Packt Publishing‎

Publication year: 2017

E-ISBN: 9781787125339

P-ISBN(Paperback): 9781787122147

Subject: TP39 computer application

Language: ENG

Access to resources Favorite

Disclaimer: Any content in publications that violate the sovereignty, the constitution or regulations of the PRC is not accepted or approved by CNPIEC.

Description

Develop real-time practical DApps using Ethereum and JavaScriptAbout This Book• Create powerful, end-to-end applications for Blockchain using Ethereum• Write your first program using the Solidity programming language• Change the way you think and design your applications by using the all new database-BlockchainWho This Book Is ForThis book is for JavaScript developers who now want to create tamper-proof data (and transaction) applications using Blockchain and Ethereum. Those who are interested in cryptocurrencies and the logic and database empowering it will find this book extremely useful.What You Will Learn• Walk through the basics of the Blockchain technology• Implement Blockchain's technology and its features, and see what can be achieved using them• Build DApps using Solidity and Web3.js• Understand the geth command and cryptography• Create Ethereum wallets• Explore consortium blockchainIn DetailBlockchain is a decentralized ledger that maintains a continuously growing list of data records that are secured from tampering and revision. Every user is allowed to connect to the network, send new transactions to it, verify transactions, and create new blocks, making it permission-less.This book will teach you what Blockchain is, how it maintains data integrity, and how to create real-world Blockchain projects using Ethereum. With interesting real-world projects, you will learn how to write smart contracts which run exactly as programmed without any chance of fraud, censorship, or third-party interference, and build end-to-end applications for Blockchain.You will learn about concepts such as cryptography in cryptocurrencies, ether security, mining , smart contracts, solidity, and more. You will also learn about web sockets, various API services for Ethereum, and much more.The blockchain is the main technical innovation of bitcoin, where it serves as the public ledger for bitcoin transactions.Style and approachThis is a project-based guide that not only gets you up and running with Blockchain, but also lets you create intuitive real-world applications that will make you an independent Blockchain developer.

Chapter

What is a DApp?

Advantages of decentralized applications

Disadvantages of decentralized applications

Decentralized autonomous organization

User identity in DApps

User accounts in DApps

Accessing the centralized apps

Internal currency in DApps

Disadvantages of internal currency in DApps

What are permissioned DApps?

Popular DApps

Bitcoin

What is a ledger?

What is blockchain?

Is Bitcoin legal?

Why would someone use Bitcoin?

Ethereum

The Hyperledger project

IPFS

How does it work?

Filecoin

Namecoin

.bit domains

Dash

Decentralized governance and budgeting

Decentralized service

BigChainDB

OpenBazaar

Ripple

Summary

Chapter 2: Understanding How Ethereum Works

Overview of Ethereum

Ethereum accounts

Transactions

Consensus

Timestamp

Nonce

Block time

Forking

Genesis block

Ether denominations

Ethereum virtual machine

Gas

Peer discovery

Whisper and Swarm

Geth

Installing geth

OS X

Ubuntu

Windows

JSON-RPC and JavaScript console

Sub-commands and options

Connecting to the mainnet network

Creating a private network

Creating accounts

Mining

Fast synchronization

Ethereum Wallet

Mist

Weaknesses

Sybil attack

51% attack

Serenity

Payment and state channels

Proof-of-stake and casper

Sharding

Summary

Chapter 3: Writing Smart Contracts

Solidity source files

The structure of a smart contract

Data location

What are the different data types?

Arrays

Strings

Structs

Enums

Mappings

The delete operator

Conversion between elementary types

Using var

Control structures

Creating contracts using the new operator

Exceptions

External function calls

Features of contracts

Visibility

Function modifiers

The fallback function

Inheritance

The super keyword

Abstract contracts

Libraries

Using for

Returning multiple values

Importing other Solidity source files

Globally available variables

Block and transaction properties

Address type related

Contract related

Ether units

Proof of existence, integrity, and ownership contract

Compiling and deploying contracts

Summary

Chapter 4: Getting Started with web3.js

Introduction to web3.js

Importing web3.js

Connecting to nodes

The API structure

BigNumber.js

Unit conversion

Retrieving gas price, balance, and transaction details

Sending ether

Working with contracts

Retrieving and listening to contract events

Building a client for an ownership contract

The project structure

Building the backend

Building the frontend

Testing the client

Summary

Chapter 5: Building a Wallet Service

Difference between online and offline wallets

hooked-web3-provider and ethereumjs-tx libraries

What is a hierarchical deterministic wallet?

Introduction to key derivation functions

Introduction to LightWallet

HD derivation path

Building a wallet service

Prerequisites

Project structure

Building the backend

Building the frontend

Testing

Summary

Chapter 6: Building a Smart Contract Deployment Platform

Calculating a transaction's nonce

Introducing solcjs

Installing solcjs

solcjs APIs

Using a different compiler version

Linking libraries

Updating the ABI

Building a contract deployment platform

The project structure

Building the backend

Building the frontend

Testing

Summary

Chapter 7: Building a Betting App

Introduction to Oraclize

How does it work?

Data sources

Proof of authenticity

Pricing

Getting started with the Oraclize API

Setting the proof type and storage location

Sending queries

Scheduling queries

Custom gas

Callback functions

Parsing helpers

Getting the query price

Encrypting queries

Decrypting the data source

Oraclize web IDE

Working with strings

Building the betting contract

Building a client for the betting contract

Projecting the structure

Building the backend

Building the frontend

Testing the client

Summary

Chapter 8: Building Enterprise Level Smart Contracts

Exploring ethereumjs-testrpc

Installation and usage

The testrpc command-line application

Using ethereumjs-testrpc as a web3 provider or as an HTTP server

Available RPC methods

What are event topics?

Getting started with truffle-contract

Installing and importing truffle-contract

Setting up a testing environment

The truffle-contract API

The contract abstraction API

Creating contract instances

The contract instance API

Introduction to truffle

Installing truffle

Initializing truffle

Compiling contracts

Configuration files

Deploying contracts

Migration files

Writing migrations

Unit testing contracts

Writing tests in JavaScript

Writing tests in Solidity

How to send ether to a test contract

Running tests

Package management

Package management via NPM

Package management via EthPM

Using contracts of packages within your contracts

Using artifacts of packages within your JavaScript code

Accessing a package's contracts deployed addresses in Solidity

Using truffle's console

Running external scripts in truffle's context

Truffle's build pipeline

Running an external command

Running a custom function

Truffle's default builder

Building a client

Truffle's server

Summary

Chapter 9: Building a Consortium Blockchain

What is a consortium blockchain?

What is Proof-of-Authority consensus?

Introduction to parity

Understanding how Aura works

Getting parity running

Installing rust

Linux

OS X

Windows

Downloading, installing and running parity

Creating a private network

Creating accounts

Creating a specification file

Launching nodes

Connecting nodes

Permissioning and privacy

Summary

Index

The users who browse this book also browse


No browse record.