Textbooks in Telecommunication Engineering Mubashir Husain Rehmani Blockchain Systems and Communication Networks: From Concepts to Implementation Textbooks in Telecommunication Engineering SeriesEditor TarekS.El-Bawab,ProfessorandDeanofEngineering, AmericanUniversityofNigeria,Yola,Nigeria Dr. Tarek S. El-Bawab, who spearheaded the movement to gain accreditation for the telecommunicationsmajoristheserieseditorforTextbooksinTelecommunications.Please contacthimattelbawab@ieee.orgifyouhaveinterestincontributingtothisseries. TheTextbooksinTelecommunicationsSeries: Telecommunicationshaveevolvedtoembracealmostallaspectsofoureverydaylife,including education, research, health care, business, banking, entertainment, space, remote sensing, meteorology,defense,homelandsecurity,andsocialmedia,amongothers.Withsuchprogress in Telecom, it became evident that specialized telecommunication engineering education programsarenecessarytoacceleratethepaceofadvancementinthisfield.Theseprograms willfocusonnetworkscienceandengineering;havecurricula,labs,andtextbooksoftheir own;andshouldpreparefutureengineersandresearchersforseveralemergingchallenges. TheIEEECommunicationsSociety’sTelecommunicationEngineeringEducation(TEE) movement,ledbyTarekS.El-Bawab,resultedinrecognitionofthisfieldbytheAccreditation BoardforEngineeringandTechnology(ABET),November1,2014.TheSpringer’sSeries Textbooks in Telecommunication Engineering capitalizes on this milestone, and aims at designing, developing, and promoting high-quality textbooks to fulfill the teaching and researchneedsofthisdiscipline,andthoseofrelateduniversitycurricula.Thegoalistodoso atboththeundergraduateandgraduatelevels,andglobally.Thenewserieswillsupplement today’sliteraturewithmodernandinnovativetelecommunicationengineeringtextbooksand willmakeinroadsinareasofnetworkscienceandengineeringwheretextbookshavebeen largely missing. The series aims at producing high-quality volumes featuring interactive content;innovativepresentationmedia;classroommaterialsforstudentsandprofessors;and dedicatedwebsites. Book proposals are solicited in all topics of telecommunication engineering including, butnotlimitedto:networkarchitectureandprotocols;trafficengineering;telecommunication signaling and control; network availability, reliability, protection, and restoration; network management; network security; network design, measurements, and modeling; broadband access; MSO/cable networks; VoIP and IPTV; transmission media and systems; switching and routing (from legacy to next-generation paradigms); telecommunication software; wireless communication systems; wireless, cellular and personal networks; satellite and space communications and networks; optical communications and networks; free-space optical communications; cognitive communications and networks; green communications and networks; heterogeneous networks; dynamic networks; storage networks; ad hoc and sensor networks; social networks; software defined networks; interactive and multimedia communications and networks; network applications and services; e-health; e-business; big data; Internet of things; telecom economics and business; telecom regulation and standardization;andtelecommunicationlabsofallkinds.Proposalsofinterestshouldsuggest textbooksthatcanbeusedtodesignuniversitycourses,eitherinfullorinpart.Theyshould focusonrecentadvancesinthefieldwhilecapturinglegacyprinciplesthatarenecessaryfor studentstounderstandthebasesofthedisciplineandappreciateitsevolutiontrends.Books inthisserieswillprovidehigh-qualityillustrations,examples,problemsandcasestudies. Forfurtherinformation,pleasecontact:Dr.TarekS.El-Bawab,SeriesEditor,Professorand DeanofEngineering,AmericanUniversityofNigeria,[email protected];orMaryJames, SeniorEditor,Springer,[email protected] Moreinformationaboutthisseriesathttp://www.springer.com/series/13835 Mubashir Husain Rehmani Blockchain Systems and Communication Networks: From Concepts to Implementation MubashirHusainRehmani DepartmentofComputerScience MunsterTechnologicalUniversity(MTU) Cork,Ireland Additionalmaterialtothisbookcanbedownloadedformhttps://www.springer.com/ book/9783030717872 ISSN2524-4345 ISSN2524-4353 (electronic) TextbooksinTelecommunicationEngineering ISBN978-3-030-71787-2 ISBN978-3-030-71788-9 (eBook) https://doi.org/10.1007/978-3-030-71788-9 ©SpringerNatureSwitzerlandAG2021 Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpartof thematerialisconcerned,specificallytherightsoftranslation,reprinting,reuseofillustrations,recitation, broadcasting,reproductiononmicrofilmsorinanyotherphysicalway,andtransmissionorinformation storageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilarmethodology nowknownorhereafterdeveloped. Theuseofgeneraldescriptivenames,registerednames,trademarks,servicemarks,etc.inthispublication doesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexemptfromtherelevant protectivelawsandregulationsandthereforefreeforgeneraluse. Thepublisher,theauthorsandtheeditorsaresafetoassumethattheadviceandinformationinthisbook arebelievedtobetrueandaccurateatthedateofpublication.Neitherthepublishernortheauthorsor theeditorsgiveawarranty,expressedorimplied,withrespecttothematerialcontainedhereinorforany errorsoromissionsthatmayhavebeenmade.Thepublisherremainsneutralwithregardtojurisdictional claimsinpublishedmapsandinstitutionalaffiliations. ThisSpringerimprintispublishedbytheregisteredcompanySpringerNatureSwitzerlandAG Theregisteredcompanyaddressis:Gewerbestrasse11,6330Cham,Switzerland ThisbookisdevotedtomydearestSheikh, Grandmother,Father,Mother,andBrother! Preface Internet has been used to share information among different parties. For instance, customersmakeonlinetransactionsinbanks,onlinebuyingandselling,management ofdigitalcurrencies,andfinancialtransactionsarefewexampleswhereinformation issharedamongdifferentparties.Traditionalwayofdoingthesetransactionsrequires thepresenceofthetrustedthirdparty.Blockchain,intheabsenceofthistrustedthird party,permitscommunicatingpartiestointeractwitheachother.Blockchainisbasi- callyadistributedanddecentralizedpublicledgersystemusedformaintainingthe transactionsrecordoverseveralcomputers(blockchainnodes).Infact,Distributed LedgerTechnology(DLT)ensurestheavailabilityofmultiplecopiesoftheidentical ledgerdistributedacrossvariousplaces.Ifanychangehappensinanyplaceinthe ledger,itwillbereflectedinalltheplaces. Blockchainhasbeenappliedtonumerousapplicationsareasrangingfromhealth sector to transportation and from financial sector to energy management systems. Thiswideapplicabilityofblockchaintechnologyisduetoitsinherentfeatureslike decentralization,auditability,andfaulttolerance.Blockchaincanplayavitalrolein communicationnetworksaswell.Let’stakeanexampleofInternetofThings(IoT). InIoT,blockchaincanbeusedforadecentralizedfabricfortheIoT,withnomanaging orauthorizingintermediaries.Similarly,blockchaincanalsoprovideIoTidentityand datamanagement,privacy,trustlessarchitecturesandsecuredcommunications,and monetizationofIoTdataandresources. Consideringtheaforementionedapplicationsandtheimportanceofthistopic,I havebeenworkingonthistopicwithmyresearchcollaboratorsandPh.D.students sinceJanuary2018.Inordertoequipmyselffullywiththeadventofthistechnology, Itriedtotakedifferentonlinecourses,attendedseveralwebinars,andreadseveral books on this topic. In addition to this, without exaggeration, I read hundreds of research papers on this so-called disruptive technology blockchain. Fortunately, I had been given a chance to design two modules on distributed ledger technology. Thefirstoneisfortheundergraduateprogramsonblockchainandthesecondoneis ondistributedledgertechnologyforgraduateprograms,bothattheDepartmentof ComputerScience,MunsterTechnologicalUniversity(MTU),Ireland.Themodule distributed ledger technology had to be delivered to programs such as Masters in ArtificialIntelligence,MastersinCloudComputing,andMastersinCybersecurity. vii viii Preface Both proposed modules were accepted and became the part of the curriculum at MTU. I wanted to design a module which not only provides solid theoretical back- groundtostudentsbutalsoenablesthemtoeasilythinkaboutblockchainrealization anditsapplications.Moreprecisely,questionslike:howwecanadoptanyspecific blockchain architecture to a specified application and which consensus algorithm canbeusedineachapplicationscenario?Whatarethesecurityandprivacyconcerns associatedwitheachtypeofblockchaindesign?Allthesequestionsweredispersed andcanbefoundindifferentresourcessuchasbooksandresearchpapers.However, there was not a single source which completely answers all these questions to the extentinwhichIwassearching.Ontopofit,themainaspectwhichIwaslooking forwasthecodingaspect–inordertogiverealsenseofusingblockchaintostudents. SincethemodulethatIdesignedhasfivecredithours,i.e.,ithas2hoursoflabin eachweek(integralpartofthismodule),therefore,Irealizedthatnotasingleeasy- to-use resource or book is available that helps students to understand the working of blockchain. For instance, how hashing can be implemented? What will be the impactifblocksgettamperedbyanyone?Howwecanimplementdifferentconsensus algorithms?Howblocksarevalidatedandbroadcast?Allsuchquestionsspanning fromtheoreticalconceptstotheirimplementationwerenotavailableinasinglesource sothatonecaneasilyunderstandthisblockchaintechnologyandeasilyimplementthe ideaspresentedthereinbyusinganopensourceprogramminglanguage.Moreover,a textbookonapplyingblockchaintechnologyforcommunicationsystemsismissing. Therefore, considering this gap, I was motivated enough to think about writing a textbookonblockchaintechnologywhichnotonlyprovidestheoreticalknowledge tothestudentsbutalsohelpsthemunderstandbasicideasbyimplementingthem. IwouldliketothankMuneebUlHassanwhohelpedmeinthepreparationoflab materialfortheabovemodules,whichIthenusedasabasistoexplainblockchain concepts from the implementation perspective in this book. Without the help of MuneebUlHassan,Imaynotbeabletoproducesuchaneasyandunderstandable sourcecode.Finally,IwouldliketothankProf.TarekEl-Bawab,whoinvitedmeand gavemetheopportunitytopublishthisbookunderTextbooksinTelecommunication EngineeringbySpringer. I would like to say my special thanks to Tim Horgan—Head of Faculty of Engineering and Science at Munster Technological University (MTU) and Donna O’Shea—Chair Cybersecurity and the former Head of Department of Computer Science at MTU. I remember, we all were taking tea together after a meeting and thereTimandDonnasuggestedmetoprepareamoduleonblockchaintechnology. This was the time when I seriously started thinking about writing a textbook on blockchaintechnology. ThisbookisparticularlywrittenfortheComputerScienceandTelecomstudents. This book in fact can serve as a step-by-step hands-on tutorial for designing and implementingblockchainsystemsbesidesbuildingconcreteblockchaintheoretical knowledge.Tosupportfurtherreading,fewinterestingthingshavebeenincludedin each chapter: further reading section (what to do next?), research directions, basic definitions,programmingtips,labs,andself-assessmentexercises. Preface ix Theobjectiveofthisbookistoprovidedetailedinsightsonblockchainsystems, starting from its historical perspective and moving toward building foundational knowledgeaboutblockchainsystems.Thisbookalsocoversblockchainsystemswith emphasisonapplicationstoimplementationconsideringCommunicationNetworks andServices,ratherthanbookswhichonlycoverseitherblockchainarchitectures, cryptocurrencies,oraboutbuildingblockchainprojects.Thisbookalsodiscussesthe technologiesrelatedtotheintegrationoftelecommunicationsystemsanddistributed ledger technology (blockchain). This book bridges the divide between the fields of telecommunication networks (including computer and mobile networks) and blockchain systems, while focusing on the applicability of blockchain in different applicationsdomainsanditsimplementation. Thisbookisorganizedintothreeparts: (cid:129) PartI:“BlockchainSystems:Background,Fundamentals,andApplications” (cid:129) PartII:“Hands-onExercisesandBlockchainImplementation” (cid:129) PartIII:“BlockchainSystemsandCommunicationNetworks” Part I: “Blockchain Systems: Background, Fundamentals, and Applications” consistsoffourchapters.InChap.1,blockchainintroductionisprovided.Chapter2 discusses the differences between database management system and blockchain. BlockchainfundamentalsandworkingprinciplesarediscussedinChap.3andfinally, Chap.4isdedicatedtoconsensusalgorithmsinblockchainsystems.PartII:“Hands- onExercisesandBlockchainImplementation”consistsofonechapter(Chap.5)in whichtwominiprojectsarepresented.Moreover,thischapteralsocontainsfivelab implementationsalongwithdesiredprogramoutputandsamplecode.Finally,inPart III:“BlockchainSystemsandCommunicationNetworks”,twochaptersareincluded. Thefirstchapter(Chap.6)discussescognitiveradionetworksandblockchain.The second chapter (Chap. 7) talks about communication networks and blockchain in generalcoveringvariouscommunicationnetworkssuchasWi-Fi,cellularnetworks, cloud computing, Internet of Things, software defined network, and smart energy networks. Ihopeyouwillenjoyreadingthisbookandfinditbeneficial,particularlyfrom hands-onexercisesandtheimplementationpointofview. Cork,Ireland MubashirHusainRehmani February2021 Acknowledgements IwouldliketoexpresssincerethankstoAllahSubhanahuWa-ta’alathatbyhisgrace andbountyIwasabletowritethisbook. IwishtoexpressgratitudetoSheikhHazratMuftiMohammadNaeemMemon Sahib Damat Barakatuhum of Hyderabad, Pakistan. I could have not written this bookwithouthisprayers,spiritualguidance,andmoralsupport. I also want to acknowledge my family, especially my wife, for her continued supportandencouragingwordsthathelpedmetocompletethisbook. Lastbutnotleast,IalsowanttothanksSaad,Maria,andAamirfortheirpatience andsupportduringthewrite-upofthisbook. xi