27,59 €
Blockchain Quick Reference takes you through the electrifying world of blockchain technology and is designed for those who want to polish their existing knowledge regarding the various pillars of the blockchain ecosystem.
This book is your go-to guide, teaching you how to apply principles and ideas for making your life and business better. You will cover the architecture, Initial Coin Offerings (ICOs), tokens, smart contracts, and terminologies of the blockchain technology, before studying how they work. All you need is a curious mind to get started with blockchain technology. Once you have grasped the basics, you will explore components of Ethereum, such as ether tokens, transactions, and smart contracts, in order to build simple Dapps. You will then move on to learning why Solidity is used specifically for Ethereum-based projects, followed by exploring different types of blockchain with easy-to-follow examples. All this will help you tackle challenges and problems.
By the end of this book, you will not only have solved current and future problems relating to blockchain technology but will also be able to build efficient decentralized applications.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 408
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor:Sunith ShettyAcquisition Editor:Tushar GuptaContent Development Editor: Rhea HenriquesTechnical Editor: Dharmendra YadavCopy Editor:Safis EditingProject Coordinator: Manthan PatelProofreader: Safis EditingIndexer: Rekha NairGraphics: Jisha ChirayilProduction Coordinator: Nilesh Mohite
First published: August 2018
Production reference: 1070818
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78899-578-8
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Considering the frenzy around Blockchain and it's first killer app, Bitcoin, it is notable how few people actually understand not only what it is, but why it is. At its core, it is a ledger—not necessarily sexy, so why all the fuss?
We can go back to the invention of double-entry bookkeeping during the Renaissance to see the impact of a trustworthy ledger. Likewise, we can look to the more recent financial crisis of 2008 to study the impact of non-trustworthy ledgers.A secure, distributed, verifiable, and programmable account of transactions between parties has the flexibility to impact on a wide variety of businesses. Banking and finance are the most obvious businesses to benefit from this. Indeed this is what gave rise to Bitcoin—utilizing Blockchain to avoid the traditional model of a centralized bank to manage transactions between entities and reduce costs by removing the middleman.
Really, any supply chain is impacted, whether it be money, livestock, precious gems, or classic cars. Both physical and virtual assets can take advantage of Blockchain as a way to ensure that you're getting what you are told you're getting. This certainly justifies the fuss.
This brings us to Blockchain Quick Reference. The name belies the thoroughness of the book while emphasizing it's concise, clear-eyed approach. Brenn, Samanyu, and Paul have laid out a methodical manual that avoids hyperbole. Starting with Blockchain 101 and progressing in-depth into topics at the core of Blockchain such as consensus, smart contracts, and the fundamental cryptographic concepts that form the foundation for any secure system.
The first half of the book gives a reader a solid foundation for understanding the what and why of this process. I say process rather than technology because it is not a single item but a collection of technologies combined with a systematic and consistent methodology. They then dive into real-world examples that give context to the hysteria. They, of course, cover Bitcoin and some of its competitors such as Ethereum along with an explanation of the often-heard but rarely understood Initial Coin Offerings. The authors are not wide-eyed academics but seasoned technologists who address the practical need for understanding and realistic dialog. The 1990's saw unrealistic, unjustified growth for companies founded upon the nascent World Wide Web. The aftermath of the bubble burst left in place the foundation of the internet and a move towards broadband that drives much of the economy today. Similarly, the Bitcoin craze has exposed the world to the benefits and mysteries of Blockchain.
Blockchain Quick Reference explores these benefits and makes it less mysterious and it certainly warrants a bit of fuss.
By Rino Lupetin, Managing Partner, P&I6D Global Technologies, Inc.
Brenn Hill is a senior software engineer who has worked with such clients as NASCAR, PGA Tour, Time Warner Cable, and many others. He has experience leading international teams on cannot fail engineering projects. He strives to work with business to ensure that tech projects achieve good ROI and solve key business problems. He has a master's degree in Information Science from UNC-CH and currently travels the world as a digital nomad.
Samanyu Choprais a developer, entrepreneur, and Blockchain supporter with wide experience of conceptualizing, developing, and producing computer and mobile software's. He has been programming since the age of 11. He is proficient in programming languages such as JavaScript, Scala, C#, C++, Swift, and so on. He has a wide range of experience in developing for computers and mobiles. He has been a supporter of Bitcoin and blockchain since its early days and has been part of wide-ranging decentralized projects since a long time. You can write a tweet to him at @samdonly1.
Paul Valencourt is CFO of BlockSimple Solutions. He currently helps people launch STOs and invest in cryptocurrency mining. Harass him on LinkedIn.
Sanket Thodge is an entrepreneur and speaker by profession based out of Pune, India. Sanket is an author of Cloud Analytics with Google Cloud Platform. Sanket is founder of Pi R Square Digital Solutions and has expertise in big data. Sanket has explored Cloud, IoT, machine learning and blockchain. Sanket has also applied for a patent in IoT and has worked with numerous start-ups and MNCs in providing consultancy, architecture building, development, and corporate training across the globe.
Rajib Bhattacharya currently works as a Pre Sales Consultant with a premier IT solution provider in the Middle East. He has 13 years of experience in IT Consulting and architecture solutions. He is a seasoned architect focusing on analytics, data warehousing, big data, and cognitive computing. He holds multiple patents and is an author of 2 books in the field of analytics. He is passionate in helping clients to combine their enterprise data, which enables them to make valuable business decisions using analytics solutions. He holds a Master of Computer Applications degree from West Bengal University of Technology and is certified in technologies. He has developed and delivered various training programs on analytics and cognitive computing.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
Blockchain Quick Reference
Packt Upsell
Why subscribe?
PacktPub.com
Foreword
Contributors
About the authors
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Blockchain 101
Processing a financial transaction
Ledger
Concept of a trustless system
Introducing blockchain
General elements of blockchain
Peer-to-peer network
Block
Block header
Addresses
Wallets
Transaction
Nodes
What does blockchain solve?
Types of blockchains
Public blockchain
Semi-private blockchain
Private blockchain
Consortium blockchain
Byzantine generals problem
Consensus
Blockchain in a nutshell
Benefits
Banking records
Medical records
Government records
Creative and copyright records
University degree records
Challenges
Complexity
Network scalability
Speed and cost
Double spending
Summary
Components and Structure of Blockchain
Blocks
The chain between blocks
Hashing and signatures
Digital signatures
What are digital keys?
Example block data
Example Ethereum block
Bitcoin block
Global state
Block time and block size
Blockchain miners
Blockchain validators
Smart contracts
Blockchain speed
How to calculate blockchain throughput
Comparisons with traditional networks
Summary
Decentralization Versus Distributed Systems
Distributed systems
Resiliency
Fault tolerance and failure isolation
Consensus and coordination
Backups
Consistency
Peer-to-peer systems
Decentralized systems
Principles of decentralized systems
Open access
Non-hierarchical
Ecosystem diversity
Transparency
Downsides
Speed
Censorship resistance
Chaos and non-determinism
Summary
Cryptography and Mechanics Behind Blockchain
Principles of security
Historical perspective – classical cryptography
Types of cryptography
Symmetric cryptography
Asymmetric (public-key) cryptography
Signatures
Hashing
The avalanche effect
Collisions
Hashing a block
Hashing outside PoW
Summary
Bitcoin
The history of Bitcoin
Why Bitcoin is volatile
Keys and addresses
Currency units
Vanity addresses
Base58 check encoding
Transactions
Types
Pay-to-Public-Key Hash
Pay-to-Script Hash
Blocks
Genesis block
Bitcoin network
Types of nodes
Full node
Lightweight nodes
Other nodes
Network discovery
Finding peers
DNS seeds
Static IPs
Wallets
Types
Deterministic wallet
Deterministic wallets
HD wallets
Non-deterministic wallet
Summary
Altcoins
Introducing Altcoins
Tokens
Ethereum
Omni Layer
NEO
Waves
Counterparty
Alternative currency
Monetary alternatives
Consensus alternatives
Litecoin
Ether
Ripple
Bitcoin Cash
Acquiring cryptocurrency
Mining of cryptocurrency
Bitcoin mining
Mining difficulty
Mining pools
Altcoin mining
Cryptocurrency exchanges
Cryptocurrency wallets
Summary
Achieving Consensus
Practical Byzantine fault tolerance algorithm
Byzantine faults
How PBFT works
Proof of Work
How the PoW problem works in Bitcoin
Proof of Stake
The nothing-at-stake attack
Variations
Delegated Proof of Stake
Tendermint consensus
Proof of Authority
Establishing authority
Proof of Elapsed time
Summary
References
Advanced Blockchain Concepts
Blockchain and banks
Unbanked – going pure crypto
Fixing pegs
Buying options
Why regulated exchanges?
Unbanked and unincorporated?
The DAO
Decentralizing an organization
Putting a corporation on a blockchain
Cutting out the middle man
Providing capital
Social purpose – blockchain as leveler
Banking the unbanked
Silk road LLC – privacy and ethics
Tracking all the things
Defeating some privacy issues with zero-knowledge proofs
Unwrapping the concept of zero-knowledge proofs
Summary
Cryptocurrency Wallets
Introduction to cryptocurrency wallets
Transactions in cryptocurrency wallets
Types of cryptocurrency wallets
Currency support
Tenancy
Software wallets
Hardware wallets
Paper wallets
Brain wallet
Usage frequency
Key derivation
Non-deterministic wallet
Deterministic wallets
Hierarchical deterministic wallets
Mnemonic codes
Key generation process in HD wallets
Child key derivation
Private key generation
Extended keys
Summary
Alternate Blockchains
Various uses of blockchain
Government
Healthcare
Medical research
Supply chain
Copyright
Fine art
Shipping
Energy
Computation and data storage
Identification and social security
Enterprise
Ripple
Transactions
Stellar
Tendermint
Monax
Summary
Hyperledger and Enterprise Blockchains
History of Hyperledger
Hyperledger projects
Hyperledger Burrow
Hyperledger Sawtooth
Sawtooth architecture
Transaction families
Transactions and batches
The key pieces
Hyperledger Fabric
Architecture choices and features
Organizational focus
Private channels
Assets
Smart contracts
Advantages of Fabric
Hyperledger Iroha
Hyperledger Indy
Tools in Hyperledger
Hyperledger Caliper
Hyperledger Composer
Hyperledger Cello
Hyperledger Explorer
Hyperledger Quilt
Relationships between the tools
Which Hyperledger project should you use?
Using Hyperledger
Summary
Ethereum 101
Introducing Ethereum
Components of Ethereum
Ethereum accounts
Ethereum network
Ethereum public MainNet
Ethereum clients
Geth
Installing Geth
Managing accounts
Ethereum gas
Ethereum virtual machine
Execution environment
Ethereum block
Block header
Ommers or uncles
Messages
Ethash
Ether
Procuring ether
Trading
Summary
Solidity 101
Basics of Solidity
The basics of working on Solidity
Using the compiler
Programming in Solidity
Laying out a Solidity file
Importing files
Commenting
Tags
Structure of a contract
State variables
Functions
Function modifiers
Events
Types
Value types
Boolean
Integers
Address
Array value type
Literal
Enums
Function
Function Modifiers
Reference types
Structs
Data location
Mapping
Units and global variables
Summary
Smart Contracts
Why smart contracts?
Automating processes and resolutions between parties
Real-world example
Increased transparency
Ending centralized data
Increased fairness
Smart contract approaches
Example Ethereum smart contracts
The promises
Security considerations
Dealing with threats in smart contracts
Limitations of smart contracts
Data quality and mistakes
Legal validity
Stability of meaning
Summary
References
Ethereum Development
Introduction
Preparing for smart contract development
Remix
Geth and Mist
MetaMask
Token standard
Methods in ERC20
Web3
Truffle framework
Ganache
Working on a smart contract
Summary
Ethereum Accounts and Ether Tokens
Introducing Ethereum accounts
Ethereum state transition function
Genesis block
Transaction receipts
Elements
Post-transaction state
Gas used
Set of logs
The bloom filter
Structure
Transaction sub state
Suicide set
Log series
Refund balance
Messages
Calls
Ethereum block validation
Uncles validation
Block difficulty
Block finalization
Disadvantages of Ethereum-based tokens
Summary
Decentralized Applications
What makes an application decentralized
Defining a decentralized application
Decentralized apps and blockchain
Using blockchain does not make an application decentralized
Major decentralized blockchain applications
IPFS
Typical web communications
Peer-to-peer file transfer
Value to blockchain projects
Aragon
district0x
What is a district?
Ethereum name service
Civic/uPort
Gnosis
Steemit
CryptoKitties
Summary
References
Mining
Cryptocurrency mining
The mining process
Algorithms
Mining hardware
CPU-based mining
GPU-based mining
FPGA-based mining
ASIC-based mining
Miner types
Cloud mining
Hardware mining
Mining rigs
Mining pools
Pay-per-share – PPS
Proportional – PROP
Pay-per-last-N-shares – PPLNS
The double geometric method – DGM
Shared maximum pay per share – SMPPS
Equalized shared maximum pay per share – ESMPPS
Recent shared maximum pay per share – RSMPPS
Capped pay per share with recent backpay – CPPSRB
Bitcoin pooled mining – BPM
Pay on target – POT
SCORE
Popular pools
Mining software
Summary
ICO 101
The current state of the ICO market
Increasing volume of ICOs
Typical aspects of an ICO campaign
Whitepaper
Private placement
Pre-sale
Good pre-sale practices
Public sale
Capped sale
Uncapped sale
Dutch auction
Influencer marketing
PR campaigns
Content marketing
ICO reviewers
Smart contract and prototype development
Code audits
Bounty campaigns
Airdrops
Road shows
Issues with ICOs and blockchain projects
Proof of product-market fit and traction
Low barrier to entry
Does a project really need the blockchain?
Misleading token practices
Legality
Utility versus Security
Other considerations
Sustainability
Advantages of ICOs
Liquidity
Lack of gatekeepers
Minimal investment sizes
Notable scams
Onecoin
Pincoin and iFan
Bitconnect
Other problems
Major hacks
The DAO
Parity
Securing an ICO
SSH key locked servers
DNS security
Intrusion detection
Purchase related domains
Monitor social channels
Multi-signature wallets
Code audits
Conclusion
References
Creating Your Own Currency
Understanding types of cryptocurrency
Tokens based on existing blockchains
Creating a new blockchain from scratch
A forked blockchain with one's own genesis block
Litecoin's development
The process
Creating one's own cryptocurrency
Setting up Litecoin
Platform selection
Preparation
Dependency installation
Build instructions
Setting up our own coin
Port selection
The setting of block-related parameters
Amount limit
The coinbase maturity number
Genesis block creation
Wallet address
Checkpoints
Creatives and graphics
Summing up
Summary
Scalability and Other Challenges
Scalability and decentralization
Blockchains in business
Usability
Lack of protection
51% attacks
Network forks
Catastrophic bugs
Lack of interoperability
Low availability of blockchain skills
Privacy
Energy consumption
Summary
References
Future of Blockchain
Ongoing fragmentation and specialization
Video games
Real estate
Logistics
Licensing
Industry consortiums
A large number of total-loss projects
Legal and regulatory evolution
Security token offerings
Aggregate and insurance products
Technological stabilization
Ethereum and Hyperledger
Service consolidation and product offerings
Cross-chain communication
Intersecting with AI and IoT
Blockchain-intersecting AI
Blockchain-intersecting IoT
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
This is Blockchain Quick Reference, a book designed to introduce newcomers to the world of blockchain in a holistic fashion. It takes you through the electrifying world of blockchain technology, and it is aimed at those who want to polish their existing knowledge of the various pillars of the blockchain ecosystem.
This book is your go-to guide that teaches you how to apply principles and ideas that making your life and business better. You will cover the architecture, Initial Coin Offerings (ICOs), tokens, smart contracts, and terminology, before studying how they work. All you need is a curious mind to get started with blockchain technology. Once you have grasped the basics, you will explore components of Ethereum, such as ether token, transactions, and smart contracts, in order to build simple Dapps. You will then move on to learning why Solidity is used specifically for Ethereum-based projects, followed by exploring different types of blockchain with easy-to-follow examples. All this will help you tackle challenges and problems. In addition to this, you will learn how blockchain has been revolutionizing IoT and machine learning, and how it can affect business processes.By the end of this book, you will not only have solved current and future problems relating to blockchain technology but also be able to build efficient decentralized applications.
This is a book for those who are interested in blockchain but are overwhelmed by the sudden explosion of options in the space. No longer limited to just Bitcoin, blockchain technology has spread into many sectors and a significant number of different technologies. This book is primarily aimed at business people who want an introduction to the technology, how it works, the major types of blockchains out there, and some help getting started by using it in your organization or planning an ICO.
This book is aimed primarily at business users and developers who are considering a blockchain based project. This book will help orient you to the current world of blockchain introduces the major software projects and packages and covers some of the legal background currently affecting the field.
Chapter 1, Blockchain 101, explains what blockchain technologies are and how they work. We also introduce the concept of the distributed ledger.
Chapter 2, Components and Structure of Blockchain, takes a closer look at the technical underpinnings of a blockchain and peeks under the hood to understand what a block is and how the chain is created.
Chapter 3, Decentralization Versus Distributed Systems, covers different types of decentralized and distributed systems and cover the often-overlooked differences between them.
Chapter 4, Cryptography and Mechanics Behind Blockchain, discusses over the fundamentals of cryptographic systems which are critical to the proper functioning of all blockchains.
Chapter 5, Bitcoin, examine Bitcoin, the first blockchain, and it's specific mechanics in depth.
Chapter 6, Altcoins, covers the major non-bitcoin cryptocurrency projects that have gained popularity over the last few years.
Chapter 7, Achieving Consensus, looks into the different ways blockchains help achieve consensus. This is one of the most important aspects of blockchain behavior.
Chapter 8, Advanced Blockchain Concepts, covers the interactions between blockchain technology, privacy, and anonymity along with some of the legal side effects of the blockchain technology.
Chapter 9, Cryptocurrency Wallets, covers the different wallet solutions that exist for keeping your cryptocurrency secure.
Chapter 10, Alternate Blockchains, examine blockchain creation technologies such as Tendermint and Graphene, and other non-currency based blockchain technologies.
Chapter 11, Hyperledger and Enterprise Blockchains, examine the Hyperledger family of distributed ledger technologies aimed at corporate and enterprise use.
Chapter 12, Ethereum 101, look at Ethereum, the second most dominant blockchain technology today.
Chapter 13, Solidity 101, cover the basics of Solidity, the Ethereum programming language.
Chapter 14, Smart Contracts, covers the smart contracts, which are enabled in different ways by different blockchain technologies.
Chapter 15, Ethereum Development, look at writing applications for the Ethereum blockchain.
Chapter 16, Ethereum Accounts and Ether Token, in this chapter, we look at the mechanics of Ethereum accounts and the token itself in the Ethereum system.
Chapter 17, Decentralized Applications, discusses decentralized applications as a whole, including ones that operate without a blockchain or in tandem with blockchain technologies.
Chapter 18, Mining, we cover blockchain mining and how this is used to secure blockchains, the different types of hardware used in mining, and the different protocols involved.
Chapter 19, ICO 101, we cover the basics of launching an Initial Coin Offering or Initial Token Offering.
Chapter 20, Creating Your Own Currency, we cover the creation of your own blockchain based cryptocurrency.
Chapter 21, Scalability and Other Challenges, covers the difficulties and limitations currently facing blockchain technology.
Chapter 22, Future of Blockchain, we examine the possible future developments of the industry technologically, legally, and socially.
Let go of the hype and really try to understand what blockchain does and doesn't do.
Check out the projects mentioned and see which, if any, apply to your plans. You might save yourself a lot of work.
Think about how decentralization might help or hurt your goals.
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
Log in or register at
www.packtpub.com
.
Select the
SUPPORT
tab.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR/7-Zip for Windows
Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub athttps://github.com/PacktPublishing/Blockchain-Quick-Reference. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!
Feedback from our readers is always welcome.
General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
Since its inception in 2008, blockchain has been a keen topic of interest for everyone in finance, technology, and other similar industries. Apart from bringing a new overview to record keeping and consensus, blockchain has enormous potential for disruption in most industries. Early adopters, enthusiasts, and now governments and organizations are exploring the uses of blockchain technology.
In this book, we will discuss the basics of financial transactions using fiat money to create our own cryptocurrency based on Ether tokens, and, in so doing, we will try to cover the majority of topics surrounding blockchain. We will be discussing Ethereum-based blockchains, Hyperledger projects, wallets, altcoins, and other exciting topics necessary to understand the functioning and potential of blockchain.
In this chapter, we will discuss the following:
F
inancial transactions
Financial ledger
P2P networks
General elements of a blockchain
Uses and benefits of blockchain
Various types of blockchain
Introducing the consensus system
Challenges faced by a blockchain network
Let's start by discussing each of the preceding listed topics and other important details surrounding them.
Before we dig deeper into blockchain-based transactions, it is helpful to know about how financial transactions actually happen and the functioning of fiat money.
Fiat money is entirely based on the credit of the economy; by definition, it is the money declared legal tender by the government. Fiat money is worthless without a guarantee from the government.
Another type of money is commodity money; it is derived from the commodity out of which the good money is made. For example, if a silver coin is made, the value of the coin would be its value in terms of silver, rather than the defined value of the coin. Commodity money was a convenient form of trade in comparison to the barter system. However, it is prone to huge fluctuations in price.
Commodity money proved to be difficult to carry around, so, instead, governments introduced printed currency, which could be redeemed from the government-based banks for actual commodity, but then, even that proved to be difficult for the government to manage, and it introduced fiat-based currency, or faith-based currency.
Having fiat-based currencies incurred a lot of third-party consensus during its time; this would help eradicate fraud from the system. It is also necessary to have a stringent consensus process to make sure that the process, as well as the privacy, is maintained within the system. The following diagram depicts the process of a credit card-based payment process:
A ledger is a record for economic transactions that includes cash, accounts receivable, inventory, fixed assets, accounts payable, accrued expenses, debt, equity, revenue, costs, salaries, wages, expenses, depreciation, and so on. In short, the book in which accounts are maintained is called a ledger. It is the primary record used by banks and other financial institutions to reconcile book balances. All the debits and credits during an accounting period are calculated to make the ledger balance.
The financial statements of banks, financial institutions, and enterprises are compiled using ledger accounts.
While doing a financial transaction using fiat currency, we have a third-party ledger that maintains information about every transaction. Some of these third-party trust systems are VISA, MasterCard, banks, and so on.
Blockchain has changed the landscape of this trustless system by making everyone part of the ledger. Hence, it is sometimes even called a distributed ledger; everybody doing a transaction in blockchain has a record of other transactions that have happened or are happening in the blockchain-based Bitcoin system. This decentralized ledger gives multiple authenticity points for every transaction that has happened; plus, the rules are pre-defined and not different for each wallet user.
On a further note, blockchain does not actually eliminate trust; what it does is minimize the amount of trust and distributes it evenly across the network. A specific protocol is defined using various rules that automatically encourage patrons on the basis of the rules followed. We will be discussing this in depth in later chapters.
The whitepaper released by Bitcoin's founder or a group of founders called Satoshi Nakamoto, in 2008, described Bitcoin as a purely peer-to-peer version of electronic cash. Blockchain was introduced along with Bitcoin. During the initial stages, blockchain was only used with Bitcoin for Bitcoin-based financial transactions.
Blockchain not only restricts financial transactions in Bitcoin, but in general any transaction between two parties that is maintained by the open, decentralized ledger. Most importantly, this underlying technology can be separated and can have other applications create a surge in the number of experiments and projects surrounding the same.
Numerous projects inspired by blockchain started, such as Ethereum, Hyperledger, and so on, along with currencies such as Litecoin, Namecoin, Swiftcoin, and so on.
Blockchain at its core is a distributed and decentralized open ledger that is cryptographically managed and updated various consensus protocols and agreements among its peers. People can exchange values using transactions without any third party being involved, and the power of maintaining the ledger is distributed among all the participants of the blockchain or the node of the blockchain, making it a truly distributed and decentralized system.
Some of the industry verticals using blockchain are as follows:
Cryptocurrency
: Bitcoin is the prime example of this. Apart from this, there are various alternative cryptocurrencies, such as Ethereum, Litecoin, Peercoin, and so on.
Cybersecurity
: There are various companies and projects harnessing the distributed nature of blockchain to create special authentication protocols for mass usage.
Healthcare
: Scalability is one of the best catalysts of blockchain; a lot of projects are securely storing data and using analytics to come to the perfect solution. Providing decentralized patient records and authentication is already being used at various facilities.
Financial services
: A lot of insurance and financial institutions are using blockchain to maintain the vast bank data, such as financial records, ledgers, guarantees, bonds, and so on.
Manufacturing
: Supply chain, prototyping and proof-of-concept, along with the tracking and tracing of goods is utilizing blockchain at the best efficiency.
Governance
: A lot of governments are racing toward becoming the world's first blockchain-powered state. Blockchains are being used across most government departments and not restricted only to public safety, transport, health, and shipping.
Retail
: A lot of startups and projects are aiming to introduce open no-middle man-based ecosystems; some are working on loyalty systems and blockchain-derived gift card systems.
Media
: Record labels can use blockchains to keep their ownership network and intellectual property rights secure.
Travel
: Projects are being worked on to introduce and revolutionize vehicle leasing, ride sharing, and other travel-related queries.
Legal
: Blockchain can bring transparency and solve the scaling issues in the ever-complex legal systems that are in place.
Furthermore, we will be discussing various other elements of blockchain and what other problems blockchain can solve.
It is time to discuss the general elements of blockchain, starting from its basic structure to its formation and further details on the same.
This is a type of network whereby all peers can communicate with one another and are equally entitled, without the need for central coordination by servers or hosts. In conventional networks, the systems are connected to a central server, and this server acts as a central point for communication among the systems. On the other hand, in a peer-to-peer network, all the systems are connected to one another evenly, with no system having central authority. Look at this diagram:
A block is the smallest element of a blockchain; the first block is called the genesis block. Each block contains batches of hashed and encoded transactions. The blocks are stored in a Merkle tree formation. Every block includes the hash of the previous block in the chain that links all blocks to one another. In Bitcoin, a block contains more than 500 transactions on average. The average size of a block is around 1 MB. A block is comprised of a header and a list of transactions.
The block header of a block in Bitcoin comprises of metadata about the block. Consider the following:
Bitcoin version
: This field contains the Bitcoin version number.
Previous block hash
: The previous block's hash is required to create the new block's hash.
Merkle root
: This is the hash of the root of the Merkle tree of the current block's transactions.
Timestamp
: This is the timestamp of the block in UNIX.
Mining difficulty
: Mining is a crucial part of the blockchain ecosystem in Bitcoin. There is a difficulty target for mining, which is mentioned in the header.
Nonce
: Blockchain adds deviations in each block; these are known as nonce. Take a look at this diagram:
Addresses are unique identifiers that are used in a transaction on the blockchain to send data to another address; in the case of Bitcoins, addresses are identifiers that are used to send or receive Bitcoins. Bitcoin blockchain addresses have evolved from time to time. Originally, IP addresses were used as the Bitcoin address, but this method was prone to serious security flaws; hence, it was decided to use P2PKH as a standard format. A P2PKH address consists of 34 characters, and its first character is integer 1. In literal terms, P2PKH means Pay to Public Key Has. This is an example of a Bitcoin address based on P2PKH: 1PNjry6F8p7eaKjjUEJiLuCzabRyGeJXxg.
Now, there is another advanced Bitcoin protocol to create a P2SH address, which means Pay to Script Hash. One major difference with a P2SH address is that it always starts with integer 3 instead of 1.
A wallet is a digital wallet used to store public or private keys along with addresses for transaction. There are various types of wallets available, each one offering a certain level of security and privacy.
Here is a list of the various types of wallets, based on their functions:
Software
: This wallet is installed on the actual computer; the private key access is with the owner of the machine on which the wallet's software is installed.
Web Wallets
: These wallets are based on the cloud and can be accessed anywhere. The private keys are shared with the wallet service.
Paper Wallets
: The private keys of this wallet are printed on paper.
Hardware
: These are physical wallets and are small and portable in nature. The private keys are with the hardware users of each wallet.
It is important to understand the functioning and the need for various wallets along with the requirement for each.
A transaction is the process of transferring data from one address in blockchain to another address. In Bitcoin, it is about transferring Bitcoins from one address to another address. All the transactions happening in blockchain are registered from the start of the chain till the current time; this information is shared across the network and all the P2P nodes. The transaction is confirmed by miners, who are economically compensated for their work.
Each transaction in a blockchain goes through a number of confirmations, as they are the consensus of a transaction. Without confirmation, no transaction can be validated.
Nodes are part of a blockchain network and perform functions as assigned to them. Any device connected to the Bitcoin network can be called a node. Nodes that are integral components of the network and validate all the rules of the blockchain are called full nodes. Another type of Node is called a super node, which acts as a highly connected redistribution point, as well as a relay station.
A blockchain performs various functions. We will discuss each of them briefly here and in detail later:
Security
: Due to its consensus structure and multiple failback points, there is minimum chance of failure. Its distributed nature gives better security and reliability.
Faster settlements
: Traditional banking protocols are very time-consuming and incur fairly large forex charges; on the other hand, Bitcoins based on blockchain offer near-instant speed, saving time and costs for the entire financial industry.
Transparency
: Being decentralized in nature, there is no need for a third party, as blockchain is shared with everyone with a wallet, making it a transparent system with trust.
Economical
: Having no third party and the ledger being shared by everyone means no overhead costs or auditing expenses.
The following diagram depicts the difference between centralized, decentralized, and distributed networks:
Being distributed in nature, blockchain offers lots of out-of-the-box features, such as high stability, security, scalability, and other features discussed previously.
Considering the way blockchain has evolved, we can classify blockchain into multiple types; these types define the course of blockchain and make it go beyond the use of P2P money. The following diagram displays the different types of blockchain networks currently available or proposed.
We will now discuss each type of blockchain network in detail.
A public blockchain is a blockchain where anyone in the world can become a node in the transaction process. Economic incentives for cryptographic verification may or may not be present. It is a completely open public ledger system. Public blockchains can also be called permissionless ledgers.
These blockchains are secured by crypto economics, that is, economic incentives and cryptographic verification using mechanisms such as PoW or PoS or any other consensus mechanism. Some popular examples of this type of blockchain are Bitcoin, Ethereum, Litecoin, and so on.
A semi-private blockchain is usually run by a single organization or a group of individuals who grant access to any user, who can either be a direct consumer or for internal organizational purposes. This type of blockchain has a public part exposed to the general audience, which is open for participation by anyone.
In private blockchains, the write permissions are with one organization or with a certain group of individuals. Read permissions are public or restricted to a large set of users. Transactions in this type of blockchain are to be verified by very few nodes in the system.
Some prime examples of private blockchain include Gem Health network, Corda, and so on.
In this type of blockchain, as the name suggests, the consensus power is restricted to a set of people or nodes. It can also be known as a permission private blockchain. Transaction approval time is fast, due to fewer nodes. Economic rewards for mining are not available in these types of blockchains.
A few examples of consortium-based blockchains are Deutsche Boerse and R3 (financial institutions).
This is one of the classic problems faced by various computer networks, which until recently had no concrete solution. This problem is called Byzantine Generals' Problem (BGP). The problem at its root is about consensus, due to mistrust in the nodes of a network.
Let's imagine that various generals are leading the Byzantine army and are planning to attack a city, with each general having his own battalion. They have to attack at the same time to win. The problem is that one or more of generals can be disloyal and communicate a duping message. Hence, there has to be a way of finding an efficient solution that helps to have seamless communication, even with deceptive generals.
This problem was solved by Castro and Liskov, who presented the Practical Byzantine Fault Tolerance (PBFT) algorithm. Later, in 2009, the first practical implementation was made with the invention of Bitcoin by the development of PoW as a system to achieve consensus.
We will be discussing in detail the BGP in later chapters.
Consensus is the process of reaching a general agreement among nodes within a blockchain. There are various algorithms available for this especially when it is a distributed network and an agreement on a single value is required.
Mechanisms of consensus: Every blockchain has to have one mechanism that can handle various nodes present in the network. Some of the prime mechanisms for consensus by blockchain are the following:
Proof of Work
(
PoW
): This is the most commonly used consensus mechanism, also used by the first ever cryptocurrency, Bitcoin. This algorithm has proven most successful against Sybil attacks.
Proof of Stake
(
PoS
) th
is makes the mining of new blocks easier for those who have the highest amount of cryptocurrency.
Delegated Proof of Stake
(
DPOS
) one small change it has over PoS is that each node that has a stake can delegate the validation of a transaction to other nodes by means of voting.
Proof of Importance
(
POI
) this is designed to be energy efficient and can also run on relatively less powerful machines. It relies on stake as well as the usage and movement of tokens to establish trust and importance.
Proof of Elapsed Time
(
PoET
) this is a blockchain algorithm created by Intel, using
Trusted Execution Environment
(
TEE
) to have randomness and security in the voting process using a guaranteed wait time.
Proof of burn
(
PoB
) this is mostly used for bootstrapping one cryptocurrency to another. The basic concept is that miners should prove that they have burned coins, that is, they have sent them to a verifiable unspendable address.
Proof of activity
(
PoA
): A random peer is selected in this from the entire network to sign a new block that has to be tamper-proof.
All the preceding algorithms and a host of already available or currently under research make sure that the perfect consensus state is achieved and no possible security threats are present on the network.
It is time to discuss the benefits as well as the challenges or limitations faced by blockchain technology, and what steps are being taken by the community as a whole.
If it's all about trust and security, do we really need a trusted system, even after everything is already highly secure and private? Let's go through the limitations in each of the existing ecosystems where blockchain is a perfect fit.
Record keeping and ledger maintenance in the banking sector is a time and resource-consuming process, and is still prone to errors. In the current system, it is easy to move funds within a state, but when we have to move funds across borders, the main problems faced are time and high costs.
Even though most money is just an entry in the database, it still incurs high forex costs and is incredibly slow.
There are lot of problems in record keeping, authentication and transferring of records at a global scale, even after having electronic records, are difficult when implemented practically. Due to no common third party, a lot of records are maintained physically and are prone to damage or loss.
During a case of epidemiology, it becomes essential to access and mine medical records of patients pertaining to a specific geography. Blockchain comes as a boon in such situation, since medical records can be easily accessible if stored in the blockchain, and they are also secure and private for the required users.
Any government agency has to deal with a lot of records for all of its departments; new filings can be done on blockchain, making sure that the data remains forever secure and safe in a distributed system.
This transparency and distributed nature of data storage leads to a corruption-free system, since the consensus makes sure the participants in the blockchain are using the required criteria when needed.
Copyright and creative records can be secured and authenticated, keeping a tab on copyright misuse and licensing.
One premier example of this is KodakCoin, which is a photographer-oriented cryptocurrency based on blockchain, launched to be used for payments of licensing photographs.
