Solidity Programming Essentials A guide to building smart contracts and tokens 2nd Edition.pdf
- 文档编号:11505268
- 上传时间:2023-03-02
- 格式:PDF
- 页数:412
- 大小:8.62MB
Solidity Programming Essentials A guide to building smart contracts and tokens 2nd Edition.pdf
《Solidity Programming Essentials A guide to building smart contracts and tokens 2nd Edition.pdf》由会员分享,可在线阅读,更多相关《Solidity Programming Essentials A guide to building smart contracts and tokens 2nd Edition.pdf(412页珍藏版)》请在冰豆网上搜索。
SolidityProgrammingEssentialsSecondEditionAguidetobuildingsmartcontractsandtokensusingthewidelyusedSoliditylanguageRiteshModiBIRMINGHAMMUMBAISolidityProgrammingEssentialsSecondEditionCopyright2022PacktPublishingAllrightsreserved.Nopartofthisbookmaybereproduced,storedinaretrievalsystem,ortransmittedinanyformorbyanymeans,withoutthepriorwrittenpermissionofthepublisher,exceptinthecaseofbriefquotationsembeddedincriticalarticlesorreviews.Everyefforthasbeenmadeinthepreparationofthisbooktoensuretheaccuracyoftheinformationpresented.However,theinformationcontainedinthisbookissoldwithoutwarranty,eitherexpressorimplied.Neithertheauthor,norPacktPublishingoritsdealersanddistributors,willbeheldliableforanydamagescausedorallegedtohavebeencauseddirectlyorindirectlybythisbook.PacktPublishinghasendeavoredtoprovidetrademarkinformationaboutallofthecompaniesandproductsmentionedinthisbookbytheappropriateuseofcapitals.However,PacktPublishingcannotguaranteetheaccuracyofthisinformation.AssociateGroupProductManager:
RichaTripathiPublishingProductManager:
GebinGeorgeSeniorEditor:
RohitSinghContentDevelopmentEditor:
KinnariChohanTechnicalEditor:
MaranFernandesCopyEditor:
SafisEditingProjectCoordinator:
ManishaSinghProofreader:
SafisEditingIndexer:
SubalakshmiGovindanProductionDesigner:
ShankarKalbhorMarketingCoordinator:
SonakshiBubbarFirstpublished:
April2018Secondedition:
May2022Productionreference:
1200522PublishedbyPacktPublishingLtd.LiveryPlace35LiveryStreetBirminghamB32PB,UK.ISBN978-1-80323-118-ContributorsAbouttheauthorRiteshModiisatechnologistwithmorethan18yearsofexperience.HeholdsamastersdegreeinscienceinAI/MLfromLJMU.HehasbeenrecognizedasaMicrosoftRegionalDirectorforhiscontributionstobuildingtechcommunities,products,andservices.Hehaspublishedmorethan10techbooksinthepastandisacloudarchitect,speaker,andleaderwhoispopularforhiscontributionstodatacenters,Azure,Kubernetes,blockchain,cognitiveservices,DevOps,AI,andautomation.Iwanttothankthepeoplewhohavebeenclosetomeandsupportedme,especiallymywife,Sangeeta,mydaughter,Avni,andmyparents.AboutthereviewerKevinBluerisaleadblockchainengineeratConsenSys,focusingonopensourcedevelopmenttoolingsuchasTruffleandGanache.BeforeWeb3,hehadover15yearsofexperienceinsoftwaredevelopment,workingwithcompaniesacrosstheindustrialspectrum,includingMicrosoft,JPMorganChase,andViacom.Heisalsoanexperiencedtrainerandmentor,havingworkedwiththousandsofdevelopersaroundtheglobe.Kevinisalsoanactiveinvestor,photographer,andrunner.PrefacePart1:
TheFundamentalsofSolidityandEthereum1AnIntroductiontoBlockchain,Ethereum,andSmartContractsTechnicalrequirements4Whatisablockchain?
5Theneedforblockchain6Understandingcryptography7Hashing7Digitalsignatures8ReviewingblockchainandEthereumarchitecture9Relationshipbetweenblocks10Howtransactionsandblocksarerelatedtoeachother12Consensus13Proofofwork13Proofofstake16Ethereumnodes16EVM16Miningnodes17Ethereumvalidators17Ethereumaccounts17Externallyownedaccounts17Contractaccounts18Ether,gas,andtransactions18Blocks23Anend-to-endtransaction25Smartcontract26Writingsmartcontracts26Theinternalsofsmartcontractdeployment32Summary33Questions33Furtherreading33TableofContentsviTableofContents2InstallingEthereumandSolidityTechnicalrequirements36Ethereumnetworks36Mainnetwork37Testnetwork37Privatenetwork38Consortiumnetwork38InstallingandconfiguringGeth38InstallingGethonmacOS39InstallingGethonWindows39Creatingaprivatenetwork42InstallingGanache46InstallingtheSoliditycompiler50Installingtheweb3framework51InstallingandusingMetaMask52Summary59Questions59Furtherreading593IntroducingSolidityTechnicalrequirements62TheEthereumVirtualMachine62UnderstandingSolidityandSolidityfiles63Pragma63Comments64ImportingSoliditycode65Contracts66Thestructureofacontract67Statevariables69Structure70Modifiers71Events73Enumeration74Functions74ExploringdatatypesinSolidity76Valuetypes76Referencetypes77Storageandmemorydatalocations79Ruleone79Ruletwo79Rulethree80Rulefour80Rulefive80Rulesix82Ruleseven83Ruleeight84Usingliterals85Understandingintegers86UnderstandingBoolean87Thebytedatatype88Understandingarrays90Fixedarrays91Dynamicarrays91Specialarrays93Arrayproperties95TableofContentsviiKnowingmoreaboutthestructureofanarray95Enumerations97Understandingtheaddressdatatype99Workingwithmappings100Summary104Questions105Furtherreading1054GlobalVariablesandFunctionsTechnicalrequirements108Variablescoping108Typeconversion109Implicitconversion110Explicitconversion110Blockandtransactionglobalvariables112Transaction-andmessage-relatedglobalvariables114Thedifferencebetweentx.originandmsg.sender114Cryptographicglobalvariables115Addressglobalvariables116Contractglobalvariables116Recoveringaddressesusingecrecover117Summary122Questions123Furtherreading1235ExpressionsandControlStructuresTechnicalrequirements126UnderstandingSolidityexpressions126Understandingtheifandif.elsedecisioncontrol128Exploringwhileloops129Understandingthedo.whileloop131Understandingbreaks134Understandingcontinue135Understandingreturn136Summary137Questions137Furtherreading137viiiTableofContentsPart2:
WritingRobustSmartContracts6WritingSmartContractsTechnicalrequirements142Smartcontracts142Writingasmartcontract143Creatingcontracts144Usingthenewkeyword144Usingtheaddressofacontract147Contractconstructor148Contractcomposition150Inheritance150Singleinheritance150Multilevelinheritance152Hierarchicalinheritance152Multipleinheritance153Encapsulation155Polymorphism156Functionpolymorphism156Contractpolymorphism157Methodoverriding158Abstractcontracts159Interfaces160Advancedinterfaces162Library164Importingalibrary165Summary166Questions167Furtherreading1677SolidityFunctions,Modifiers,andFallbacksTechnicalrequirements170Functioninputandoutput170Modifiers172Visibilityscope175View,constant,andpurefunctions176Address-relatedfunctions179Theaddresssendmethod179Theaddresstransfermethod181Theaddresscallmethod181Theaddresscallcodemethod185Theaddressdelegatecallmethod185Theaddressstaticcallmethod186Thefallbackandreceivefunctions187Summary191Questions191Furtherreading192TableofContentsix8Exceptions,Events,andLoggingTechnicalrequirements194Exceptionhandling194Require197Assert202Revert204Try-catchinSolidity209Eventsandlogging214Summary218Questions219Furtherreading2199BasicsofTruffleandUnitTestingTechnicalrequirements222Applicationdevelopmentlifecyclemanagement222IntroducingTruffle223DevelopmentwithTruffle225TestingwithTruffle230InteractivelyworkingwithTruffle232Summary234Questions235Furtherreading23510DebuggingContractsTechnicalrequirements238Overviewofdebugging238TheRemixeditor238Usingevents244Usingablockexplorer244Summary247Questions247Furtherreading247xTableofContentsPart3:
AdvancedSmartContracts11AssemblyProgrammingTechnicalrequirements252AnintroductiontoSolidityanditsadvantages252GettingstartedwithAssemblyprogramming253Scopesandblocks256Returningvalues257Workingwithmemoryslots258Workingwithstorageslots261Callingcontractfunctions263Determiningcontractaddresses265Summary266Questions267Furtherreading26712UpgradableSmartContractsTechnicalrequirements270Learningwhatconstitutesupgradability270Understandingdependencyinjection272Providinginstanceaddressesduringcontractdeployment273Providinginstanceaddressesfollowingcontractdeployment274Reviewingproblematicsmartcontracts275Implementingsimplesolutionswithinheritance277Implementingsimplesolutionswithcomposition281Implementingadvancedsolutionsusingproxycontracts285Writingupgradablecontractswithupgradablestorage290Summary292Questions292Furtherreading29213WritingSecureContractsTechnicalrequirements294SafeMathandunder/overflowattacks294Reentrancyattack296TheEtherPotcontract297TheHackercontract299TableofContentsxiSolutionstothereentrancyproblem300Securitybestpractices304Summary305Questions306Furtherreading30614WritingTokenContractsTechnicalrequirements308Introducingtokens308ERC20Tokens309ERC20standard310ERC20functionality310ERC20events312Non-fungibletokens320ERC721322TheERC721implementation323EIP223330ERC165334Summary337Questions338Furtherreading33815SolidityDesignPatternsTechnicalrequirements340Introducingentitymodeling340Ethereumstorage341DatatypesinEthereum341UnderstandingdatamodelinginSolidity343Nestedversusreferencefields343Exploringtypesofrelationships346One-to-onerelationships347One-to-manyrelationships347Many-to-manyrelationships348Reviewingtherulesforembeddingstructures348Datacohesion349Out-of-boundsnestedstructure349Staticdatawithinanestedstructure349Thenestedstructurewillnotchangeinthenearfuture349Containmentrelationship349Havingfewrelationships350Performingdatamodelingusinganexample350Structures350Statevariables351AddingEmployees351RetrievingasingleEmployeesrecord352UpdatingEmployees352RetrievingallEmployees353xiiTableofContentsOwnershipinsmartcontracts354ExploringownershipinSolidity354Modifier356Establishingownershipofasmartcontract357Multiownership359Transferofownership361MultiSigcontracts363Transferoftheownershipofassetswithinasmartcontract364Stoppable/haltablesmartcontractpattern
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Solidity Programming Essentials guide to building smart contracts and tokens 2nd Edition tokens nd
链接地址:https://www.bdocx.com/doc/11505268.html