So I'vecompiledthismultiparttutorialSiri's intoonemassivevideoforfreecodecampandyoucanfollowalongwiththecodeexamplesstepbysteponmywebsite.
There's anarticlethat I'm gonnaput a linktodownthedescriptionbelow.
Andfinally, ifyou'reseriousaboutbecoming a Blockchaindeveloperneededormyfreetrainingonmywebsiteover a Daphuniversitydotcomforwardslashbootcampand I alsoput a linktothatdescription.
Jame, it's a contractorread a languagewhichbasicallymeansthatyouknow, smartcontractsarethemainwaythatyouorganizecodeandlikestoreddataandwriteallofyourprogramminglogicandyouknowit's a highlevellanguageforimplementingthesesmartcontracts.
Itlooks a lotlikeJavascriptand, youknow, pythonand C plusplus, asyouseerighthereandit's usedtorunontheEthereumvirtualmachine, whichisbasically, youknow, thethingthatrunsthecodeontheethereumBlockchain.
Sosolidityisstaticallytyped a supposedto a dynamicallytypelanguageanditssupportstufflikeinheritancelibrariesandlotsofotherstuff.
Justreadthisvalueso I candothisbywriting a functionandsoliditylikethis.
Westartwiththefunctionkeyword I saywecallthefunction, getit's gonnagetthisvalue, andwe'llsayWe'lljustopenthebracesfornowandwritesomemorecodeherein a secondseason.
Warningscomingup.
But I'llfillthisoutmorewillsay, justreturnaboutyou.
Andthisvalueslittingknowsthatit's just a localvariablebecause I passitinand I, youknow, pretendeditwithanunderscorelikethisandalsonoticedthat I declarethedatatypeofthefunctionargument.
I'm justgoingthiosayJavaScriptvirtualmachine, whichbasicallywhatthat's gonnadoisgiveus a testBlockchaininthebrowsersowedon't havetoconnectto a Blockchainofanykind.
That's howyoucanwriteyourfirstsmartcontractinthesolidityprogramminglanguageagain, that's supposedtobejust a highleveloverviewofsolidityandhowtogetstartedridingyourfirstmarkcontractsandusingtheprogramminglanguageitselfandusingtheremix I t e inyourbrowsertogetstartedeasilywithouthavingtodownloadanytoolsoranythinglikethat.
Thefirstthing I wanttodointhisvideoisactuallyupdatethesmartcontractcodethatwewroteinthelastvideotosupportthenewestversionofthesolidityprogramminglanguage, whichis 0.5 umdotone.
I believeyoucanactuallyseethecompilerversionoverhearschangedinthelastvideo.
Let's dowaitingandthen I'llsay I create a functiontoactivateit.
Itwas a activateas a publicstateequalsSTdotactivesowecanactuallychooseSorry, wecanchoosethisvalueoutofhisIndianlistandupdatethestatetothatvalue.
Allright, sonowwecallthisfunction, itwillchangethestatetotheactivestateandlet's get a functionthatcheckstoseeifthestateisactivewas a functionisactiveandwas a publicviewreturnsboom.
I'm justgonnamodel a personwithDestructisgonnahave a fewattributes.
Gonnahave a firstnameattribute.
That's goingtobe a stringand a lastnameattribute.
That's alsogoingtobe a string.
AndwecanputthesStruck's insideof, like, a raiseandmapping.
Andthingslikethatwillshowyouthatherein a minuteandsawthisvideo.
Butfornow, justknowthatwedeclarethatwe'vedefinedthisnewdatatypepersoninsidethesmartcontractwithDestructthat's gonnahave a firstnameandlastname.
Okay, solet's actuallyah, create a functionthatallowsustoinStansky a newpersoncreate a newoneandwanttokeeptrackof a bunchofthesepersonsStruck's insideof a peoplearray.
Allright, sowhat's itlikethisLet's say, Let's keeptrackofof a bunchofdifferentpersonsthatwecancreatenewones.
Person.
Sobeing a raypublicpeopleAllright, sowe'llseewhat's happeninghere.
Peopleisjust a variablehereinitsinitspublic, soyoucanreaditoutsideofsmartcontract.
Thenextthing I wanttoshowushowtodo a similarconceptherebutmodel a littledifferently.
Soinsteadofdizzyingarray, wereactuallyuse a mapping.
Sowhatisit?
Mapping?
A mappingisbasicallylikeanassociativearray.
Soinsteadofhavingyouknow, justinarray, um, andweknowtheeachindexoftheitemintheray, wecanactuallyassociateto a valuesthat's that's like a hashtableor a hashmapor a hash, um, andotherprogramminglanguagesthatyoumightbefamiliarwith.
We'lljustmakethis a functionandwecancallitinternal.
That's a differentmodifier.
We'lltakethis.
Peoplecountwillpay.
Sitinsideofhere.
Allright, well, justsayincrementcount.
Callthatfunctionandwe'rerunning.
Seethesmartcontract?
We'lladdThepersonwas a dapgroupsYup, universityand I'llclickAddpersonAndtherewegoIt a committedthecountYoucanseethepeoplecounthasbeenchangedIt's a JoehelloandthecowschangedSothat's thewaythatyoucan, youknow, useotherfunctionsthey'regoingtointernalAndwecouldseethisincrementcountfunctionisn't addedtothislistoverhereisnotexposedtoYouknowthingsoutsideofthesmartcontract, externalcollarscan't useit.
Sobasicallywehaveaccesstoinitiate a sender, andthisisbasically a specialAh, nothinginsideofsoliditythattellsustheaccountinhisaddress, Whocalledthefunction?
Andbasically, wecanjustsay, youknow, isthispersontheownerwecouldjust, youknow, compareequalityofthepersonwho's callingthefunctionwiththisownerthatwe'regonnastoreherein a second.
Allright.
Andifthey'renot, weactuallywon a throwingerror.
Allright, sothisisgoingtoshowyouanotherconsequencesolidityabouterrorhandlingsowecanthrow a nearerandsoliditylike, youknow, I thinkearlierwehadsomeerrorshappen.
I'm gonnashowyou a littlecodeformattingthat I'd liketodo.
Sometimesit's gettingkindoflong.
Andsometimes, youknow, ifyou'relikeme, youhave a texteditorwiththewholebunchofpainsopen.
I hadtokeepmycolumnskindofshortsometimesespeciallysolidity.
Anditkindofmakesiteasiertomaintainthesefunctionswhentheargumentsaregettinglongandusinggetandthingslikethat, sometimes I willjustbreaktheseuplikethis, allright?
Andthen I'llactuallyputthemodifiers.
Youhave a bunchofmodifier.
Sometimesitmakesiteasiertoread.
Andalso, when I'm runningmyownsoliditysourcecode, I onlyusedtwospaces I don't useforYeah, that's sometimeshowbreakthesefunctionsupso I canseethefunctionnameandthenthearguments, um, that I canseethemodifiers, andthen I couldactuallyseethecodethatgetsexecutedinsidehere.
And I canmakeyoursmartcontractkindoflong, butitcanbesometimesthiswillcatchyou.
What I showyoufirstishowtoright a functionthatacceptsether.
So, basically, like, howcanwesendetherinwhenwecallfunctionanddostuffwithit?
Soshehadtodothatfirstcreativefunction, Uh, calledbytoken, Say, bytoken, Andthisfunctionisgoingtokindofemulatewhathappensinan I c e o like a crowdsaleor a prettysaleorsomethinglikethaton a theory.
Um, whereyou'rebuying E r.
C 20 tokens.
I'm notgonna, likecodeoutanentire e r c 20 tokensmartcontractrighthereor, youknow, cutout a crowdsale.
Smartcontract.
I'vegotseveralothertutorials.
ShowyouhowtocoachmanCryptocurrencyon a theory.
Um, well, youknow, buildingYRC 20 tookandstepbystepandin a realworldcrowdsalethingslikethatsoyoucancheckouttheothervideosifyou'reinterested.