Current location: Current location: Home > news > Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep69 Text
Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep69
[news] Time: 2025-07-11 11:44:56 Source: AIHackNode Author: java Click: 108 times
to get the API locatedat/ simple storage uncoresoulcore simple storage. Ai and deep learning tutorialsthenwe're going to do a comma ofutf8 this utf8 is the encoding that wedo for this file here don't worry toomuch about what that means for now so weneed the ABI and we also need thebinary which is in this second filesimple storage soulor simple storage.binso we're going to say cons binary equalsfs. read file sync going to give it thepath here which is going to be slashsimple storage Soul simplestorage.bin and then the encoding optionwhich again is going to be and it shouldlook like this now that we have thebinary we have the ABI we can createsomething called a contract Factorywhich is not to be confused with thefactory pattern in ethers a contractFactory is just an object that you canuse to deploy contracts so we're goingto say constcontract Factory equals new ethers docontractfactory and we're going to pass it theABIbinary and the wallet we pass the ABI sothat our code knows how to interact withthe contract the binary obviouslybecause this is the main compiled codein our wallet so that we have a privatekey we can use to sign deploying thiscontract then I usually like to write alittle console.log saying something likedeploying pleasewait and we can actually deploy thiscontract with ethers by doing constcontract equalsawait contractfactory. deploy now this is the firstfirst time we've seen this await keywordand you can only use the await keywordinside of an async function the reasonwe want this await keyword we're tellingour code to stop here wait for contractto deploy and this await keyword meansthat this will resolve the promisecontract and this contract factory.deploy with the await here returns acontract object so now I can dosomething likeconsole.log contract let's see whathappens when we run this code nodedeployJS we scrollup we see deploying please wait and thenwe see this massive object that getsprinted out this is the contract objectthat we just deployed and in fact if wego over to our ganache we can see thatthe address that we use for our wallethas a little bit less balance and has atransaction count of one if we wereworking with truffle we'd be able to seethe contracts here we're working withhard hat so you won't be able to see thecontracts in here but if you go totransactions we can indeed see thetransaction that we just created this issimilar to Ether scan but for our localblockchain we can see the sender addressthe creation address the value gas priceall this stuff associated with thiscontract you can also see the differentblocks since we've only made onetransaction only one block has beenmined and this is awesome we have allthis other stuff associated with itgreat job you just deployed a contractto your own local blockchain withether's JS this is fantastic awesomework now let me show you what happens ifwe don't use the await keyword herewe're not telling our code to stop we'resaying hey deploy this contract and thenjust keep going so we never actuallycheck to see if this deploy functionfinished so let's see what happens whenwe run this instead instead of that bigcontract object we get this promise inits pending State because our codeactually finished before our contractcould finish deploying so we see promisepending here instead this is why theawait keyword is so important we'resaying hey wait for this to finish theawait keyword also resolves a promise soit'll wait for the promise to exit itspending State and then it'll returnwhatever the pending promise returns socontract factory. deploy returns apromise that returns a contract in factif we go to the ether's documentation welook up deploy in here we can seecontract Factory methods contractfactory. deploy if we look at thedefinition of the function it sayscontract factory. deploy takes a wholebunch of arguments and some overridesthis arrow is saying this is what itreturns it returns a promise thatresolves to a contract and that's why weneed this await keyword because contractFactory to deploy by itself just returnsa promise but if we do await contractfactory. deoy we're saying it returns apromise that resolves to a contract andwe're waiting for it to finish deployingto resolve to a contract object sothat's going to be a major differencehere awesome work so that's going to bewhy this await keyword is so importantand again you can only do that inasynchronous functions so you need thisasync keyword at the top of yourfunctionnames awesome work so we've deployed acontract to our ganach chain this isfantastic let's play with this a littlebit more so what else can we do rememberhow in remix and in metamask we couldadd a whole bunch of stuff we could adda gas limit we could add some value whenwe were doing our transact we couldpress the transact button we know thatwhen we're working with metamask and wewant to send some money between ouraccounts we can actually choose our gasprice our priority fee all this otherstuff we can actually do all that inethers as well so if we wanted to awaitcontract Factory to deploy but with acertain gas price we could add theseoverrides in this deploy function hereanother really neat trick that yourVisual Studio code might have is if youclick command or control depending onyour setup you can actually click into afunction and see where it's defined andsee everything about this function so ifI command clicked I could see that I'mnow in node modules ether's projectcontract source. TS all this stuff and Ican see exactly the function definitionof this deploy function on the contractFactory object which shows us the samecode as what we saw in the documentationwe see we have a deploy function ittakes some arguments and then it returnsthis little semicolon means it returns apromise that resolves to a contractwhich is really nice these RS in hereare actually a list of overrides that wecan specify with some brackets so whatwe can do is we can put some brackets inour deploy function here and specifycertain things like for example we canspecify the gas price tobeing some number and now if we were torun this we would deploy this contractwith a gas price
(Editor in charge: cpp)
Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep27Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep18
Related content
- Godfather of AI_ I Tried to Warn Them, But We’ve Already Lost Control! Geoffrey Hinton - Ep7
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep22
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep76
- The 3 Year AI Reset_ How To Get Ahead While Others Lose Their Jobs (Prepare Now) _ Emad Mostaque - Ep18
- XRP Ripple LIVE Senate Brad Garlinghouse - FROM WALL STREET TO WEB3 - Martyn Lucas Investor - Ep22
- How to use ChatGPT in 2025 _ ChatGPT Tutorial _ ChatGPT Full Course - Ep28
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep23
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep52
- Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep51
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep3
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep49
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat [DownSub.com](1).txt - Ep1
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep258
- Miley Cyrus_ Something Beautiful, Touring & Stardom _ Zane Lowe Interview - Ep8
Wonderful recommendations
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep46
- Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep12
- [Hindi (auto-generated)] Machine Learning FULL Course with Practical (10 HOURS) _ Learn Free ML in 2025 _ Part-1 - Ep130
- [Hindi (auto-generated)] Machine Learning FULL Course with Practical (10 HOURS) _ Learn Free ML in 2025 _ Part-1 - Ep97
- Web3 Incorporation in Panama (A Legal Guide) - Ep3
- [Hindi (auto-generated)] Machine Learning FULL Course with Practical (10 HOURS) _ Learn Free ML in 2025 _ Part-1 - Ep98
Popular Clicks