Current location: Home > solidity > Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep210 Text
Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep210
Time: 2025-07-11 11:21:45 Source: Codora.ai Author: ai Reading: 292 times
of new stuff like ABI doand code packed that we did twice whatis this ABI do theo von podcastencode packed doing welllet's learn about thatso from a really really high level thisis basically how you concatenate stringsright this is how you combine stringstogether and we're going to jump overthe remix to actually explore this ai.encod pack and this ABI encoding stuff alittle bit more now the section thatwe're about to go through is definitelyAdvanced and we're going to be goingover some really lowlevel stuff and howsolidity Works behind the scenes how thebinary works and this thing called opcodes and all this crazy lowlevel trickydifficult things to understand if youwant to move past this section there aretimestamps in the GitHub repo to helpyou move past this however I doencourage you to at least try to absorbmost of this material if you don'tunderstand it the first time that's 100%okay this is more advanced anyways formost of your basic projects you won'treally need this information it's onlylater on once you get more advanced thatknowing all this is really going to makeyou a phenomenal solidity developer andwhen you approach this section when youapproach this Su lesson on evm op codesand coding and calling just know that ifyou don't 100% understand it the firsttime that is okay if you want to watchthis section A couple times fantastic soif you want to jump over to remix andfollow along let's do it now in ourcontract section let's go ahead andcreate a new file we're going to call itencoding doou and remember all all thecode that we're going to be going within here is going to be in this subllesson folder of the hardhead nft FCCand all the code we're going to beworking with is going to be in thisencoding doso and then in a little bitwe're going to work on this callanything.so so we're in this encodingDoo and let's just make our basic codehere so we'll sayspdxlicense identifierMIT pragma soliditycarrot0.8.7 like that we do contract encodingboom compile or command s or control sgreat things are looking good nowremember the whole purpose for this isto First understand what's going on hereand more about this ABI do and codepacked stuff so let's first just write afunction that shows us wrapping ABI doand code packed with some strings andwrapping around a string is going toreturn a string so we could do functioncombine strings or concatenate stringsthis will be a public pure since we'renot going to be reading any storagewe'll say returns string memory andwe'll say return string ai. encodepacked hi Mom comma let put space inhere miss you like so so we need anotherparentheses here okay great now let's goahead and deploy this we'll stay on aJavaScript VM we'll deploy and codingcoding. so and we'll come down herewe'll click combine strings and we getthat whole string output hi Mom missioso what we're doing here is we'reencoding hi Mom missu together into itsbytes form because ai. incode packedreturns a byes object and we are typcasting it by wrapping it in this stringthing to be a string and slity says okayyeah bytes to string that's fine thattotally works and this ai. incode packedone of these globally available methodsand units and actually in soliditythere's a whole bunch of these there'sthis solidity cheat sheet and there'sgoing to be a link to this in the GitHubrepo as well that has a whole bunch ofoperators and it has a whole bunch ofthese Global variables and methods youcan see if we look in here we look forABI do and cod pack we see ABI do andcode packed right here we scroll downwe'll see some more that we're familiarwith as well like for example message.sender sender of the message message.value there's a whole bunch of otherglobally available methods and variablesthat we can use when we're coding ourstuff now I will say though in08.12 plus you can actually do string.concat you know string a comma string Bif you want to instead of doing this ABIcode packed but I still wanted to showyou the ABI do code pack because it's agreat segue into all this ABI stuff thatwe're about to go over but let's focuson this encod packed thing so what isactually going on here well before wedive deeper into this encode packedlet's understand a little bit more aboutwhat happens when we send a transactionso when we compile our code and againall these pictures are going to be inthe GitHub repo remember back to ethersJS we had those two files we got aabifile and a bin or binary back in ourethers simple storage when we ran yarncompile the two main files that we gotwere this simp storage. ABI which wasthis you know this ABI thing that we'vebecome familiar with and then the simplestorage.bin which is the binary which isa whole bunch of just numbers andletters and stuff we didn't understandand you can see that in remix too likeif we were to compile this you go tocompilation details you get a wholebunch of stuff in here right you can seethe ABI in here which this is kind oflike a different way of viewing that APIwe also get this B code bit and it'sthis object that has the same stuff thathas like those random numbers andletters but this is actually the binarythis is actually what's getting put onthe blockchain it's this binary it'sthis lowlevel stuff now when we actuallysend these contracts to the blockchainwe're sending like I said we're sendingthis binary thing that's exactly whatwe're sending to the blockchain andremember how again back in our ethersproject we saw what is a transactionright a transaction has a nuns it has agas price gas limit two value data wekind of skimped over the vrs a littlebit because that's kind of that mathycomponent of the transaction signaturebut again back in our ethers project wedid this as well right in our deployscript ended up sending a transactionourselves using just ethers we passed anuts a gas price gas limit two valuedata was this massive thing to deployour contract and then also the chain IDwe didn't work with the VR
(Editor in charge: python)
Latest content
- ·Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep28
- ·The Basics of Web3 - Ep1
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep257
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep297
- ·Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep100
- ·Web3 & Crypto Will Change The World As We Know It! Yat Siu - Ep9
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep227
- ·Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep66
- ·Harvard CS50’s Artificial Intelligence with Python – Full University Course - Ep19
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep195
Hot content
- ·Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep66
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep195
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep255
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep173
- ·Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep73
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep255
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep283
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep217
- ·Full interview_ Donald Trump details his plans for Day 1 and beyond in the White House - Ep2
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep56