Intro to Remix

Intro to Remix — dev3pack Masterclass · 1:25:15

Rob demonstrates Remix’s workflow for compiling, deploying, verifying, and interacting with Solidity contracts. The workshop covers workspaces, Git, test networks, ABI use, gas debugging, AI assistance, and Remix Desktop, followed by guided exercises and questions.

Speakers

Topics

From Intro to Remix — dev3pack Masterclass, hosted by dev3pack.

Transcript

Yes. Paj will be not recording. Okay. Okay. Let's wait uh two or three minutes that everyone is coming.

All right, perfect. like this. Um, so let's wait um two

minutes again. Um, and [clears throat] then I will introduce from remixing and let's go. Great. So, hi everyone. Um, just good to

see well soon for people there. Um so yeah the goal of the session is to first of all meet uh Rob [laughter] who is like the real for Ramix but also like to discover the tool rax because you're going to use it uh in fact from um for the solidity boot camps that are coming up next week. So will be really useful to to get uh an overview of what is this but also like probably perform a couple of uh action on your side um to more get used about it.

Could you hear me? >> Yeah. >> Oh, perfect. You can start. >> Okay. Hello everyone. Um, let's see. So, uh, I'll maybe I'll jump right into my presentation. But, uh, Remix has been around for Oh, wait. I to do that. I guess I better share my screen, which is right, uh, over here. Can you see my screen?

>> Perfect. >> So, uh actually as I give this presentation and if you have questions uh either just like uh it's easiest for me if you interrupt with the audio because if I'm sharing the screen I won't see the um notes or somebody or we can go questions later. But anyway, um, so uh >> his equation on the chat as well. >> Okay, great. Um, so, uh, I'll make it official. So, uh, Remix has been around for, uh, almost 10 years now and, um, it came out of the solidity team. Uh so it's a online or it's usually until very

recently just a online IDE that means it's a space for you go to it's a website and um you go there to code smart contracts and you don't have to install anything so everything's available right away. Um so uh it's a well maybe I should minimize that. There we go. Okay. um uh it's a tool for developing smart contracts uh and has been and we're also expanding into doing frontends but I think we're just going to talk about the um smart contract part today oh

there didn't want to go to the next page so uh so like you have to start with some code when you're or you start writing code or you have to uh develop the code with some AI or you have to get some existing contracts and then you compile the code which means like you're breaking it down into um code the computers can read so it doesn't look like solidity anymore but it it turns it into two parts one are op codes and one are and one is like machine code bte code and uh we'll get into that a little bit uh then you have to you know find some find the errors and fix them uh and deploy which means send it up to the blockchain uh and do those kind of blockchain

interactions and improve transactions and play with a contract when it's up there. Play test it um play with it um and use it in a DAP. Wow, that's funny. I guess I got to use the mouse. Uh so a smart contract isn't really smart and it's not really a contract. It's a computer program. Um and you're going to see these stuff all the time. it's immutable. Uh there no intermediaries. So in this blockchain world, there's a lot of catchphrases and immutable and no intermediaries or just a couple of the things that um are always happening or people are always talking about. And um it acts autonomous autonomously which means like

it just does stuff like send you know if some condition is met then something will happen. So it essentially sounds like a computer program. Um so whoops, I'm going backwards. That's crazy. Uh, so here's the layout. But you know what? I want to go right. Well, first I'll I'll show this and then I'll I'll go back and forth between this and a demo of Remix. So there are these icon there's icon panel on the left. There's a a side panel over here. If you click on one of these things on the side, then things will switch out over here. So it's a little bit laid out like VS Code if you familiar with that. There's a ter there's a uh console and a terminal for

feed uh for the uh printouts of what happened. This is the home tab, but this is usually where you'll code. And there's the AI assistant. Oops. Uh and things can move from the right side to the left side. So, let's just jump in here. Okay. Here. So, here's Remix. Um, and if I show you like there's the URL remix.thereum.org. Uh, and you come here and this is the file explorer and there should be some default uh, contracts here. So like if we just uh, look at one of them like storage and we'll make this bigger.

Whoops. I better keep track of time. So take my watch off. Okay. Um so this is simple program a simple contract program where um you have the version of solidity. So you have to use the right versions of solidity and or the appropriate you have to use the right compiler for the versions declared in your contract. Uh and this one has two functions store and retrieve. And um let's compile it. So either you can compile here. Uh I'll just go over here too. So we can show that so you can compile it and then

um we're going to deploy it to a test chain. So actually as you see now you can see the gas gets printed out after you compile it. Uh and gas is uh how you pay for stuff or how much things cost uh when you when you when you use that function or when you store when you uh deploy to the chain uh because in blockchains here in this case uh we'll deploy it first we'll deploy it and when you open this up this is the deployed contract on the remix local chain so you don't have to approve anything. So there's two and this one is is uh store and it's just taking a 56. So that's a

number that never going to be a negative because it no negatives here and also it's not no uh no decimals. So it's um just a number. So anyway, so let's save it like a let's change that to uh five. Oh, want to make it 19. So, we interact with that. So, we're changing the state of this contract. And when we do that, um, it prints it out in the terminal that something happened and we can expand that and show the the, uh, result of that. Um, but when something is orange in Remix, it means that you're

saving something. So, it's going to cost money. And when you're uh when it's blue, it means it just uh retrieving information or it doesn't have to do any um comp it's not restoring and it's not doing any computation. It's just retrieving. Uh so in that case uh it's free. That's why it's blue. And if you're sending uh value like you can send this contract some money then it would uh be read because then you can you can send some ether to this contract.

Uh and that's when you learn about payable functions. So let's go back to the oops the uh uh slide deck. Well, here like there's nothing on the right side and remix is fairly configurable like um you have this button here and then if you hit it it'll pop to the right side. Um I'm kind of mixing going between this uh uh slide deck and the um demo. So um we'll be going back and forth some more too. So workspaces and remix are just folders. Um, and that's where you

organize your work. And then the file explorer are is the files in that workspace. So the workspace files, you can choose workspaces up here or you can create a new one up here. And this is just the file explorer for the files in that workspace. Um, and then if you want to make a new file in that workspace, then you go to the create button inside that workspace. And you can also import files. Uh, and we'll get into some other ways of um uh getting files into Remix, like cloning a a repo.

So, uh, but you should check out the default files because they have some they're kind of like basic files and, uh, and you can play with them and there's some com there have comments in them to learn what's going on in the solidity files also in Typescript files here because you can also run uh, scripts and remix. Um, so you make a new workspace. So when you make a new workspace, this modal will come up and then you can choose a workspace to use. And there's the Open Zeppelin wizard. I don't know if you've tried yet, but there's this uh company called Open Zeppelin and they make um

they have a library of contracts and uh they're very uh common for the like the coin contracts and so this will import those uh and you can clone a repo uh in a few different places but one is over here. This is where you would log into GitHub, but uh you don't even need to do that to clone. So when you click that button, you get the clone button and then or you can open up a new workspace modal and then you'll get the clone button over there.

Actually, I'll just show you how it works. Um first, I'm going to get uh I'm just going to copy that as a uh repo I want to clone. and we're in Remix. And then we go over here. Uh, and when you clone a repo, it makes a new workspace. So, we'll clone the repo. I'll put the Whoops. I think I hit that twice. Okay. So, we'll clone it. And then, uh, we're in deploy and run.

So, it looks like nothing happened. But when we go to the file explorer um this is the um this is the repo and uh it just has a contract with there's one contract in the contracts folder and these contract you know this is a what if you're making your own if you make a blank repo you could organize this however you want you could also come in here and uh erase stuff if you want you can organize it as you like Um, let's see what else I got over here.

So, we did that. Um, oh yeah, and so when we're in a repo, you can see this is the git functionality. So, like you're you're in this repo or if you make a new one, you can initialize it for git. But in this case, uh, I'm pulling it in or I cloned it in and there's some you can switch branches in the file explorer. You can also go to the uh git plugin and uh do the some basic git commands, pushes and pulls. Um it's not too extensive, but you can do basic commands here.

Uh oh, and um I don't know. We I kind of covered this, but here I'll make another workspace. So, in this ca, yeah, let's just do I'll show the the coin contract. So, we'll make a coin contract. Uh I don't know if you've seen uh like these, you'll see these probably a lot. um ERC20 coins or 721 coins, but when you add these features like you want to make it mintable, so you can have a coin contract, but without making it mintable, you can't make any coins. So when you make it mintable, you're adding

a different import. You make it possible. Um and um just in general uh unless it's upgradable, you can't once the contract is com deployed, you can't uh change the contract if you're to [snorts] to to change it means you have to redeploy it and it will have a different address. Uh in fact, why don't we um look at the workspace I just created. But anyway, so first I'll I'll finish this one. uh it's ownable and it's mintable and we'll create the workspace and we're back over here. So we have the token here and

you know we can deploy and um play around with that. Uh but going back to this other workspace I had uh I think it was this one over here. Oh, anyway. Okay. So, we'll take this and uh I'm just taking this one again. I'm going to compile it. I'm going to deploy it. So, here it's on a test chain in the browser and the address is here. So, this contract has an address.

Um it's all the 0x stuff. Uh also look, this is uh in this test chain. it gives me 10 or 15 addresses each with a 100 test ETH in them. So that's good to know. Uh and so these are um EOAS uh externally owned accounts. And so that means that's just a fancy way of saying it's not a contract, it's an account. And um these are this is an account created for this is a contract account.

Uh, and so, uh, let's see what's the next in the, uh, here. Oh, yeah. So, when you're saving files in Remix, unless you're using Remix desktop, which I'll get into a little later, you're saving things in browser storage, which you can lose your work if your browser if you erase your storage or if you just gets corrupted. So, it's important to push it to an external repo. Um, I mean it doesn't happen that often, but it does happen. So, you should be a little careful if you're saving work for any length of time or of any importance and push it to a remote repo. But if you're using Remix desktop, then you can uh you're using your desktop uh so uh it's

not it's not as feeble as browser storage. Uh that's the link for downloading Remix desktop. Um, so you can even try it out. Um, I'll do a demo of it a little bit later. Uh, but it's got native terminals. Uh, you can also like work between VS Code or any other uh, editor you like and use Remix for all the uh, web 3 tools. Um, so um, I'll show that later. Uh just um the solidity compiler just again note that you can you switch the compiler

versions here but it will select the if your contract has this it will select an appropriate version but sometimes with if it's you're have a contract that's importing a lot of contracts you have to select a version over here um and uh I don't know if you heard about the different Ethereum forks But each Ethereum fork uh brings different more functionality to or yeah more functionality to remix to uh Ethereum itself and the uh Ethereum virtual machine version is important to um know which one you're using. Sometimes like if you have an old contract it will be

an older EVM version. And if you you're trying to interact with a older contract and you have a newer contract, there might be some conflicts. Okay. Um going back over here. Um Okay. So when you're deploying, you know, if you're deploying locally like I did, then you're saving it uh on the local blockchain. But there are things called test nets which are more realistic than what's in remix. So uh you have to approve each transaction but you also have to have uh gas money to save the contract on that test chain.

And so you have to go to like um some faucets to get some of the uh test net ether. uh and then uh you can view your your contracts on uh block explorers. So you deploy to a public chain and it's visible to the public. So it's nice to know that uh you know you can go to some other a browser and check out what happened. Um and here are some of the larger uh block explorers. Um and so that each block explorer will probably have a different URL for each chain. It's um cataloging.

Um Oh, yeah. Okay. So, when you're going to deploy, you have to know like if it's the Remix VM, you're deploying to the Remix VM. If you're going to want to deploy to a public test net, then you can either use uh a browser wallet like um MetaMask or Robbie wallet. You can use wallet connect so you can improve transactions off your phone. Uh and if you have a local node running or using something like infura alchemy you can connect to a uh HTTP provider. And if you want to have like the hard hat node or the al um foundry node then you have to be using remix desktop and then you

can connect to that. It's just a local chain. It's a little bit more advanced than the uh Remix VM, but it's essentially the same. Um, okay. So, we tried that. So, let's deploy to a public test net. Whoops. This way. So um I have the it's compiled and we go to deploy and run and we select uh injected provider MetaMask.

So I have MetaMask set up. Um so um setting it up to select Sapoleia is often going to be a little bit confusing but um just warning you about uh selecting you have to know the the configuration settings for each test net or each network you're deploying to. So you can use uh this link over here called chainless.org or and then you can put in Seapoleia and if you include the test net you could uh if you click that button it will configure uh uh MetaMask or maybe even whatever browser you're on to um configure it to that chain.

Oops, sorry. A chunk. Okay, so we're on Sapolia and we're going to deploy it. Now we have to approve the transaction. So we're going to confirm it. And now um it went through and um here's the uh address. Let's view it on um Etherscan.

So this is the contract. Um, another interesting thing is oops to know is um what this other button over here is about uh if I had clicked uh deploy and verify verifying contracts is important because when you deploy the contract as we saw um over here you just get the address and uh if you have some if you're interacting with this contract this address you don't know the public doesn't know uh what the code is. So it could be malicious.

Um so if it was verified that means we've published the source code and um so I'll just do that again. Uh and what's going on here? So the verification process is happening. Um and then um Okay. Well, there was a problem with

there there's all there's a few different services and it it just um didn't like it on Sourceify, but it was okay on Etherscan. So, if we view it here, we can see the code that I just uh published. So, uh let's go back over here. Oh, deploying with a contract. Well, we kind of did that. Yeah. >> Vanessa, you have a question? >> Yes, I have a question. Um Rob please what did you do differently to deploy the contract because the first time you deployed it was not verified. So what did you do to make it >> ah okay >> verified

>> it's a little it's this little check box and by default it's checked I think this one over here where it says deploy verify contracts on explorers and when you click it it says deploy and verify >> okay >> but there's also if you deploy if I take the first contract I deployed I can take this contract copy the address and bring it over to the contract verification plugin and um I could uh select the chain and put the contract address and um you choose the contract name and then you can verify it this way too. So you can verify it after it's after it's

deployed if you hadn't done it before. >> Okay, thank you. >> Sure. Uh let's see. So, I'll get into the AI stuff and I'll do a um and also Remix Desktop. But, uh yeah, also know in Remix um so like in deploy and run like here and you can stretch things out a little bit if if you need more room. Um you can copy the address you can. But if you click this carrot, you'll open up and see the functions. And then there's this other carrot. So suppose like uh this contract had a lot of inputs. Then

you would see if you open this up, you would see the inputs um individually. So it's helpful this carrot for some complicated um functions. Uh and then um let's see. Go back to the thing. That's for copying the address. We deployed to the local name testn net. Uh yeah. Okay. So we'll go to remix AI now. So when you're choosing uh remix when you want to interact with the AI tool, it's good to select the context it's going to work in. That means like is it going to work on the file or on the

workspace. And you get to choose your LLM. And it's great for um uh explaining errors and um code completion and code on request um here. Whoops. This way. So um you know there these conversation starters here. So in this cont place there'd be no context. Actually here I'll show you a little thing too. So, I get like um uh like you using that uh conversation starter and then my one password starts up and I don't know what's going on here.

Uh wait, what's going on? Sorry. Okay. So, but it's hard to read. So, you make it larger. Ah. Um you can get rid of uh different panels here. But anyway, so you can make it wider. Um but you have this another one thing you can do is um uh if you make an error here like you forget a semicolon and you compile it, you get an error and then you can ask

Remix AI about the error. And it will explain what's going on. Um looks like, you know, it flags that uh I forgot the um the semicolon. There's the corrected code. Uh you can switch it to this. And you can say uh fix the error. They looks like it didn't fix it.

So, you know, there's always something. Uh, what's going on? So, it should wait. It said, well, it says where to fix it here. Um, we told it to edit it. Well, anyway, it says with the line number and the pro and it explains the problem. Um, >> so yeah. >> Um, why mist? Ah, so you can choose Mistral, you could choose Anthropic and you can choose OpenAI, but it's um I would say usually Anthropic is the best.

>> Okay. For smart contracts um okay the best is the best. All right. >> And um the other interesting one is Olama. So because uh LLMs are training every all the time on your data. If you want to have private data, you should choose Olama. And actually there's something called Olama Cloud. So it's a private LLM and for just uh developing contracts doesn't cost anything. So um if you're doing something private, that's a good way to go. You can also run it locally on your computer. Uh I tried and um running LLMs locally uh unless you have a a machine that's good for LLMs.

Uh it's very very slow. But >> um every time like in the industry we mentioned that using AI for building with smart contract is kind of risky complicated and so the fact to see that mal AI is better to perform [clears throat] complex transaction like complex coding stuff solidity is great to know. >> Yeah. >> Yeah. Um, so anyway, just it's also good to know it's like when you're selecting your cont this is the context. So it's uh important to know to set it which context you're using and so the AI will scan this um and um and so you could

also like uh uh tell it another way to tell it uh to do something is to like um write a function that adds two numbers. And then um or if you if you um you could do it over here and say like write a function function uh in in the storage contract.

that adds 17 to the uh variable number. Let's see if it'll do it. Is that it? Oh yeah. Okay. So then once you accept it then it'll be here but you have to find that uh accept place to do that. Um

uh so um also uh in these uh in the file explorer uh there are these scripts and like there was one deploy with ethers. Okay. So um this is what I I was playing with earlier like um when you come here let's make a new one a default workspace uh the basic and you come to ethers and uh this is a uh typescript to deploy something with ethers. So you could uh first you got to uh compile the file oops here and then you run the script

and um and then it didn't work. That's funny. Try it again. That's the problem with live coding. Uh well, uh the other one was working, so I'll just go back there, I guess. Um but yeah, I mean, um I'm not sure why that was not working. Uh but I think it's not so important to debug that right now. Um so anyway so I uh I asked it to store 77 after it deployed it. So um I think it just added these

two lines. Um, and what I had asked it to do was uh, and so I basically what I'm telling you is that you can use the the LLM to code a function in Solidity. You could also use it to code it in TypeScript. Um, and you can use it to explain something in Typescript, too. like uh what is Oh, actually you could just use this one. Explain the script. I'm just going to get rid of that.

Um so it imports, it deploys the contract and it logs and it catches errors. Um, but you can also add things to this deploy script. Um, let's see what we get. Okay, we've kind of done that. Oh, um, yeah, I'll just do two more things and then we can play with some um kind of uh try things out together. Okay, so uh let's check out the debugger and what was the other one?

Um, oh yeah, Remix Desktop. Okay, let's look at Remix Desktop first. So, here is Remix my toolbar. Okay, this is Remix desktop. It looks just like Remix. Um, but uh what's going on is it's uh instead of a it's running on my desktop. So to make a I can open up a different folder here and then it will open up a different instance of remix with that folder. Um but the cool thing is I'm also connected in um come on make that disappear.

Uh VS Code should be here. So I'm connected in hard hat to the same folder. So, um, if you're, uh, using hard hat, you can use hard hat and VS code and remix. And that means like I can um kind of update this file here and I can compile it uh here. And then I can um

take that compilation result in remix and then uh deploy it. Oh, by the way, this is the red one. Uh and that means that I can send value. And if I send value, so in this case, I'm using uh the Remix VM, but I could use uh Remix with a browser wallet in desktop. Uh when it does that, it will um open up a locally hosted browser that will connect to a browser wallet and then um so once that's connected, then I can go back here

and uh deploy it. This is also Oh, I need to have a something in Unix time to deploy it. So I'm not going to do that now. But um I could also send value which is uh value adding the value here. Uh and so that's remix desktop. And let's go back to uh deploy and run over here. This is Remix online. And um we're going to go with uh back to the file explorer contracts here. What happens over here? No, we're going to

uh yeah, I've noticed this happening. Um sometimes the addresses don't load, so you just either have to uh refresh. Uh I think that's going to get fixed in the next release which is coming up in a week or so. Um so we're taking this. So when you refresh interesting you uh compile uh the contracts that I had deployed before are not there. But if I had um deployed this one, this is going to the remix VM.

And if I had pinned them, I would they would be saved. Um, and uh, let's just uh, open that up. Oh, that's right. This is not the which contract did I just deploy? Storage. Oh, yeah. Okay. This is adding I added a fancier version. This is [clears throat] one. That's right. This is one I add 17. So, there's the add 17, but we're going to store a number here, and it's going to be uh, three. We're going to store it. Then we're going to go to the debugger.

So, as I said before, um, uh, gas is figured out by, uh, op codes. So, each of these have a different price. And if you look at this one, like this was in this line here, store, uh, there's a lot of different op codes because each line gets kind of split up into op codes and you can kind of bounce through them. And each line here uh will have a different gas amount. So far it's three, but STO uh has 22,100 of gas. So if there were a lot of uh things that required storage, which is STO, then your contract would be uh more expensive to deploy and to use.

And that's a kind of interesting thing about blockchain programming is you have to make the code efficient so that the gas costs are low. Um, and I think that's it. One other thing I wanted to show is that in the advanced part of of the compiler, there's something called optimization. And sometimes you'll get asked to turn this off or on that will optimize um the uh how the um op codes are created. Um, so, um, let's go back over here.

All right. One last thing, last thing before the last thing is, um, when you're on the home tab, you can click start learning. So, this is called Learnith. Um, and in in app tutorials. So if you go to the Solidity beginner course, uh you can um it'll walk you through a lot of principles of solidity. Um and it gives you example files and in some places there are tests and you can um you can try to do something and it'll check you can check the answer

or you can get click show answer. um and it'll show what the correct answer is and there's a whole bunch of them here. So, uh it's a good resource to know about and the list should soon be getting longer, too. Okay. So, uh going back to uh going back to uh what we should try to gather is um try to make a new workspace, load storage, compile the file, find the API, which we didn't go into, uh deploy a contract, uh save a value, view it in the debugger,

and check the um gas usage. per line. Um, and here these the slides for this presentation are here. Um, so Lyn, how should we um organize going through it? Should I do it with everybody or >> um Yeah, I feel that it should be nice to to do together and like this they can also do it after etc. should be nice. Yeah. Um but really cool. Uh I didn't know not notice before that there is a courses uh with some things to perform inside uh remix which is very very nice to know. I the thing I like about those

courses is that you can like follow the instructions, but then you can just start going off on your own and just start exploring what happens if you you know go to static analyzers or um you know play use other tools in Remix or just start playing around and kind of ignore the tutorial for a while and then come back to it. So uh anyway um, so should we here? Let's, uh, I'll I'll go backwards to here. This is remix. So, I'm going to,

um, I'm going to make a new workspace. If you're coming to Remix for the first time, you don't need to make a new workspace. But I'm going to create a basic workspace and then um I'll click storage. So does uh everyone have that up?

I don't know exactly know when to go on and I I can't see anybody because I'm sharing the entire screen. So, uh maybe uh Whoops. >> Would you zoom >> just >> zoom? Oh, yes. Perfect. >> Also, if anyone has kind of questions about um any of these contracts to let me know. Um so uh so we can compile it here or we can compile it here.

>> Just asking on the educational part is only on desktop. >> No, it's it's uh on the online version too. >> All right. >> This is this is the online version here I'm on and it's here. >> Okay. Okay. Thank you. And so I'll go back here. Uh so we've compiled it. Oh yeah, another thing to note sometimes like um you you might sometimes get an error depending what contract you're using uh because and when you're on deploy and run because you're you not you're not deploying the right contract. Sometimes like with uh a contract that's importing

all other contracts, you'll have a big list of contracts here. In this one, there's no imports. Um, and I can show you that a little bit later, but just that's a little uh thing to keep track of that there's this contract folder, I mean a pull down uh select box, and you need to know that you're going to be deploying this contract. Um, so that one. So ready to deploy. Uh, I'll deploy and then we'll open it up.

Actually, what are the other steps here? Compile. Find the API. Okay, so we've deployed it. But we didn't talk about the ABI. Um and um let's uh let's look at that. Um the uh AI is in the solidity compiler and this is to copy the API. Um and but let's take a look at what the API is. So the compilation details is the AI is part of the compilation details. So this is what happens when the code gets compiled.

Uh this is the byte code which is uh the machine code. Uh the API is here and uh there's two it's basically as we see here. Come on. Um it's two files. I mean it's it's a JSON file and there's uh two uh functions. It's the names of the functions. Actually, it's going to be easier if I show it like this. I copy it here. I go over here um and in the build in the artifacts folder. Um probably even here here

uh this is the uh it's that same thing. Okay. So I just going to make a new file here inside of uh artifacts. So you saw that modal that came up like if you're copying code into remix people often get scammed because they copy malicious code into remix and then deploy it and then on real chains and then they're trying to get rich and then they lose their money. So, there's a

warning about uh ask Remix AI to review your code to just kind of help verify that it's not malicious, though that's not 100% either. So, you should really know what you're putting in or trust the source of what you're putting in. Um, so anyway, >> from where did you have now copied your what you just pasted? >> Where did I copy it? I copied it from uh the compiler which were here. We copied it in the AI down here at the bottom of the screen.

>> Okay. Thank you. >> But that's like if you're going to be making a DAP uh in another like you're you're going to do the back end in Remix and the front end in another tool, then you would um grab this um and paste it into your the your the front end and uh use that that you paste that into the JavaScript of your DAP cuz that it shows the um functions uh without all what's inside the functions.

It just shows the names of the functions. So it maps the names of the function uh to the function code. And because when you the deployed contract does kind of messes up the function's name. So it's impossible to uh target a function without knowing the function's name in in I guess English in AI or whatever you you know in human readable language. Uh I guess as you play with that you'll get more familiar that. Um, okay. So, let's save the function.

Use the store function to save a value. So, let's open it up. Um, and we're going to save a number here. Um, and what was the other one? So, we saved it. We'll view the transaction in the debugger. And then we'll check the gas. The gas appeared on each line after you compile it. We'll check the debugger.

And um I'm using step into to go through each step of the uh op codes which are over here. And here's the op code. And here's the gas. And here's the gas uh the gas amount for each function total. And then this is the amount per line. And um as you click through that those numbers should change.

Uh okay, that's that part. Uh so we actually and we found the op codes in the debugger. Um I also wanted to show you something else interesting. Uh so this is the file that we uh verified on Etherscan. So here's the API that got verified. So we're going to copy it. Um Whoops.

And we'll do that together, too. In fact, it uh actually this might be a little complicated for everyone to do because they don't have access to the address. Uh unless I put it into the um into this here. I might be able to. Oh, no. I'm not in uh in performance mode. just uh here uh I'll do this quick demo. >> Put it in the >> Oh, yeah. That's a good idea. Okay. So, um I'll take this address

and I'll put it into the call chat. Where is that? Uh Okay, so we got that here and we're going back to Remix. Um Oh, yeah. Okay. So, first we're going to go here. We're going to copy the AI.

Um, you also want to connect. Uh, the tricky thing though is you need to connect Remix to uh, Sapoleia. So, you need to have a browser wallet or some way of connecting Remix to Sapoleia. So, if you don't have a browser wallet installed yet, then you can't I mean, it's going to be a little more complicated to do. Uh so in any event uh I'm going to connect mine actually I'm going to first refresh mine just so I'm uh so it's sort of starting from fresh uh and then so nothing's compiled is and

so uh I go right to deploy and run I go to uh MetaMask. So, it's um connected uh and [snorts] then see this because there's no com compiled contracts, you only see this um at address. So, I go to this and here's the address of the contract. So, and this would work with any uh verified contract. It doesn't have to be mine. It could be anybody's. And it's kind of interesting to go to uh one of these block explorers and look browse a verified contract and just pull it into

remix and see what it's got. Um and so here's the contract address, but it's it needs more than just the contract address. Um it needs to have the AI. Um and uh so in this case I need to make another I'm going to make a new file uh in the artifacts called uh it's going to be store. Oops. So, I need to go back to Etherscan, uh, grab the AI

and put it back, uh, over here. So, Remix needs the AI and the contract address. And uh um, and now we can get it. So now um I can interact with this contract that's deployed and it doesn't have to be my contract. It could be any contract. We just need the AI to be able to interact with it.

So that's kind of like what a DAP is doing. It doesn't need to have the source code. It just needs the AI and then it can bring in the functions and then you can play with the functions on your on the front end of your DAP. any uh questions? So, >> sorry. So, had you just pressed add address for the last steps? I got a a little bit lost. It was super >> uh Yeah, I just pressed add address and then here I'll do it again. So, I hit press to add address and it asks me if I want to interact with it and I do and then it it kind of quietly brings it down here and it has at

address >> and then you can open it up. Um and so like if you're here in Etherscan um this uh you can go to verified contracts and this little trick I'll show is only it only works with um mainet ether scan but if you're in mainet etherscan and then you go to uh where is it?

Blockchain verified contracts. And we could just go to like something here that might look interesting like um I don't know what this is about. Let's try this. Okay. So, we take um this verified contract uh but we just want the address here in Etherscan. Come on. and we swap out Etherscan for remix.ethereum.org and I'll open up Remix with that contract in Remix.

Uh so it's kind of fun to see like the source code of something. We could also bring in the um you know just any any verified contracts function just with the ad address. Um and so uh like explain this contract. Um, oh, I see it's a looks like it's a library.

I guess it's why it's called lib. And it looks like uh it didn't do it. Okay, let's switch to anthropic. Okay. So that explains the contract. Any other questions or or anything like any terms that you may

have heard about that? Um, I mean, remix is kind of interesting cuz if you hear some term that's often used, maybe sometimes you can see it in action in Remix just because there's a guey to click on. >> I have another question. When you were just talking about replacing the first bits of the URL, what did you replace it with? So, >> the remix URL. >> Yeah. >> So, that's uh remix.ethereum.org. >> Okay. Because for me it was like polka dot and then it didn't work.

>> Ah yeah that's um polka dot forked remix and then made put up something that didn't quite work and then didn't swap. Remix is open source so other projects can fork us but they not allowed to use our branding which polka dot did. >> I see. Okay. >> So uh that that polka dot site's probably going they're probably taking it down anyway and uh it doesn't work. So >> Okay, cool. things. >> Um, >> uh, another thing that's coming up soon is, um, like let's go back to file explorer.

Um, right. So, right now, um, it made, uh, when it brought in this contract, it brought it in this code sample workspace. So I want to go back to some other workspace like the one I was working in which was basic one I think and you can name rename these as you like. Um but um so it's good to know. Oh yeah. So first um uh uh what am I trying to do? I forget. I'm just kind of navigating around. Oh yeah, I forget what I was talking about. Uh but here's another interesting problem

that comes up. So in ballot three ballot, we're going to compile it. Uh and we want to deploy it, but there's a constructor variable here. So you can't deploy it unless you have the constructor variable. Uh and the constructor variable is a bytes 32 array. And so in blockchain world like a string is kind of expensive to store and a block and a bytes 32 is a more like machine code version of a string often and in this case it's an array of bytes 32s.

Uh and so it's going to be like um I need to make an input that uh is in a bytes 32 format. So, um it's kind of it's good to use the AI tool to make that like um uh transform or convert convert the string uh cuz this is a voting one. So um uh Sheila uh to a by 32

and here's the result. So, if I take that, actually I want to make it wider so I can grab it. Then I copy it over here. And then uh I have to put it inside square brackets because it's an array. Let's see if this will work. Uh either because it needs a quote. Let's see if that will work.

didn't like it. Oh man, my fancy versioning, my fancy AI work. Okay, it looks like that should work. Uh oh. Well, um let's try a different way. convert uh this uh by this string array of strings a bytes 32 array.

She uh Right. So, we're going to take this one. We'll copy it. Uh, we might have to change the format a little bit. going to do it over here. Um, just so we're getting it all on one line.

Maybe this will work. Oops. Maybe it won't. Okay. So, we're over here. Take that. Erase that. We'll put that in there. And we'll transact. I don't know. I'm not going to fix it now. [laughter] I think we're out of time. But, uh, see, uh, that's a problem that comes up. And, um, then the tricky thing is how do you resolve that? And uh so then I guess we could say uh why I guess it should be the context should be the it's really the file current file.

Why isn't that I think um uh is that why isn't that transaction working? So, um, yeah, the problem is now, uh, in the next version of Remix AI, it's you're going to be able to ask that question. Uh, in this version, you won't, uh, because it's not seeing the transactions that are happening. Um, but as we connect it to our MCP, which is a another word that you're going to be hearing a lot probably in your class, um, which is how AI connects to, um, other APIs and,

um, uh, LLMs and stuff. Um, God, I didn't want to just pause there. [gasps] So much uh, like so much vocabulary words. Anyway, so uh the MCP is like when you're connecting to other services and it's not this this tool over here is not seeing what's happening in this tool. That's the short answer, but it will in probably uh uh two weeks. Um so I think that's where I'm going to leave it for solving that problem. Any other uh ways I can get myself into more trouble?

Uh, I can show off something else if you're interested or or kind of at time anyway. I I can't I can't hear. Was there uh >> there's also a question in the chat. I don't know if you've seen the Have you seen >> how does the compiler version affect deploy deployed contracts?

>> Um the compiler like a with each version of solidity uh different functionality comes in. So if you have a new contract that I mean a contract that specifies like a very recent version of solidity um but you compile it with an old compiler it doesn't have the doesn't know what these new tools are so the compilation will fail. So that's why the comp and so when you're importing a contract that has some old functionality but you're compiling everything with newer functionality there can be some conflicts.

Um so often you need to iron out the conflicts uh to get everything to compile correctly. Similarly like the EVM version as well. And then there's some chains that aren't up to the latest EVM version. Um and so they um so you can't use newer versions of Solidity with those chains. or newer um you can't use a more recent EVM version.

Um, another uh kind of important thing to just bring out again is that uh when you're when you deploy something, if you pin it here in Remix, uh, so that's pinned. Um, and it's uh, so if I refresh Remix, it will and um, here I'll, uh, refresh Remix. Uh, it went to the older version.

So, I have to select the correct one here. Uh, and when I go here, it's back. But if I if I went to a different workspace like this one, it would be gone. So, you have to be on the same workspace. uh and you have to be to the same environment. So if I'm in a different environment, it'll go away. Um and um uh let's see. So if I do a version of remix which is the kind of the next one

coming out. So we kind of hit it behind the experimental flag in the URL. Um, this is when it the the AI tool is more connected to the rest of Remix and you can ask it quite a lot a lot of other connection questions too. Um, but in this case I just wanted to show like you have this uh function. Well, here we're going to oh uh

just uh before we get too deep into that here's a kind of simple thing. So we've compiled this one. This is a contract about who is the owner. So it's the owner an address is getting saved. So in the remix VM if you uh you can take an address and you can copy it and then you go back to the first address. We're going to deploy it here. So we're deploying owner. It's here. We I copied the owner address and I paste it here.

Um if I'm connected to MetaMask, uh probably let's see what I have a lot of MetaMask addresses. Yeah. So there's a bunch of MetaMask addresses here. So I could choose the different addresses here. So um that's what I wanted to show there. Uh but for um uh deploying to so we're going to deploy to uh public test a public network. We're not going to bother to verify it at the moment. We're going to approve it.

Um, it's coming through. It's almost coming through here. It's through. Okay. So, we open it up. Uh, we click this little button here and it's going to create the front end of a DAP. So, we can give it the title. Um, let's just to get rid of that. Uh, we can give it a title. Well, we can uh let's let's get rid of the right screen so there's more room here. Uh yeah, you should know about these three buttons. Um and um you can make a a DAP. Um this isn't actually the latest version of

this, but it this one allows you to make a DAP. The next version I think here you should also know about the plug-in manager. Um, I'm going to close this one and do this again. Uh, the plug-in manager is where you choose different plugins and that's a important version of part of Remix that I didn't explain before. So, that's the plug here. So, you can load up all these different uh plugins here. Uh, and I wanted to use this version. And then now when I go to deploy and I click this one uh we can put all this um you know that

you can describe the name of the function you can and you can publish this on IPFS um and uh then you can get the source code for your front-end DAP the front end of your DAP. Okay, I think that's um probably enough. I've only gone over by 20 minutes. Uh any other questions or shall I should we

call it a session? So uh oops any other question? Wait I check over here.

Can we import? Oh uh yeah for importing uh smart contracts. Um, you mean like inside a contract or cuz like uh you know like if we can make a new um ERC20 contract or 721 here um well this is ERC1 whatever. So in this case we're doing imports. So it's importing from the MPM it's importing from open the open Zeppelin library. Uh here I'll just create it.

And in this case um uh Remix is grabbing it uh from via npm or unpackage and it's bringing it into remix that way. So if it's a published uh package on npm, remix can get it. Uh or it could also be a URL to a specific uh uh contract that you want to import. And um if you're importing you know otherwise it's it's you need to um you can you can uh import a file via uh over here if you want. Oops. Create

you can import files from HTTPS or H or IPFS and then of course you can clone compilers are not dependencies. Um but um interesting thing about Remix Desktop is that um

when you're using Remix Desktop, I mean I guess you depend on these compilers, but there's they're kind of transforming the code. They're not in the code and they're transforming it into machine code and op code. Um so but when you're using Remix Desktop, you can uh download compilers. So once you download the compiler, you're you can work offline and especially if you're connected to like a you know if you're just using the remix VM or the hard hat chain or the foundry chain the anvil chain then you can work totally offline if you've uh downloaded the compilers.

Um but otherwise compilers are like uh things that have to get imported into remix not into your code. Hi, >> interesting question. >> Um, I don't know there is other question. Um, is everything like finished on your side? >> Yeah. Yeah. >> All right. Okay. Okay. Um, so yeah like hasn't mentioned the session will be recorded. I mean has been recording. So I will put everything on YouTube and then you can see this. You can yeah you will be able to see it on the hub too.

So just to let you know share the slide. Yeah um you will share with me and then I would I will share with you. >> Great. >> No worries. Thanks a lot for the insightful session. Uh I mean as everyone will start the solidity boot camp from next week. I mean it was kind of a requirement to know Ramix first uh for for going smoothly into it just next week. >> Great. Great. Yeah. Good luck. Good luck everybody. It will be fun. I'm sure.

>> Very complete session. Yeah, [laughter] >> maybe too complete. >> Thank you all. >> Thank you, Rob. Take care. >> Thank you. >> Thank you. >> Bye. >> Thank you. Bye. >> Bye. Thank you so much.