Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Mastering Blockchain
Mastering Blockchain
Credits
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Blockchain 101
Distributed systems
CAP theorem
Byzantine Generals problem
Consensus
Consensus mechanisms
Types of consensus mechanism
The history of blockchain
Electronic cash
The concept of electronic cash
Introduction to blockchain
Various technical definitions of blockchains
Generic elements of a blockchain
Addresses
Transaction
Block
Peer-to-peer network
Scripting or programming language
Virtual machine
State machine
Nodes
Smart contracts
Features of a blockchain
Distributed consensus
Transaction verification
Platforms for smart contracts
Transferring value between peers
Generating cryptocurrency
Smart property
Provider of security
Immutability
Uniqueness
Smart contracts
Applications of blockchain technology
How blockchains accumulate blocks
Tiers of blockchain technology
Blockchain 1.0
Blockchain 2.0
Blockchain 3.0
Generation X (Blockchain X)
Types of blockchain
Public blockchains
Private blockchains
Semi-private blockchains
Sidechains
Permissioned ledger
Distributed ledger
Shared ledger
Fully private and proprietary blockchains
Tokenized blockchains
Tokenless blockchains
Consensus in blockchain
Proof of Work
Proof of Stake
Delegated Proof of Stake
Proof of Elapsed Time
Deposit-based consensus
Proof of importance
Federated consensus or federated Byzantine consensus
Reputation-based mechanisms
Practical Byzantine Fault Tolerance
CAP theorem and blockchain
Benefits and limitations of blockchain
Decentralization
Transparency and trust
Immutability
High availability
Highly secure
Simplification of current paradigms
Faster dealings
Cost saving
Challenges and limitations of blockchain technology
Summary
2. Decentralization
Decentralization using blockchain
Methods of decentralization
Disintermediation
Through competition
Routes to decentralization
How to decentralize
Examples
Blockchain and full ecosystem decentralization
Storage
Communication
Computation
Smart contract
Decentralized organizations
Decentralized autonomous organizations
Decentralized autonomous corporations
Decentralized autonomous societies
Decentralized applications
Requirements of a decentralized application
Operations of a DAPP
Examples
KYC-Chain
OpenBazaar
Lazooz
Platforms for decentralization
Ethereum
Maidsafe
Lisk
Summary
3. Cryptography and Technical Foundations
Introduction
Mathematics
Set
Group
Field
A finite field
Order
Prime fields
Ring
A cyclic group
An abelian group
Modular arithmetic
Cryptography
Confidentiality
Integrity
Authentication
Entity authentication
Data origin authentication
Non-repudiation
Accountability
Cryptographic primitives
Symmetric cryptography
Stream ciphers
Block ciphers
Block encryption mode
Keystream generation modes
Message authentication modes
Cryptographic hashes
Electronic code book
Cipher block chaining
Counter mode
Data Encryption Standard (DES)
Advanced Encryption Standard (AES)
AES steps
An OpenSSL example of how to encrypt and decrypt using AES
Asymmetric cryptography
Integer factorization
Discrete logarithm
Elliptic curves
Public and private keys
RSA
Encryption and decryption using RSA
Elliptic curve cryptography (ECC)
Mathematics behind ECC
Point addition
Point doubling
Discrete logarithm problem
How to generate public and private key pairs
Private key
Generate public key
How to encrypt and decrypt using RSA with OpenSSL
Encryption
Decrypt
ECC using OpenSSL
ECC private and public key pair
Private key
Private key generation
Cryptographic primitives
Hash functions
Compression of arbitrary messages into fixed length digest
Easy to compute
Pre-image resistance
Second pre-image resistance
Collision resistance
Message Digest (MD)
Secure Hash Algorithms (SHAs)
Design of Secure Hash Algorithms (SHA)
SHA-256
Design of SHA3 (Keccak)
OpenSSL example of hash functions
Message Authentication codes (MACs)
MACs using block ciphers
HMACs (hash-based MACs)
Merkle trees
Patricia trees
Distributed hash tables (DHTs)
Digital signatures
Sign then encrypt
Encrypt then sign
Elliptic Curve Digital signature algorithm (ECDSA)
How to generate a digital signature
ECDSA using OpenSSL
Homomorphic encryption
Signcryption
Zero knowledge proofs
Blind signatures
Encoding schemes
Financial markets and trading
Trading
Exchanges
Orders and order properties
Order management and routing systems
Components of a trade
General attributes
Economic
Sales
Counterparty
Trade life cycle
Order anticipators
Market manipulation
Summary
4. Bitcoin
Bitcoin
Bitcoin definition
Keys and addresses
Public keys in bitcoin
Private keys in bitcoin
Bitcoin currency units
Base58Check encoding
Vanity addresses
Transactions
The transaction life cycle
The transaction structure
The script language
Commonly used Opcodes
Types of transaction
Coinbase transactions
What is UTXO?
Transaction fee
Contracts
Transaction malleability
Transaction pools
Transaction verification
Blockchain
The structure of a block
The structure of a block header
The genesis block
Mining
Task of miners
Synching up with the network
Proof of Work
The mining algorithm
The hashing rate
Mining systems
CPU
GPU
FPGA
ASICs
Mining pools
The bitcoin network
Wallets
Wallet types
Non-deterministic wallets
Deterministic wallets
Hierarchical deterministic wallets
Brain wallets
Paper wallets
Hardware wallets
Online wallets
Mobile wallets
Bitcoin payments
Bitcoin investment and buying and selling bitcoins
Bitcoin installation
Setting up a bitcoin node
Setting up the source code
Setting up bitcoin.conf
Starting up a node in testnet
Starting up a node in regtest
Starting up a node in live mainnet
Experimenting with bitcoin-cli
Bitcoin programming and the command-line interface
Bitcoin improvement proposals (BIPs)
Summary
5. Alternative Coins
Theoretical foundations
Alternatives to Proof of Work
Proof of Storage
Proof of Stake
Proof of coinage
Proof of deposit
Proof of burn
Proof of activity
Non-outsourceable puzzles
Difficulty adjustment and retargeting algorithms
Kimoto Gravity Well
Dark Gravity Wave
DigiShield
MIDAS
Bitcoin limitations
Privacy and anonymity
Mixing protocols
Third-party mixing protocols
Inherent anonymity
Extended protocols on top of bitcoin
Colored coins
Counterparty
Development of altcoins
Consensus algorithms
Hashing algorithms
Difficulty adjustment algorithms
Inter-block time
Block rewards
Reward halving rate
Block size and transaction size
Interest rate
Coin age
Total supply of coins
Namecoin
Trading Namecoins
Obtaining Namecoins
Generating Namecoin records
Litecoin
Primecoin
Trading Primecoin
Mining guide
Zcash
Trading Zcash
Mining guide
Address generation
GPU mining
Downloading and compiling nheqminer
Summary
6. Smart Contracts
History
Definition
Ricardian contracts
Smart contract templates
Oracles
Smart Oracles
Deploying smart contracts on a blockchain
The DAO
Summary
7. Ethereum 101
Introduction
Ethereum clients and releases
The Ethereum stack
Ethereum blockchain
Currency (ETH and ETC)
Forks
Gas
The consensus mechanism
The world state
The account state
Nonce
Balance
Storageroot
Codehash
Transactions
Nonce
gasPrice
gasLimit
To
Value
Signature
Init
Data
Contract creation transaction
Message call transaction
Elements of the Ethereum blockchain
Ethereum virtual machine (EVM)
Execution environment
Machine state
The iterator function
Runtime byte code
Opcodes and their meaning
Arithmetic operations
Logical operations
Cryptographic operations
Environmental information
Block Information
Stack, memory, storage and flow operations
Push operations
Duplication operations
Exchange operations
Logging operations
System operations
Precompiled contracts
The elliptic curve public key recovery function
The SHA-256 bit hash function
The RIPEMD-160 bit hash function
The identity function
Accounts
Types of accounts
Block
Block header
Parent hash
Ommers hash
Beneficiary
State root
Transactions root
Receipts root
Logs bloom
Difficulty
Number
Gas limit
Gas used
Timestamp
Extra data
Mixhash
Nonce
The genesis block
Transaction receipts
The post-transaction state
Gas used
Set of logs
The bloom filter
Transaction validation and execution
The transaction sub state
Suicide set
Log series
Refund balance
The block validation mechanism
Block finalization
Ommers validation
Transaction validation
Reward application
State and nonce validation
Block difficulty
Ether
Gas
Fee schedule
Messages
Calls
Mining
Ethash
CPU mining
GPU mining
CPU benchmarking
GPU benchmarking
Mining rigs
Motherboard
SSD hard drive
GPU
Mining pools
Clients and wallets
Geth
Eth
Pyethapp
Parity
Light clients
Installation
Eth installation
Mist browser
Geth
The geth console
Funding the account with bitcoin
Parity installation
Creating accounts using the parity command line
Trading and investment
The yellow paper
Useful symbols
The Ethereum network
MainNet
TestNet
Private net(s)
Supporting protocols
Whisper
Swarm
Applications developed on Ethereum
Scalability and security issues
Summary
8. Ethereum Development
Setting up a development environment
Test Net (Ropsten)
Setting up a Private Net
Network ID
The genesis file
Data directory
Flags and their meaning
Static nodes
Starting up the private network
Running Mist on Private Net
Deploying contracts using Mist
Development tools and clients
Languages
Compilers
Solc
Integrated Development Environments (IDEs)
Browser solidity
Remix
Installation
Tools and libraries
Node.js version 7
Local Ethereum block explorer
EthereumJS
Contract development and deployment
Introducing solidity
Types
Value types
Boolean
Integers
Address
Array value types (fixed size and dynamically sized byte arrays)
Literals
Integer literals
String literals
Hexadecimal literals
Enums
Function types
Internal functions
External functions
Reference types
Arrays
Structs
Data location
Mappings
Global variables
Control structures
Events
Inheritance
Libraries
Functions
Layout of a solidity source code file
Introducing Web3
POST requests
The HTML and JavaScript frontend
Installing web3.js
Example
Development frameworks
Truffle
Installation
Testing using truffle
Build
Another example
Example project: Proof of Idea
Permissioned distributed ledgers
Summary
9. Hyperledger
Projects
Fabric
Sawtooth lake
Iroha
Blockchain explorer
Fabric chaintool
Fabric SDK Py
Corda
Hyperledger as a protocol
Reference architecture
Requirements
Modular approach
Privacy and confidentiality
Identity
Auditability
Interoperability
Portability
Fabric
Hyperledger Fabric
Fabric architecture
Membership services
Blockchain services
Consensus manager
Distributed ledger
Peer to Peer protocol
Ledger storage
Chaincode services
Events
APIs and CLIs
Components of the Fabric
Peers or nodes
Applications on blockchain
Chaincode implementation
Application model
Sawtooth lake
PoET
Transaction families
Consensus in Sawtooth
Development environment
Corda
Architecture
State objects
Transactions
Consensus
Flows
Components
Nodes
Permissioning service
Network map service
Notary service
Oracle service
Transactions
Vaults
CorDapp
Development environment
Summary
10. Alternative Blockchains
Blockchains
Kadena
Ripple
Transactions
Payments related
Order related
Account and security related
Application layer
Transport layer
Interledger layer
Ledger layer
Stellar
Rootstock
Drivechain
Quorum
Transaction manager
Crypto Enclave
QuorumChain
Network manager
Tezos
Storj
Maidsafe
BigChainDB
Multichain
Tendermint
Tendermint Core
Tendermint Socket Protocol (TMSP)
Platforms
BlockApps
Installation
Application development and deployment using BlockApps
Eris
Summary
11. Blockchain-Outside of Currencies
Internet of Things
Physical object layer
Device layer
Network layer
Management layer
Application layer
IoT blockchain experiment
First node setup
Raspberry Pi node setup
Circuit
Government
Border control
Voting
Citizen identification (ID cards)
Miscellaneous
Health
Finance
Insurance
Post trade settlement
Financial crime prevention
Media
Summary
12. Scalability and Other Challenges
Scalability
Block size increase
Block interval reduction
Invertible Bloom lookup tables
Sharding
State channels
Private blockchain
Proof of Stake
Sidechains
Subchains
Tree chains
Privacy
Indistinguishability obfuscation
Homomorphic encryption
Zero knowledge proofs
State channels
Secure multiparty computation
Usage of hardware to provide confidentiality
Coinjoin
Confidential transactions
MimbleWimble
Security
Smart contract security
Why3 formal verification
Oyente tool
Summary
13. Current Landscape and Whats Next
Emerging trends
Application-specific blockchains (ASBCs)
Enterprise-grade blockchains
Private blockchains
Start-ups
Strong research interest
Standardization
Enhancements
Real-world implementations
Consortia
Answers to challenges
Convergence
Education of blockchain technology
Employment
Crypto-economics
Research in cryptography
New programming languages
Hardware research and development
Research in formal methods and security
Alternatives to blockchains
Interoperability efforts
Blockchain as a service
Efforts to reduce electricity consumption
Improvement proposals
BIPs
BIP 152
BIP 151
BIP 150
BIP 147
BIP 146
EIPs
EIP 170
EIP 150
EIP 161
EIP 160
EIP 155
Other challenges
Dark side
Blockchain research
Smart contracts
Centralization issues
Limitations in cryptographic functions
Consensus Algorithms
Scalability
Code Obfuscation
List of notable projects
Zcash on Ethereum
CollCo
Cello
Qtum
Bitcoin-NG
Solidus
Hawk
Town-Crier
SETLCoin
TEEChan
Falcon
Bletchley
Casper
Metropolis
Miscellaneous Tools
Solidity extension for Microsoft Visual studio
MetaMask
Stratis
Embark
DAPPLE
Meteor
uPort
INFURA
Convergence with other industries
Future
Summary
← Prev
Back
Next →
← Prev
Back
Next →