Foreign Guys thanks a lot for coming I Really respect you guys taking the Time Um actually excited to be right here at present this Is type of my hometown I lived in San Francisco for 5 years now I dwell in Santa Cruz so proper up the freeway Um actually excited to speak to you guys Today about uh constructing on ethereum and Uh actual briefly my identify is Kevin Jones I Actually work full-time for nginx as a Technical evangelist I've been there for Some time about seven years Um now I'm targeted on advocacy for Scaffold eath which is that this superior Toolkit that I'm going to be exhibiting you Guys at present I'm a member of the construct Guild and uh yeah scaffold youth is simply This superior toolkit that's going to Allow you to construct on prime of ethereum Quickly and simply I even have a Non-profit that I based and I additionally Help out with a solidity class for Growick so in case you're studying solidity It's an excellent type of choice to get Started and we really utilized uh some Of all of scaffoldeth and lots of the Tooling that I'm going to speak about Today after which I'm additionally a photographer Filmmaker so that you'll see me working Around photographs after this I'm capturing The occasion so in order for you a photograph come Grab me
This is all my contact data by the best way On Twitter I'm often known as crypto Mastery Underscore and once more if you wish to simply Find me and we'll chat about stuff later Today Scaffoldee's is once more it's this superior Toolkit if you wish to get began Building on ethereum it's actually the Kind of de facto option to have the whole lot Up and working in a localized Development atmosphere these are what You must get began actually to be Able to take a look at the repository Obviously it's in git open supply you Need node.js you should have not less than Version 16 or above I'd suggest Just getting the latest model which is eighteen after which you should have yarn Package supervisor uh scaffold youth Utilizes yarn as a result of yarn will set up All the dependencies for you and it'll Also has all of the scripts written for you So that you simply don't have to recollect all Of the laborious hat instructions and react Commands and totally different various things That you'd do you possibly can simply use Simple yarn instructions which can be already Written for you proper and so if you Check out scaffoldeth you're going to Get a duplicate of laborious hat working domestically On your native machine which is like Ethereum digital machine arrange and Ready to go after which we additionally deploy Act for you on low price 3000 and
Obviously the whole lot I'm going to be Showing you at present is in solidity okay Um what does it appear to be from the Developer standpoint so clearly you Need to clone the repo you do they're An set up that's going to put in all Of your dependencies for you you do a Yarn chain that's going to spin up your Evm and on an area host after which it's Going to yarn begin goes to spin up React for you and you then simply do a Yarn deploy after which it takes a duplicate of Your good contract and it pushes it to The blockchain that you simply're working and You have this sort of like play ether That's out there in laborious hat to start out Testing your assumptions in your Application proper Uh in case you're seeking to type of take a look at Your expertise I'd suggest you guys Check out speedrun ethereum it's this Awesome software constructed by Austin Griffith And the construct Guild that lets you Kind of undergo these challenges and Kind of take a look at your skills uh and when You're achieved you really if you're Done with the fourth problem you Actually get invited to the construct Guild Um and I'm going to speak about that in a Little bit in case you need assistance alongside the Way I'm going to be right here clearly additionally Austin Griffith is round so in case you discover Him he is sort of a wealth of information and Amazing he's the creator of scaffold eth
But this can be a good useful resource it has the Telegram Channel it has the GitHub it Has the readme it has just about Everything you you want in a single contact Card and it can save you this to your telephone So uh don't don't get misplaced the telegram Channel is superior there's about 2 000 Developers in it which can be constructing on Scaffoldeth Uh so I'm I'm extra of a fan of really Uh doing and exhibiting how this Works uh in actual time so once more in case you do A search on Google the very first thing for Scaffolding that's going to come back up is Going to be the GitHub repository and All of the steps that I type of went out Went by means of earlier and I'm going to go Through proper now can be found right here and Then it type of guides you thru of Like the way you edit your good contract How you possibly can edit your react software Um after which there's additionally some assets Of how you possibly can be taught solidity if You're simply getting began studying Solidity after which it really guides you To speedrun ethereum the place you possibly can be a part of The construct Guild so that is some actually Good documentation and the hyperlink to the Telegram chat can also be down right here within the Bottom and there's a fantastic docs web page as Well so there's lots of cool Integrations that we've achieved uh with Like the graph which is a very cool Implementation of the graph that runs in
Docker so in case you're seeking to get a Graph Bounty this can be a nice thought Because you possibly can simply run your sub graph Locally we even have tenderly help Like you you possibly can really authenticate Your good contract by means of them or Etherscan and so this can be a actually good Resource as effectively in case you get misplaced and also you Just need to type of learn the Documentation in case you're getting began Uh creating on ethereum and You're studying solidity solidity by Example is a very great place as a result of You can really go there and type of Copy and paste Snippets from varied Examples into your good contract and Kind of see how these work with Scaffoldeth and once more that is what velocity Run ethereum seems to be like so you possibly can Connect your pockets right here and you may Connect to metamask after which it'll Basically you possibly can undergo these Quests and you may submit your your work As you do it and it guides you thru And like the primary one that you simply do is You deploy a easy nft you then deploy A staking app then a token vendor then a Dice recreation and also you type of should hack The cube recreation it teaches you just a little Bit about Game Theory on ethereum and Then you get invited to the construct Guild So that's my present for the construct Guild Which I extremely suggest you guys do That path as a result of there's lots of cool
Stuff stepping into within the construct Uh to date the construct Guild has uh Streamed over 200 ether to builders That are constructing within the ecosystem and Doing issues for scaffold eat and There's about 584 builders within the system And there's over 500 builds of scaffold That permit you to do various things so An instance can be is in case you go to the GitHub repo and also you come up right here to the Top you possibly can really do a seek for Whatever construct you're in search of and so Like let's say you wished to do an nft There's like tons of nft examples There's like a easy nft there's a SVG Workshop that you are able to do there's a sequence Link nft a purchaser mint nft the place you possibly can Mint primarily based off the client's curiosity in An nft so there's actually cool examples For like totally different requirements which can be Already written for you proper and so That's a very good place to begin for A hackathon since you don't should do All that work and type of uh You know do all of the various things and Create the plugins and seize open Zeppelin contracts they're already there And able to go you possibly can simply take a look at That repository after which do a yarn Install all in your setup as a beginning Point and that's a superbly viable Starting level for the hackathons as Well Okay so let's really get into demo
Here so I'm utilizing tmux which is only a Terminal multiplexer in case you're not Familiar it's actually cool as a result of it Just lets you have totally different Windows open however you too can simply do This in in several terminal Windows You type of at all times have like three Windows open with scaffold eth I've gone Ahead and I've checked out the Repository right here and I've additionally gone forward And I did the yarn set up and put in All the dependencies that that takes About a minute so that you can rise up and Running however after you rise up and working You're good to go after which you possibly can spin Up your chain so we do a yarn chain and That's going to spin up a duplicate of laborious Hat localized ethereum digital machine And then I'm going to come back over to the Second window which is in the identical Directory and I'm going to do a yarn Start Right so yarn begin is definitely going to Spin up react and it's going to run it On localhost 3000 that takes a few Minute to start out up so we'll simply type of Let that sit uh after which on the final Window is the place you'll do your deploy Okay so in case you do a yarn deploy it's Going to take a duplicate of your good Contract and it's going to push it to Your laborious hat deploy it for you it's Going to inform you just like the transaction Hash it's going to inform you or the
Transaction ID and it's going to inform You the um uh the place it was deployed what The contract deal with is and it additionally You'll see that you simply're beginning to see These console logs which can be out there on Hard hat so the the the good contract Comes with it already has laborious hat Console enabled which I'll present in a sec And so you possibly can print some stuff right here and Use that as type of like a debugger Right on your on your contract and Then it additionally tells you ways lengthy it took We can see react began and we see some Read calls that have been made to the Contract that now we have and first let's Take a have a look at the Smart contract and I'm going to blow that up in atom Um any textual content editor works in case you're utilizing Vs code it'll routinely I feel Spin up a duplicate of a tough hat and it'll Automatically spin up react for you in The terminal window which is type of Useful however that may be just a little caveat Just you should understand it does that Because you would possibly attempt to open up one other Terminal and try this however that final Terminal you'll in all probability use to do your Deploys Okay so that is type of what the Structure of uh scaffolding seems to be like There's this packages folder and that's Pretty a lot the place you're primarily going To be working uh with scaffoldeeth There's particularly a tough hat folder
And then inside there there's a contract Folder proper after which now we have a duplicate of The your con your contract which is simply Kind of just like the hi there world beginning Contract we are able to see right here that we're Defining what model of solidity to make use of We can now we have a license clearly and Then we're importing the laborious hat Console in order that now we have that console Support over right here on this terminal and Then uh you might have the flexibility to do extra Imports which we're going to get to in a Second after which we this that is actual Basic good contract it's emitting effectively It's first it's establishing an occasion that Keeps observe of the deal with of the sender Of the the transaction and it additionally retains Track of a variable referred to as function and Then now we have that that type of hi there Hello World constructing Unstoppable apps Variable that we set now we have an empty Constructor we're going to get to that In just a little bit as effectively after which now we have Just this perform that permits us to Update that function proper so Um after which now we have simply come these are Like default in order that the good contract Can settle for eth and that there's a Fallback perform in case that you simply name It contract with some ether and don't Don't name a perform it'll really Like permit it to retailer that that worth Right so that cash doesn't get misplaced however Really that is type of what we're going
To be taking a look at is de facto the set Purpose after which the the precise perform Here so let's have a look at what it seems to be like When you first get into scaffold eat You'll you'll see that there's these Tabs right here within the app house is type of Where you'll construct your your undertaking This is the place you'll really begin to Write like react code and you may suppose Of it as like an software or adapt That's within scaffold eth proper and So finally if you launch to Production or mainnet you're going to Probably summary some of these items and That simply type of makes it straightforward as a result of You can construct your app right here after which it Just type of guides you want throws Shows you the place the contracts are exhibits You about variables stuff like that however What's the actually cool stuff about Scaffoldeth is it has the debug Contracts Tab and what this does is it's Basically taking your contracts ABI and It's routinely constructing a UI for you To begin testing your assumptions proper So we are able to really come right here if we wish To work together with our contract we are able to Come right here and say ethsf like this and we Can attempt to ship a transaction it's going To inform me that I don't have any fuel Right I must pay fuel to have the ability to Change the state of that variable so up Here in the fitting hand nook you'll see That there's this funds from the tap
Button you possibly can simply shortly seize some Funds from laborious hat and it's going to Inject these into your burner pockets That's one other cool factor about Scaffoldeth is it comes with this burner Wallet helps so in case you open up Another Tab and go to localhost 3000 Again you'll see that we nonetheless have Access to that pockets proper as a result of That's within this browser session But if I come over right here and say new Incognito window and go to localhost 3000 then I'm going to get a brand new blocky Blocky dude proper right here proper now we have This type of like purple man and he Doesn't have any funds however then I additionally Have this sort of inexperienced blocky dude that Is my Prime like my my what I need to Use is like my everlasting type of burner Account we might join higher masks if We wished to proper nevertheless it's very easy Just to make use of the the burner pockets Because you don't have to fret about Like nonce errors with metamask on a Local atmosphere after which we are able to additionally Do issues right here like we are able to export the Private key if we wished to we are able to Import a non-public key we are able to additionally simply Send a q cart QR code so if we need to Send some funds on like a take a look at internet which We're going to get to in a sec we are able to Change that to a take a look at internet Or we are able to additionally seize the deal with after which We can come right here to this uh type of like
Other pockets which has the all of the laborious Hat funds which has About ten thousand every and we are able to ship Some funds right here so let's seize I don't Know like a thousand {dollars} in ether And we simply did that transaction and now We'll see that our burner pockets up to date With some funds from laborious hat so it's Really straightforward simply you're up and working And prepared to start out begin testing so now If I even have some funds in my Wallet I can change that state proper I Can pay the fuel and do a transaction however That's not like an excellent type of Interesting good contract so we are able to Kind of see what it will look to to Start creating some stuff so let's go Back to right here and we have already got this uh Function and it's payable which is cool Because we are able to really like settle for some Funds there we don't have a requirement There we'll get to that however the first Thing you would possibly discover out with um with Solidity or constructing dapps is you need To have like some type of entry management And so let's let's simply arrange like a Kind of a hacky Access Control let's Let's outline an proprietor and let's seize This public key from this burner pockets That now we have proper we've obtained entry to The burner pockets and let's save that And then we are able to redeploy so in case you do a Yarn deploy once more it's going to see that We have adjustments to our good contract
And by the best way if you wish to power your Deploy you are able to do a yarn deploy Dash Reset and it'll power a brand new occasion Of your good contract and you may maintain Doing this time and again and You'll maintain getting new cases of Your good contract so we are able to see right here We'll get a brand new one and so that basically Allows you to only reset the the good Contract and begin testing your Assumptions and so now we'll see that we Have a brand new variable that we'd have Defined and now what we are able to do is say Okay effectively let's say we need to solely Allow the proprietor to set this function so We might say one thing like this require Message.sender which is the worldwide Variable that claims um who is definitely Signing the transaction will be certain that That it's equal to proprietor or we are saying uh You are usually not the proprietor like this increase all Right I don't know what I'm doing there All proper secure after which we'll redeploy Again proper And so now if I come over right here to this Kind of like uh purple blocky man I've Got some funds in my faucet proper or obtained Some funds from the tap and I need to Come in right here and say yo what's up like This And hit ship it's going to inform me you Are not the proprietor proper so I've been Able to type of arrange like Access Control actually primary entry management however
That's really not the correct option to do Access management so we are able to really do it Just a little totally different we are able to really uh Let's let's eliminate the require Statement and let's eliminate this Address and let's as an alternative do like Inheritance of an open zappen ownable Contract so in case you don't open zapline it Opens Upland is just like the de facto Standard for doing totally different Implementations or or requirements and one Of these is ownable so it has like all That performance in there for you so We can say your contract is and inherit That ownable Like this after which what we are able to do is Because it's uh it's arrange Um we're inheriting the entire the Functions which can be within this good Contract then we are able to really get entry To the modifier which is part of Ownable that's solely proprietor so we are able to Actually seize that modifier save that There after which redeploy And so now we've type of achieved the identical Thing however we've utilized open Zeppelin's Ownable contract and we'll see right here now That now we have like a brand new perform referred to as Renounce possession which is in order for you To like pull out possession from a Contract and make it dwell perpetually with No proprietor after which now we have just like the Transfer possession perform as effectively and We have that deal with so
Um we we in all probability don't need effectively first Of all you'll discover that the proprietor does Not match what I feel you'd need Because you don't have entry to this Account that is just a few type of random Account that is really coming from Hard hat so laborious hat makes use of the very First account because the deployer account And we are able to check out what that Looks like within the deploy script So proper beneath right here now we have the deploy Script and we are able to see right here that is how We're doing we're really deploying our Contract and we're establishing the the Settings for that and you may see proper Here as we're defining the deployer Which is getting uh from laborious hat all The named accounts and it makes use of the primary One after which we are able to say that it's Actually utilizing that deployer after which we Can additionally see that we might cross Arguments as effectively so like say let's say You wished to call your contract like I Don't say it's a cat's nft or one thing Like that you simply would possibly have the ability to cross an Argument in right here like this and you possibly can Pass that within the Constructor Uh we're not going to do this proper now But it's good to know that's in case you Want to cross a variable to the Constructor you are able to do that there however What I need to present you right here is that you simply Get we get a duplicate of your contract right here So const your contract after which we
Deploy the contract and now we have entry To it now in within uh JavaScript and So you'll see right here there's a there's Automatically a factor that's type of Already written for you right here I'm simply Going to repeat and paste that that permits Us to name that switch possession Function so let's go seize that deal with Here And then let's uh sorry let's paste that In right here So we're going to will we're going to do The regular deploy it's going to make use of that Hard hat account however then it's going to Call the switch possession perform Right So we're going to do a deploy reset Boom there we go and so now we see that We have entry to the good contract Again now we have entry management however once more That's it's type of like not a very Interesting factor as a result of why would we Want to have a perform that solely the Owner might name so I'd reasonably present you Like type of how one can begin utilizing the Smart contract as a financial institution proper so let's Let's do one thing like that allow's let's Uh open up the good contract let's Close the deploy script uh and let's Let's as an alternative let's set a variable so We'll take about take away the one Owner modifier and as an alternative we'll Define A value variable so we'll do a UNS Public and we'll name it value and we'll
Set it to uh no matter ether we wish so We'll do .001 ether like this and what This goes to do is it's simply going To create a variable that has the worth And by the best way like I've my ID arrange So it tells me just like the calculation of What how a lot ether is to how a lot weigh So and I'll get to that in a second however You can you possibly can write manner right here otherwise you Could write ether Um we're going to do ether as a result of it's Easier proper to learn so um after which what We can do is as an alternative do a require Statement right here that claims all proper let's Require that the message worth of the Smart contract is the same as the worth Otherwise we're going to say Um you're broke Something like that uh and save that And then deploy that And so now we already had this and it's Important that in case you're going to do That with a a perform you should make Sure it's payable nevertheless it was already Payable so we all know now it that we are able to Accept some worth on this function so if I come over right here now and I need to Change this to uh SF like this and I strive To hit ship it's going to inform inform me That I haven't ship any cash So now I can come right here and I can do 0.001 ether proper right here click on the little Green button and what this inexperienced button Does is it simply calculates the quantity of
Way that I must ship within the Transaction so it simply multiplies it by 10 to the 18th energy and so anytime You're deploying on or making Transactions you do it in manner so Obviously you wouldn't need your consumer to Have to sort out manner so you'd do That type of calculation within your Application utilizing ether's JS there's Support for that after which now if we hit Send it's going to permit us to do this Right and so now we see that the good Contract really has some worth proper It's obtained a greenback 65 however at this level The it's type of black gap it's caught In the contract as a result of now we have no manner To actually get the funds out proper so the Next possible factor can be that you simply Would really write a withdrawal Function so we are able to try this we are able to say Function withdraw Like this and we are able to make it public and We can so we are able to do like set a Boolean Called success and in any other case we is not going to And then we are able to achieve this once more Message.sender is the individual that's Calling the good the the transaction Right calling that that perform and we Can do what's referred to as a name and we are able to Send uh set the worth because the steadiness of The the good contract so it's deal with Dot this dot steadiness I consider after which I feel we have to do that I'm gone increase okay however we don't need
Anyone to have the ability to entry all of the Funds proper we're on the good contract We need to make some type of perform And variable so we might really hear We can use that solely proprietor like this Right And save that But you see what we're doing is we're Getting in this sort of mode the place we're Making adjustments of our good contract Inside of uh your your solidity code You're coming over right here you're deploying Your your subcontra or your good Contract and you then're type of like Testing your assumptions proper and so Now we'll see now we have this withdraw Function so if I come over right here and I'm I'm this sort of like purple blocky dude I'm utilizing this dap and I'm like okay yo What's up I'm going to ship some worth And we might simply copy this from right here to Here and ship cool I've I've modified the The function to yo what's up after which I'm Like oh I need to seize all these funds So I can attempt to say ship and it's going To inform me that you simply're not the proprietor Right as a result of now we have the entry management Set up but when I come over right here it's obtained Funds in there I can hit that withdraw Button and I used to be in a position to withdraw these Funds as a result of I personal this this public and Private key pair and I used to be in a position to name That good contract okay Um I need to present briefly like type of
Like uh the react code just a little bit as Well as a result of um I feel it's it's very Useful uh actual shortly what I additionally need To say is such as you all of the stuff that We're doing right here is like localhost proper Um in some unspecified time in the future you in all probability need to Deploy your software to perhaps a take a look at Net particularly in case you're such as you're in The hackathon and also you need to do it to Like polygon proper you would possibly need to Deploy it to polygons so proper now we're Using uh the laborious hat accounts proper you Wouldn't need to use that in case you're Deploying to a take a look at internet as a result of the the Public key or the non-public key might be Compromised so you'd really need To do what's referred to as yarn run generate On right here and what that's going to do is It's going to spin up or it's going to Create a mnemonic and it's going to Store that within the root of your Application right here you possibly can see I've a Couple of them right here and so these are the Root mnemonics I'm not going to click on on Them as a result of there's there's really Like the mnemonic the password after which You can run yarn account like this and You can principally get a QR code on your Account so it takes your public deal with Creates a QR account after which it additionally Goes out and checks the balances Um of various totally different chains that You're on proper so what I at all times do is Another cool uh software that's really
Built by the construct Guild and Austin Griffith is known as a punk pockets so I Just at all times have a punk pockets on my Phone after which it's obtained just a little scan Feature so I can say permit and what I Can do is true now I can ship simply by Scanning this oh I obtained to redo it once more And I simply have this pre-loaded with Some like testnet ether I even have some Like polygon Mumbai stuff on right here as Well and so now I've entry to that And I might ship some ether to it proper And then I've a deployer account that Is generated and I'm in a position to deploy my Account after which if you wish to deploy Like I might deploy this proper now to uh Well really let me let me ship some Eth4 for it first so we'll go to go Early and we'll go I'll ship uh let's See right here Let's do I don't know 0.01 eth hit ship All proper seems to be prefer it's going so I used to be Able to ship some funds from my pockets We ought to have the ability to see that gorilla Has some steadiness nope not but Try it once more No it's not working It's pending So it would take a second however then we Can do what's referred to as a yarn deploy once more But we are able to select the community so we are able to Do Network go early like this And simply with that one command let's see
If it really succeeds it's going to Try to ship the transaction And we're deploying our contract It seems to be prefer it labored I feel it's considering go early is a Little sluggish at present normally it's rather a lot Faster whereas that's doing that I additionally Want to point out actual fast uh within the UI you Might need to take your react app And replace it to a take a look at internet as effectively so Inside this app GSX file after which inside Views so app.js really is that type of Main element for scaffold eth and if We scroll down there's simply this one Section the place we are able to change the default Network to vastly like this put it aside and Then we are able to refresh our app and so now We ought to if it's efficiently deployed Which it's not I'm unsure why it's not Deploying Live demos generally they don't work Yeah I'm unsure why it's not not Working it might be that I'm not oh There it goes lastly went so I deployed The good contract to go early and now I Have a duplicate of this good contract and I've refreshed my app and my app can also be Ongoerly so now I might really join My metamask let's do it let's swap to Go early And swap the community so now I've a Bunch of gwarly eth proper let's do it Here let's set the aim to uh Scaffold is superior really let's do
Scaffold eth Like that and let's be certain that we ship Some worth Boom ship And then the The Next Step I'm working Out of time however the subsequent step can be That you'd perhaps need to ship your App to Um another like internet hosting service Because proper now we're working domestically And you are able to do that uh immediately by means of Here as effectively you are able to do what's referred to as Yarn construct which goes to take a duplicate Of your react app and it's going to Build it and make it optimized after which You can do a um You can do a yarn uh sorry CD initiatives Ethereum scaffoldeth then you are able to do a Yarn Um So I'd prefer it proper now you are able to do a Yarn surge which can put it on a surge Endpoint in case you're not aware of Surge it's type of like a easy like Static internet hosting service or you possibly can additionally Do it to ipfs with yarn ipfs so you might have Kind of some choices of the way you need to Deploy your app however this takes some time To achieve this sadly it's not going to Finish in time Um however yeah that scaffold Ethan in a Nutshell I do have a pair minutes I Have one minute for questions so I'd Love to see in case you guys have any
Questions about it Got to be one query come on What yeah so there's a so underneath the Docs uh there's a tenderly type of like Walk by means of there's like a video and it Tells you confirm untenderly Um principally it's it's important to like Create this sort of script within Your deployment script Um and I feel it's important to do previous like An API key I consider uh as effectively in order that The directions are right here nevertheless it's Really the one actually factor is that You're you're Um like authenticating your good Contract by means of uh tenderly uh not less than I feel that's the one present Integration yeah you too can do with Etherscan as effectively so there's both Ether display screen ether stands just a little bit Easier as a result of you possibly can simply do yarn Verify after which cross the the community Here that you simply're utilizing and you then additionally Think it's important to replace effectively you must Update your laborious hat config additionally with Your API key for etherscan as effectively Um yeah that's an excellent query Any different questions No superior thanks guys a lot for Coming and I'll be round so in case you want Anything let me know