Bitcoin and Blockchain Internet of Everything (IoE) Series Editor: Mangey Ram Professor, Graphic Era University, Uttarakhand, India IoT Security and Privacy Paradigm Edited by Souvik Pal, Vicente Garcia Diaz, and Dac-Nhuong Le Smart Innovation of Web of Things Edited by Vijender Kumar Solanki, Raghvendra Kumar, and Le Hoang Son Big Data, IoT, and Machine Learning Tools and Applications Rashmi Agrawal, Marcin Paprzycki, and Neha Gupta Internet of Everything and Big Data Major Challenges in Smart Cities Edited by Salah-ddine Krit, Mohamed Elhoseny, Valentina Emilia Balas, Rachid Benlamri, and Marius M. Balas Bitcoin and Blockchain History and Current Applications Edited by Sandeep Kumar Panda, Ahmed A. Elngar, Valentina Emilia Balas, and Mohammed Kayed For more information about this series, please visit: https://www.crcpress. com/Internet-of-Everything-IoE-Security-and-Privacy-Paradigm/book-series/ CRCIOESPP Bitcoin and Blockchain History and Current Applications Edited by Sandeep Kumar Panda, Ahmed A. Elngar, Valentina Emilia Balas, and Mohammed Kayed MATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of MATLAB® software or related products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MATLAB® software. First edition published 2020 by CRC Press 6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742 and by CRC Press 2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN © 2021 Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, LLC Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material repro- duced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, access www.copyright. com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact mpkbookspermis- [email protected] Trademark notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. ISBN: 978-0-367-90100-4 (hbk) ISBN: 978-1-003-03258-8 (ebk) Typeset in Times by codeMantra Dedicated to my sisters Sujata and Bhaina Sukanta, nephew Surya Datta, wife Itishree (Leena), my son Jay Jagdish, and my late father Jaya Gopal Panda and late mother Pranati Panda. Sandeep Kumar Panda Dedicated to my parents, my brother, my sisters, and also to my kids Farida and Seif, your smile brings happiness in my life. Ahmed A. Elngar Contents Preface.......................................................................................................................ix Editors ....................................................................................................................xiii Contributors ...........................................................................................................xvii Chapter 1 Bitcoin: A P2P Digital Currency .........................................................1 Sathya A.R. and Ahmed A. Elngar Chapter 2 Exploring the Bitcoin Network ..........................................................23 Sathya A.R. and K. Varaprasada Rao Chapter 3 Blockchain Technology: The Trust-Free Systems ..............................37 Sathya A.R. and Ajay Kumar Jena Chapter 4 Consensus and Mining in a Nutshell ..................................................55 Sathya A.R. and Santosh Kumar Swain Chapter 5 Blockchain: Introduction to the Technology behind Shared Information .........................................................................................65 Naseem Ahamed Chapter 6 Growth of Financial Transaction toward Bitcoin and Blockchain Technology .........................................................................................79 Chiranji Lal Chowdhary Chapter 7 A Brief Overview of Blockchain Algorithm and Its Impact upon Cloud-Connected Environment ..........................................................99 Subhasish Mohapatra and Smita Parija Chapter 8 Solidity Essentials ............................................................................115 Parv Garg and Neeraj Khadse Chapter 9 Installing Frameworks, Deploying, and Testing Smart Contracts in Ethereum Platform .......................................................................137 Tushar Sharma vii viii Contents Chapter 10 Blockchain in Healthcare Sector ......................................................163 S. Porkodi and D. Kesavaraja Chapter 11 Blockchain Theories and Its Applications .......................................183 Jaipal Dhobale and Vaibhav Mishra Chapter 12 Building Permissioned Blockchain Networks Using Hyperledger Fabric ...........................................................................193 K. Varaprasada Rao, Mutyala Sree Teja, P. Praneeth Reddy, and S. Saikrishna Chapter 13 Fraud-Resistant Crowdfunding System Using Ethereum Blockchain ........................................................................................237 Sandeep Kumar Panda Index ......................................................................................................................277 Preface Globally, the industries provide employment to about 500 million people from the main business sectors which include service, retail, manufacturing, business, health care, local and central government, finance sector, etc. All of these sectors are made either automatic or semiautomatic by sophisticated business processes forming an integral part of the digital economy. In this revolution, the Internet plays a vital role in core business, and financial aspects of the digital economy are still centralized, with the help of centralized agencies such as banks and tax agencies, to authenticate and settle payments and transactions. These centralized services often are manual, difficult to automate, and represent a bottleneck to facilitating a frictionless digital economy. The blockchain technology, a distributed, decentralized, and public ledger, addresses these issues by maintaining records of all transactions on a blockchain network that promises a smart world of automation of complex services and manu- facturing processes. A blockchain network is a peer-to-peer network and does not require a central authority or trusted intermediaries to authenticate or settle the transactions. The first generation of blockchain network was coined by Satoshi Nakamoto in his 2008 white paper where the primary application of the blockchain network was the use of electronic cash or cryptocurrency called Bitcoin. The second-generation blockchain network called Ethereum was introduced in 2013. Ethereum allows a single program- mable blockchain network to be used for developing different types of applications where each application takes the form of a smart contract which is implemented in a high-level language and deployed on the blockchain network. There are very few books that can serve as a foundational text book for colleges and universities looking to create new educational programs in the areas of blockchain, smart contracts, and decentralized applications. The existing books are focused on the business side of blockchain and case study–based evaluation of applications. We have edited this book to meet the need at colleges and universities. This book can serve as a textbook for senior- and graduate-level courses on the domains such as business analytics, finance, Internet of Things, computer science, mathematics, and business schools. This book is also dedicated to novice programmers and solu- tion architects who want to build powerful, robust, optimized smart contracts using solidity, and hyperledger fabrics from scratch. This book is organized into 13 chapters. Chapter 1, Bitcoin: A P2P Digital Currency, presents an overview of digital cur- rencies, discusses the Bitcoin transactions and proof of work, reviews the Bitcoin security attacks, and illustrates the Bitcoin development environment. Chapter 2, Exploring the Bitcoin Network, describes the overall process of Bitcoin networks like transactions, digital signatures, relay networks, and Bitcoin script. Chapter 3, Blockchain Technology: The Trust-Free Systems, discusses blockchain technology in detail and highlights some of the applications in which it can be used. It also specifies some challenges and benefits of this technology that is all set to transform the digital world. ix