Mastering blockchain by imran bashir

665 398 0
  • Loading ...
    Loading ...
    Loading ...

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Tài liệu liên quan

Thông tin tài liệu

Ngày đăng: 06/03/2019, 10:35

Mastering Blockchain Table of Contents Mastering Blockchain Credits About the Author About the Reviewer 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 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 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 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 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 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 Smart Contracts History Definition Ricardian contracts Smart contract templates Oracles Casper This is the Proof of Stake algorithm for Ethereum in development Major research has already been conducted in this area and is expected to be implemented in 2017 The nodes become bonded validators in a Casper-based Ethereum network and are required to pay a security deposit in order for them to be able to propose new blocks Metropolis This is the next release of Ethereum for which a lot of work has already been completed A hard fork will be required to implement this release A series of EIPs have been released which include all major improvements for this release Improvements include moving the signature verification and nonce logic into smart contracts, which will provide more flexibility to the developers with regards to choice of security schemes Another improvement is related to block hash and state root changes which result in protocol simplification and allow parallel transaction processing Other proposals include big integer support for cryptographic functions (elliptic curve cryptography) All the above improvements, along with various others, are covered under EIP86, EIP98, EIP96, EIP100, EIP101, EIP116, EIP195, EIP140, and EIP 141 There is no release date yet and it's not clear whether all EIPs will be implemented in the new release; however, the main aim of this release is protocol simplification, privacy, and flexibility for developers Miscellaneous Tools Some tools that have not been discussed previously are listed below and introduced briefly in order to make readers aware of the myriad of development options available for blockchains This list includes platforms, utilities, and tools that can be used for blockchain development Solidity extension for Microsoft Visual studio This extension provides Intellisense, auto completion, and templates for decentralized apps, and works within the familiar Visual Studio IDE, making it easier for developers to familiarize themselves with Ethereum development MetaMask This is a DAPP browser that is similar to Mist from a DAPP browsing point of view but allows users to run Ethereum decentralized applications within the browser without the requirement of running a full Ethereum node This is available from and can be installed as a Chrome plugin Stratis This is a blockchain development platform that allows creation of custom private blockchains and works in conjunction with the main Stratis blockchain (Stratis chain) for security reasons It allows provisioning of major blockchains such as bitcoin, Ethereum, and Lisk easy Also, it allows development using C# Net technologies It is also available via Microsoft Azure as BaaS This is available at Embark This is a development framework for Ethereum which allows similar functionality to truffle, discussed in previous chapters It allows automatic deployment of smart contracts, easier integration with JavaScript, and, especially, easier integration with IPFS This is very feature-rich framework and many more functionalities are available It can be installed via npm This framework is available at GitHub: DAPPLE This is another framework for Ethereum that allows easier development and deployment of smart contracts by taking care of more complex tasks It can be used for package management, contract building, and deployment scripting This is also available via npm It is also available via GitHub at Meteor This is a full-stack development framework for single-page applications It can be used for Ethereum DAPP development There is a development environment available in meteor and it allows easier and manageable development of complex DAPPs It is available at and Ethereum-specific DAPP building information is available at uPort This platform is built on Ethereum and provides a decentralized identity management system This allows users to have full control over their identity and personal information This is based on the idea of reputation systems enables users to attest each other and build trust This is available at INFURA This project aims to provide enterprise-level Ethereum and IPFS nodes INFURA consists of Ethereum nodes, IPFS nodes, and a service layer named Ferryman which provides routing and load balancing services Convergence with other industries Convergence of blockchain with IoT has been discussed at length in the last chapter Briefly, it can be said that due to the authenticity, integrity, privacy, and shared nature of blockchains, IoT networks will benefit greatly from blockchain technology This can be realized in the form of an IoT network that runs on a blockchain and makes use of a decentralized mesh network for communication in order to facilitate machine-to-machine (M2M) communication in real time All this data which is generated as a result of M2M communication can be used in the machine learning process to augment the functionality of Artificially Intelligent DAOs or simple AAs AAs can act as agents in a Distributed Artificial Intelligence (DAI) environment provided by a blockchain and can learn over time using machine learning processes AI is a field of computer science that endeavors to build intelligent agents that can make rational decisions based on the scenarios and environment that they observe around them Machine learning plays a vital role in AI by making use of raw data as a learning resource A key requirement in AIbased systems is the availability of authentic data that can be used for machine learning and model building The explosion of data coming out IoT devices, smartphone's, and other data acquisition means that AI and machine learning is becoming more and more powerful There is, however, a requirement of authenticity of data Once consumers, producers, and other entities are on a blockchain, the data that is generated as a result of interaction between these entities can be readily used as an input to machine learning engines with a guarantee of authenticity This is where AI converges with blockchains It could be argued that if an IoT device is hacked, it can send malformed data to the blockchain This issue is mitigated because an IoT device is part of the blockchain (as a node) and has all security properties applied to it as a normal node in the blockchain network These properties include incentivization of good behavior, rejection of malformed transactions, and strict verification of transactions and various other checks that are part of blockchain protocol Therefore, even if an IoT device is somehow hacked, it would be treated as a Byzantine node by the blockchain network and would not cause any adverse impact on the network Moreover, the possibility of combining intelligent Oracles, intelligent smart contracts, and AAs will give rise to Artificially Intelligent Decentralized Autonomous Organizations (AIDAOs) that can act on behalf of humans to run entire organizations on their own This is another side of AI that can become norm in the future However, more research is required in order to realize this vision Also, convergence of blockchain technology with other fields such as 3D printing, virtual reality, augmented reality, and the gaming industry is also envisaged For example, in a multiplayer online game, blockchain's decentralized approach allows for more transparency and can ensure that no central authority is gaining unfair advantage by manipulating the game rules All these topics are active areas of research currently and more interest and development is expected in these areas in the near future Future The year 2017 is predicted to be the year when blockchain technology is implemented in real-world production environments and move from the Proof of concept and theoretical stage of previous years There are few careful predictions being made in the section that are based on the current advancement and speed of progress in the concerned field All of these predictions are likely to come true between the years 2020 and 2050: The IoT will run on multiple blockchains and will give rise to an M2M economy Medical records will be shared securely while preserving the privacy of patients between various private blockchains run by consortia of health providers It may well be a single private blockchain shared among all service providers Elections will be held via decentralized web applications with a backend of blockchains in a transparent and secure manner Financial institutions will be running many private blockchains to share data between participants and for internal processes Financial institutions will be making use of semi-private blockchains that will provide identity information for anti-money-laundering and know-your-customer functions and will be shared between many or all of the financial institutions around the world Immigration and border control related activities will be recorded on the blockchain and passport control will be conducted via a blockchain shared between all ports of entries and border agencies around the world Research in cryptography and distributed systems will reach new heights and universities and educational establishment will be providing dedicated courses on crypto-economics, cryptocurrencies, and blockchains Artificially Intelligent DAOs (Machina Economicus) will prevail on blockchains that will make rational decisions on behalf of humans A publicly available regulated blockchain will be used on day-to-day basis by citizens to perform their day-to-day activities BaaS will be provided as standard to anyone who wishes to run their business or day-to-day transactions on a blockchain In fact, it could be envisaged that just like the Internet, blockchains will seamlessly integrate into our daily lives and people will be using them without knowing much about the underlying technology and infrastructure Blockchains will be normally used to provide DRM (digital rights management) services for arts and media and can be used to deliver content to the consumers, enabling direct communication between consumer and the producer This will eliminate the need for any central party to govern the licensing and rights managing of valuable goods Existing cryptocurrencies such as bitcoin will continue to grow in value and with the availability of state channels and scalability efforts, this trend is only expected to grow Cryptocurrency investment will greatly increase and a new crypto-economic society will emerge Bitcoin value will reach tens of thousands of dollars per coin Digital identities will be routinely managed on the blockchain and different government functions such as voting, taxation, and funds disbursement will be conducted via blockchainenabled platforms Financial institutions and clearing houses will start to introduce blockchain-based solutions for their customers in late 2017 or early 2018 Summary Blockchains are going to change the world The revolution has already started and it is only expected to grow at an exponential scale This chapter has explored various projects and the current state of blockchain technology First, a few trends were discussed that are expected to continue as the technology progresses further There is deep research interest in blockchain technology by many researchers and organizations around the world and some research topics have also been introduced in this chapter Furthermore, convergence with other fields such as the IoT and AI has also been discussed Finally, some predictions regarding the growth of blockchain technology have been made Most of these predictions are likely to come true within the next decade or so, while some may take a longer time Blockchain technology has the potential to change the world and a few positive signs have already been seen in the form of successful Proof of concept implementations and a growing number of enthusiasts and developers taking interest in this technology Very soon, blockchains will be intertwined with our lives just as the Internet is now This chapter is just a modest overview of the vast and tremendous potential of blockchains, and in the near future, exponential growth in this technology is expected ... 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.. .Mastering Blockchain Table of Contents Mastering Blockchain Credits About the Author About the Reviewer
- Xem thêm -

Xem thêm: Mastering blockchain by imran bashir , Mastering blockchain by imran bashir

Từ khóa liên quan

Mục lục

Xem thêm