Arbitrum Workshops series at ETHCluj 2026
ETHCluj Meetup·Thu, Jul 9, 2026, 12:00 AM
ETHCluj, in partnership with Arbitrum DAO, and with the help of 0xjsi.eth (https://x.com/smithinsulander) and bayge (https://x.com/baygeeth) has organizing a series of 4 hands-on workshops during ETHCluj 2026 conference. These sessions were pulled together into a full one day training course designed to introduce students, developers, and curious builders to the world of blockchain and Ethereum. This program is part of ETHCluj 2026 and focuses on practical learning, open-source contributions, and building real skills in the Web3 ecosystem. No prior blockchain experience is needed for this training session - it is designed for curious, motivated people who want to learn and explore how things actually work under the hood.
Transcript
Hello everyone, welcome to the arbitrum workshop. Uh let's see if I Yeah. Uh this will be the first module out of four modules. This module is called called as you can see arbitum's role in the Ethereum road map. So this one will be a bit more theoretical where we will be going through like the blockchain history and how we came to where we are today and how arbitum fits into this and then we will get uh in the next three modules we'll get our hands more dirty and get to actually coding together.
So about me my name is Jack. I usually go by the username cxjsi online. I am a solidity and rust developer and I've been working this space the web three space for the past uh three years full-time mainly within the niches of uh trading systems crosschain intent and trusted execution environments the latter of which I'm currently very interested in and trying to find more time to research and when I'm not working I'm a bit of a hackathon addict as well I am at like 20 plus hackathons at this point and counting So uh we have prepared a [clears throat] GitHub repository. So please feel free to scan this QR code because we will have all of the contents here uh that you will need. Also we have these presentations in written form there in a blog that me and Alex in a blog that me and Alex have prepared for uh this presentation.
Uh aside from that we also have a telegram channel where you can request some testnet funds that you will need later. Uh I will show this QR code more times but uh so we have the telegram channel here where you can request testn net um test net fund for super position. So let's go ahead and get into the content. So blockchain history of course we will start with step one being bitcoin. So I'm pretty sure most of you are familiar with bitcoin here but I'm just going to go through it briefly so that we're all on the same context.
So, in 2009, an anonymous programmer/cipher punk under the set Satoshi Nakamoto released a white paper that was called Bitcoin, a peer-to-peer electronic cash system where he described and later came to implement a decentralized transaction ledger which allowed anyone to send money to anyone else uh in the complete like completely independent of banks and central actors. And this was made possible through some clever usage of cryptography and uh something called proof of work which is basically a consensus mechanism where multiple peers can verify information to be true without having to manually interact with each other. It's all happening autonomously. uh this consensus mechanism is put to uh verify uh the integrity of transactions that go to the Bitcoin ledger and also to record the transaction onto the ledger and Bitcoin was just that like a ledger like accounting bookkeeping. Uh so you just have transactions.
Ali send money to Bob, Bob sends money to someone else so on and so forth. So it was very minimal but it was a big value proposition for its time because like 2009 we were going through a financial crisis. people were starting to question uh banks and central actors. So having a system where you instead of having to trust a central actor, you can just understand the system and therefore you can verify that you own your money and your you can send money to somewhere else was a big value proposition. But people were thinking like what if we could take this to the next step?
How could we take this to the next step? And one of these people that asked these questions was Vitalik Bhutin uh who kind of asked like what if instead of verifying transactions we verify computations. Uh and this question led to the development of Ethereum whereas Bitcoin is like a decentralized transaction ledger. Ethereum's goal was to be a decentralized word world computer with a shared state. So they did this by implementing a virtual machine called the EVM which is powered by an instruction set architecture like the actual thing that power powers a real CPU a computer but all made virtually on chain.
So instead of transactions uh containing like transaction information they contain uh op codes that will execute on this virtual machine. So what this in practice means is that the blockchain is now programmable. So it launched with a programming language called solidity that compiles down to these op codes. Uh so this gave everyone the option to u create apps using the same uh transparency and verifiability. So following the launch of this uh developers were uh having a few years where they did some very nice innovation uh created decentralized uh alternatives to centralized financial systems.
So like lending protocols, stable coins and um exchanges so on and so forth. Uh coin terms such as uh DeFi were coined during this time as well. Uh and while it was certainly a step up from Bitcoin, it was still leaving some things to be desired such as for example gas fees. For every transaction that you send, you have to pay ether in gas to execute these computations. And it was proved first time during uh 2021 when we had the first big influx of users on top of Ethereum that these ga gas fees can get very expensive.
So uh an Ethereum block can only contain so many transactions and once you have uh more requests than what one transaction can actually fill. It's kind of payto-play. They in uh implement this like um uh fee market. So the one that pays the most will be the one included in the next block. This can get very very expensive.
Uh like hundreds of dollars expensive. Uh and also uh the block time is kind of long on Ethereum. It's 12 seconds. So even if you're under the uh assumption that you will be included with your transaction in the first block, you might have to wait up until 12 seconds, which is like given how fast we are expecting our tech to go these days, no one has time to wait for 12 seconds. Uh aside from this also, uh Solidity is a great programming language, but it is very domain specific to just Ethereum.
You can only create smart contracts on Ethereum or on any EVM uh compatible chain with it. Uh you will not create like a backend with it. You will not create a a desktop app or anything like that. You will always need more languages if you want to create the whole app experience yourself. And also it's very like you need a lot of domain specific knowledge to create a smart contract uh using Ethereum.
So it's not always like very obvious to translate in and out of you know regular programming or uh programming on top of the VM. Uh so a lot of companies tried to uh implement different solutions to make to address these three problems. So we have companies that kind of completely scraped what Ethereum did and try to implement uh an execution environment uh from scratch. So you get your uh Solanas or your SUS or your uh Cosmos um compatible blockchains and some companies thought that hey the EVM is nice so we can just like expand on what we have and try to make it better and people were starting to do uh rollups on top of Ethereum which are uh EVM compatible chains that uh derive some of the security from Ethereum but they trade away some of their native security in order to get higher speed. So, one of these roll-ups is Arbitum, which I'm here to talk about the rest of the day.
Uh, on this slide specifically when I'm talking about arbitrum, I'm talking talking about arbitrum one. So, uh, what is arbitrum one? It's a uh, EVM compatible optimistic rollup on top of Ethereum. So, EVM compatible means that uh, it's basically everything that EVM can do uh, everything that Ethereum can do, arbitrum one can do. So if you create a smart contract that you can deploy on Ethereum, you can deploy that on arbitum one with little to no uh modification and vice versa.
Um then roll up I just went through it is scaling Ethereum. Uh optimistic is the most like interesting word out of these uh words. Uh which means that uh that's the way that it's scaling Ethereum. So in order to understand what an optimistic rollup is, we need to understand how Ethereum is doing validation. So in regular uh Ethereum like in regular mainet Ethereum uh it works in a way so that oh yeah I can just keep going because it's just the same slide.
Uh it it works in a way so that uh every validator that is verifying the network is running every transaction. So uh this is very very secure. So if you have like for example say thousand validators every transaction will be run a thousand times and you can kind of see like uh what the uh result of all of these validators are and you can easily uh kind of see what the consensus is of this and just ignore any diverging uh results here. uh which is again great for security, less good for scaling because if you overnight get twice the amount of validators, 2,000 validators in this example, you won't get twice the throughput. It won't be twice the as fast.
It will just means that is uh 2,000 validators running your transaction. So you will have more security. So in an optimistic rollup you you kind of think that the blockchain is already so secure so why not trade some of that away for for speed. So generally speaking in optimistic roll-ups you have instead a a system where every validator needs to stake money when they are validate validating it needs to be a standardized amount of money. You can think about it as like a physical like vault that they are locking in their money and uh it is locked it remains locked for as long as they are validating and uh it's already agreed upon a time window where like from the po point where they stop validating how long it takes for them to actually be able to reach their money.
It can be a week, it can be a month uh doesn't really matter. Um so uh during this time they stake this money as a form of uh like a testament to I will be truthful in this system. Um so uh then uh when they are validating uh the validator that actually records the this transaction will be the only validator that uh is running this transaction. the transaction will be run elsewhere than the blockchain and then only the result will be posted to the blockchain and then uh because of the name everyone remains optimistic that this person is truthful. If however someone thinks that this validator lied in some way you can uh you have this vault lives as a smart contract on top of mainet ethereum and this vault also have uh a mechanism where you can challenge the results that they posted.
So, uh, if you think that they are, uh, lying with their transaction, it might cost you like a,000 bucks to prove them wrong, but you will get the $10,000 bounty because of that. Uh, so therefore, it's in every validator's best interest to remain truthful. Uh, so here's more specifically, this was like broadly speaking how optimistic rollups uh, do it. Here is how arbitrum works from the point where you send your transaction to the point a block actually is created. So transactions flow in here from users to the sequencer.
The sequencer is uh interesting. It's a centralized piece of code that is hosted by offchain labs uh the the guys they created orbitum. Uh they are currently working on actually rolling this out to be a decentralized alternative but for now it's centralized. Once the transaction hits the sequencer, it will be outputed in what's called a sequencer feed. And this will be a soft guarantee that your transaction is valid and will be a part of the arbitrum blockchain.
So from the user point of view, you get more or less instant uh like um feedback when you send your transaction which is great UX. Uh then we can see that we have the sequence transactions here. Also uh the sequencer is in charge of one thing here which is ordering the transactions. sequencing the transactions. So like in a first come first serve type of way.
So we have this the sequence transactions here and then the validator hits what's called the state transition function where they will take the results of all computations and they will update the the blockchain everywhere where it's needed on every necessary smart contract and therefore produce a layer 2 block. At the same time that they're doing that, they're taking this sequence of transactions. They're are batching them together and compressing that and they're sending the hash to this smart contract that I talked about earlier that is the vault and also where you can cha challenge the the validators. So this smart contract on main main at Ethereum will be like kind of where it all settles. Uh so this is how arbitum is scaling Ethereum and while esca scaling Ethereum is cool arbitum also thought that they would address more of the problems that I mentioned earlier.
So two years ago arbitum announced something called stylus which is uh a dual virtual machine. So on one hand you have the EVM on on the other side you have the web assembly virtual machine. Uh so I will be going deeper into what this means and how this works in two modules ahead of this. Uh but for now uh let's just say that this means that you can support way more languages because web assembly is a very popular virtual machine. So uh all of a sudden you have support for Rust, you have support for uh Go, you have support for C, C++, SIG, C and so on.
So on boarding for new developers is easier because these are very big languages uh in comparison to solidity. Uh aside from this, Arbitron has another product which is called orbit chains. These are like app specific chains that anyone can spin up that will uh specifically help them build their applications. So uh the way that uh when I showed this sequencer here, you can think about this picture here, but instead of having Ethereum mainet as the layer one chain that everything is uh settling down to and orbit chain is uh settling down to arbitrum one in instead. So it's a layer three chain.
Uh so why would you want this? Uh partly this uh gives the option to have like hackable chain. you can uh like change things about the the core chain that you want to specifically for your app. This can be things as changing the encryption algorithm. This can be things such as implementing uh uh maybe order book that is part of the core uh core blockchain.
You can go like go wild with ideas here. This also allows for horizontal scaling because uh since you only have your app on this specific chain uh or might only have your app on this specific chain, you only have to take into consideration uh the gas fees that your own users are uh producing. So you don't have to be scared of someone launching this big NFT collection or something like that on arbitrum one because that will spike the the gas fees which is pretty nice. So examples of people that are building on top of arbitum is for example Alex whom I co-created this uh this presentation with is uh the the founder of uh fluidity uh which are uh building the superposition blockchain which is hosting uh the stylus app uh nine lives which is a prediction market. I recommend anyone to go to that GitHub repository and check out nine lives.
It's really amazing that codebase uh also uh Robin Hood the big stock exchange uh they are currently expanding to Europe and the back end for their European branch is actually an entire arbitrum orbit chain. Uh lastly, last year I was in uh Argentina and Brazil and they have this like local payment solution there which is uh through QR codes. You pay in stores with QR codes. This is supported like everywhere uh in both Brazil and Argentina. And they have this startup called Peanut Protocol which allows you to instead of uh paying from your bank account with these QR codes, you can pay straight from your crypto wallet.
and all of this settles down to Ethereum. So, this is probably like one of the more like easy onboarding scenarios that I've seen uh out in the wild for crypto. So, that would be it for the first workshop. I'm happy to take any questions otherwise I'll see you in 10 minutes for going through the the second module of this workshop where we will be starting to coding. Now we're starting the second module uh which is called your first smart contract on arbitrum.
So uh now we're going to get started with uh programming a solidity smart contract. Um again uh this is the link for our GitHub repository. So you'll find all the necessary links uh there uh for uh things that we will go over throughout this uh this presentation. Also, you will find this presentation in written form in a blog post that me and Alex prepared uh before all of this. Uh and again, this was the one that I kind of left open on the the screen.
So, this is the Telegram channel uh that uh you can go to get super position Tesna tokens. Uh so, let's get our hands dirty. First thing I will need and everyone to do is to go to metamask.io io if you don't have MetaMask installed and uh install MetaMask. Uh next up, this second line here is not valid because uh the faucet for superp position is currently down.
So instead of going there, you have to post your wallet address in uh the Telegram chat that I showed you. Uh so uh if I can change now to the uh to my computer. Perfect. Uh after this we'll need to add the superposition uh the superposition test net uh to our metam mask. So we do this by going to shainlist.
org this domain here. Uh can you see by the way the the um the text or is it too small? Should I zoom in? I I can zoom in for Yeah. Okay.
chainlist.org. Uh and uh on this page we need to uh connect our metam mask and we need to press this check mark for include the test net. Then we are uh searching here in the search bar for super position like this. Uh use it super position test net here to the to the right.
Uh so press this button add to metam mask. For me since I have superp position uh in my metam mask uh I can zoom in in case you don't see uh since I have super position in my metam mask nothing will happen when I press this button but um for you you will get prompted by metam mask. So let me know when you've done this step and I can move forward. Uh here we will add the superposition test net to our metam mask. So we will hit this check mark here for including test nets and then we will type in superposition and then we will add that to our meta mask.
When we press this button add to meta mask uh we will get a MetaMask prompt. So next up we're going to go to uh remix.ethereum.org. This is a text editor for solidity code.
Uh so we will be going to yeah just the domain remix.therearium.org and on remix we will creating a new workspace and I will choose blank here and I will press finish. So we will create a smart contract that will store our favorite number. So uh we can all try to think of our favorite number right now in preparation.
Uh to do this in our blank project we can just hit this create button to create a new file and I will call this e cluge sol. Uh so every solidity file is suffixed by soloul. That is how uh it knows that it's a solidity file. So in order to create our smart contract we need to uh write out some boilerplate uh code. So uh let's start here on the first line with writing p a and you can see here in the dropdown that we have pragma.
So if we hit enter on that it will spit out these two lines. Uh so the first line here is referencing uh the spdx license identifier is referencing to uh the license of this contract that we're about to to write. uh and for this demonstration purposes we can just keep it as MIT. Next up we can uh choose our solidity compiler version. So since every smart contract is deployed into the same virtual machine into the same environment, it's up to every it's up to every smart contract to keep track of what compiler they're using because you have one thing that's kind of changing over time which is like the latest compiler version and but they are still deployed on the same network.
So in order to keep track of of this, we are manually writing what compiler version it is. So for this tutorial, let's keep it to the latest and greatest, which is 0.8 34 like that. So uh in order to actually create our smart contract for our favorite number, uh it's quite similar syntax to these like very very object-oriented programming languages. If anyone of you have written any Java code, it's uh similar to how you define classes there.
But instead of using the word class, you use the word contract. Solidity is very object-oriented. Then we call it ETH cluge and we open up curly brackets. So within these curly brackets here is where we will be spending most of our time as smart contract developers. uh here we will define like every global variable and every function that does the logic that we need to perform.
So in order to create our favorite number we will create a variable a global variable. Solidity is a statically typed language. This means that every variable needs uh like an annotation to say what type this variable is. So uh we need we need to let the compiler know in advance is this a number is this a word uh is this a boolean. So uh we have two types for numbers which is signed and unsigned integers.
Signed integers are uh like uh integers that can be both negative and positive and unsigned are just positive. So the most default uh number type in solidity is an unsigned integer of two 256 bits. Uh and we will do it public because we want everyone to know our favorite number. And then we can choose the name for our uh variable which I will choose favorite number like this. Then we can see here up in the left corner here we have a compile button.
Uh we can press that and we see here on the solidity compiler that we have a green check mark. This means good uh our smart contract compiled. So this is like already a working smart contract. But it's not a very fun one because uh right now we're not setting our favorite number. It's just the default value which is zero.
So in order to choose what our number is, it's equals and then we can choose our favorite number. I will write eight here. I will press compile again. And then we can navigate here in the buttons to the left here down to deploy and run transactions. Um we can hit this deploy button and then we get our contract down here.
Uh so we can open it up and we can scroll through the functions. This is the favorite number. So I will uh take that and I will call that. This will return eight. So it returns my favorite number.
Very good. Also here with um with the green check mark. If I can just demonstrate how it looks in case I'm not writing valid solidity. I can remove this eight after the equal sign. And if I uh if I write try to press the compile button again, I will get a red error.
Uh if I hover above it, it will say parse error expected primary expression. This means that uh I have to say something after the equal sign. Uh otherwise solidity won't compile. So say that I want to be able to throughout the lifetime of this contract uh update what my new favorite number is. uh then I need to change the state.
The state being our storage here with the the with the global variable. In order to do this, I will write a function. So we use the keyword function. Then we can choose the name of our function. Uh I will call mine up up update favorite number.
Then within parenthesis we are uh choose sending in function arguments things that we use to modify. So we will send in our favorite number which again is an unsigned integer of uh 256 bytes and uh we call it new favorite number external. So two things here number one uh for function arguments you will see a lot of solidity developers will prefix uh their function argument names with underscores. Uh I find it a bit easier to read. It's not something you have to do, but I prefer doing it that way.
I find it easier to read, but because when you have these larger functions, you can kind of easily skim through every variable and therefore you can kind of see uh if the the variable comes from the function signature or if it comes from somewhere else. External here is referring to the visibility of this function. So in solidity you have four levels of visibility. You have uh external, you have uh public, you have internal and you have private. So what does all of these mean?
Uh external means that function is only callable from outside uh of this contract. Public means that function is callable from everywhere and internal means that uh function is callable from inside of this contract. um and any contract that inherits this contract. Private means that the function is only callable from inside of this uh contract. So uh which uh visibilities should you choose?
Uh not everyone will agree on this. Personally, I like to keep it as strict as possible. So if the function is something that's like userf facing that the user will interact with I prefer external and if uh the function is something that will only be used by other functions like core logic that is not uh user userfacing I prefer private and I switch it to either uh like a higher visibility only in the case that I actually need it throughout the development of my smart contract. So switch from private to internal or from external to public. Anyway, so to create this function, we will uh write favorite number equals new favorite number.
So we send in what we send in from this function argument as the new favorite number. We compile and then we are uh resetting here. Then we will try to deploy again. And now we will see in the functions here that we have two functions. So we can call favorite number again and get eight.
Then we can go to update favorite number and send in something else like 10 uh transact and then I can go back to favorite number call it again and you see that now it returns 10 instead of eight. So uh not all functions need to change the storage. We can also do what's called a read function which is something that takes data from uh like only returns data without actually changing anything. We have two types of read functions in solidity. We have view and we have pure.
So the difference between these two is that view is a read function uh that can read from storage and a pure function is a read function that can't read from storage. So uh if we want to create a function which takes whatever our current favorite number is and multiply that by two we can write function uh and uh times two and it will won't take any arguments but it will be again an external function. Since we need to read the storage to get our current favorite number, it needs to be a view function and then it will have a return value. The syntax for uh returning is similar to the syntax for sending in function arguments. So again you say that you want back a u in 256 and it will be called rest for uh response.
I open this up. Rest equals to favorite number times two. Like that. I can hit the compile button again. We see that it compiles.
I could have written this uh like this instead. Return favorite number times two. Uh this is also completely valid solidity code but uh I find it a bit more easy to read with this uh named return values. Um and also uh especially with smart contracts it's important to remember that you will spend usually more time reading the contract than actually write writing the contract. So readability is a big thing in smart contract development.
We hit compile again. We reset uh we deploy the new one. And if we look up this times two, we can call that and we can see that it returns eight which is double of or 16 which is double of eight. Yes.
Yeah. Two questions. Uh what does the uh the gas the number
uh it is trying to ma measure the amount of gas and it is a bit buggy on remix. This infinite gas is not true. is not something you have to worry about but it is trying to like estimate what gas it would be for this these functions. Uh if I try to change the the here so if I try again to say favorite number equals uh 10 for example uh you will see here that I get an error right away. So function cannot be declared as view because this expression potentially modifies the state.
So if I try to hit the compile button here I will get an error. Uh so yeah we have we have that safety in place there. Uh good questions. So uh next up we can also from functions in solidity we can call other functions. So what if we want to take the result whatever times two is returning and we want to send that as a function argument to update favorite number.
We can do that. So let's write function uh I want to call it chain because we're chaining transactions together. Uh external uh since we will be updating the state here, it can't be a read uh function. So therefore it just returns a value because I want to return what the new favorite number is like this rest. So we write update favorite number and then within parenthesis we write times two like this.
And now we see here that we have a problem. We see that we have this red underscores here. Uh we have a compile error. Uh if I try to hit compile, we will get the error up here. If I hover above, we see undeclared identifier update favorite number is not visible at this point.
which is pretty weird because if I hover above it, you can see here that it pattern matches with the favorite number that I have here. Same with times two. So why is this? Remember what I said about visibility that external functions are only visible from outside of the contract. This means that we have to change the visibility of these functions.
So instead of having them external, we now have to switch them to public. Uh same here, we're switching this to public like that. H now it will give us a warning because we are not returning any result. So let's do that as well. Rest equals to favorite number.
Then we are uh compiling this again. We reset previous chain. Uh then we are deploying. And now let's uh expand the terminal a bit here. If I uh press this chain here, I can transact to it.
And we can see here in the logs we can expand them with this um with this um arrow down here. We see that it returns 16. If I press again we can see that it will now return 32. So it will keep going like this. It would just double whatever our favorite number was.
So 64 so on. So this is coming along nicely. But uh we have another problem with this which is that this contract can only uh support one person's favorite number. If uh we were to deploy this on a network and have our favorite number, someone else could just update that and maybe we want to keep track of everyone's favorite number, our friends too. Uh we can do this.
Uh I can just remove this two function here. Uh in solidity we have something called a mapping which is a variable that takes an argument that acts as a key and this key will point to a specific value. So for example, the key could be someone's name, the name Jack. Uh, and that uh that key could point to whatever my favorite number is. So the syntax for doing this, let's replace our favorite number here with mapping.
Then we open up parenthesis and then the uh type for a word in most languages are uh string and this is the same in solidity. So string uh name and this is pointing to a number u in 256 favorite number uh and this will be public like so uh and I will name it favorite number off like this. Uh personally I find it very satisfying to name a mappings because when you may name them like this favorite number of off uh the syntax actually try to get data from uh a mapping looks like this favorite number of off. So if I were to uh if I were to try to get my favorite number I would have these square brackets and I would send in my name here. So favorite number of Jack it reads like a sentence which I find very satisfying.
Uh however uh to use our name as an identifier on the blockchain is usually not recommended because for example me personally I know that Jack is quite a common name internationally. So there are a lot of people with the same name. So therefore if they update with their name Jack they will just update my favorite number to their favorite number. Uh meaning that again we will have the same problem uh that we will uh overwrite each other's name. So we need something that's more unique to me and luckily we have that very easily accessible on the blockchain.
We have uh now when we created our wallets in MetaMask what that creates is a private key uh that from that we derive a public key and from that we derive an address. So the address is our per like public identifier on the blockchain. So when someone sends money to me on uh a blockchain they will send money to my address. they won't send send money to the name Jack. Uh and we have a type for this which is address wallet.
So let's change string uh name to address wallet here. Then in our function we update this to actually take. So we write instead of favorite number we say favorite number of off. So how do we reach the the wallet? Do we have to send that as an argument to this function?
Answer is luckily no. uh whenever you are transacting to a fun function in solidity uh or on the EVM uh um an object is created that's called message and we write it like msg and then we can write dot so message contain some fields it contains data it contains gas it contains sender signature and value and message sender that's actually the address of whoever is calling this function right now so I hit enter on sender sender Then I try to compile again. Uh again let's reset this and deploy latest version. I go to update my favorite number. Then uh I set it as 8.
I transact. We see that it went through. Then here underneath account one here you can see that I have my public address which I can just copy. Uh and then we can go to functions again and take favorite number off. Pass in this address here.
We can see eddc4 which is edc4. It matches. So I call that and we can get that my favorite number is eight. Very good. Say however that we want to have more information that this is pointing to than just like my favorite number.
We want the name again. Uh we can do this by creating what's called a structure in solidity. So keyword is strct. So uh what is a strct? Um a strct is uh basically like um JSON or like a collection of other data types.
So you can build a data types out of a collection of other data types like a form or a JSON object. So this one will take string name and it will take uint 256 favorite number like this. Uh so instead of having my wallet pointing to just a uint, it will now point to uh type info with the name info like this. So in order to now update this structure, we need to send in my name to this function. So string uh and solidity is very particular about memory.
So therefore we have with strings since you can't really know in advance how long a string is how large that data type is you have to send what type of memory it is you have three types you have memory you have call data and you have storage and all of these are used for different purposes uh but 99% of the time you will want to use memory uh like so uh we name it name like this and then uh favorite number of msg. Equals to a new instance of info which takes name and f new favorite number like this. I compile. I reset this. I deploy next version.
Uh I press update favorite number. Now I send in my name as well as my favorite number. So Jack 8. I transact. Then we go back to the favorite number of off com copying my wallet here.
Uh sending in the wallet address here. I call that and now we can see that it returns Jack and the favorite number eight. So uh next up uh when we are writing smart contracts we have to think about that uh at some point someone will need to write a front end for our app. uh because most likely our users will not want to go to uh remix.ethereum.
org to interact with our app. They want a nice front end. Uh and therefore we need to keep track of like uh making sure that the front end is easy uh the smart contract is easy to uh interact with from the front end. So in order to do this, we will uh create an event because right now uh it's kind of hard for a smart contract if you want to create something like a feed that will update every time that someone updates their favorite number. Uh right now it would be kind of hard to know when to fetch new data from the blockchain.
like do I query every possible address or do I try to make something that only is triggered from uh when someone is uh is updating their favorite number. What if I do that and their transaction won't go through? Will that endlessly be polling? So in solidity we have these customizable alerts or events which is exactly for that. Then the smart contract will just like say like hey this happened and you can program what this in this context is.
So favorite number updated and it will return address uh wallet and uh it would return whatever that person's favorite number is. Uh so in the end of uh the function here we write emit favorite number uh oh I will write favorite number updated uh favorite number uh updated like this and it will pass msg sender and it will pass uh new favorite number. So we can compile this again. We reset the state here. Then we deploy latest version.
And now we will read again here from the from the terminal. So if I take uh update favorite number I send in Jack and favorite number eight transact. We can now see here in the logs that uh we have here an event favorite number updated and that has our address as well as the new favorite number. Very good. So last thing I want to cover I'm a bit over time here so I will keep it a bit fast is uh remember that by the start of this we have a default favorite number.
We deployed it with our favorite number. In case we want to do this again like something similar to this have uh we can do something that's called a constructor and a constructor basically is a function that will only be run once. It will only be run when you are actually creating the smart contract. Uh it can never be run again and it works similar to a function. So you write constructor like this.
It won't have a name because again it will only run run once. It will take some function arguments. This will be string memory name and it will be u inint 256 uh new favorite number and uh in my constructor I will uh make it update favorite number and send in these function arguments here. I will compile again. I reset here and when I deploy now we can see that uhoh I have errors.
Why is this? This is because now in order to be able to deploy I actually have to give it these uh these arguments straight up. So I have to give it right away up front. So I will have to send my name and my favorite number eight. I press update and now you saw that it deployed uh again with the favorite number updated.
So now uh because we've been deploying all of this on the remix virtual machine. This is an EVM that runs locally in our browser. It's not live anywhere. If we would like to deploy it to a test network. Uh for this it's important that you have the test net funds and your metam mask if you want to follow.
We can change here to remix VM to browser extension and we can change select to meta mask like this. Now it's important that we go to our metam mask and we make sure here that we are connected to the custom network superposition test net here like so. After this I will take this contract and I would trigger the deploy button again. Uh that will open up MetaMask and I can confirm the transaction. So now fingers crossed that the transaction will go through and there we go.
I can copy this address. I can open another window here. I can go on Google and type superosition testnet explorer. Uh then I can go to the first one here. Uh head to the homepage and I can search for the address that I just copied.
So we see here that this is the smart contract that I just deployed. It has one transaction. It was triggered 33 seconds ago. So this is a live uh solidity smart contract on superp position testn net. Thank you so much.
So inside of this GitHub repository uh that we prepared uh we have one folder that is called uh stylus challenges. This is like very much the same layout as the the solidity challenges. So we have one that's stylus challenges and one that's stylus challenges solved. Uh and when you go in here you can see that we have three stylus challenges. So if you go into like the full path into the project.
So you have eccluj stylus challenges one vault. You can take the URL here and copy this. Uh and then again head to the wizard here and we can go to import from GitHub and we can copy in here the the link here to that challenge. if we can import that. Uh let's see.
No space left on device OS error. Uh I guess that's okay for now because I have already imported that vers uh version here. So let's try if you can if you can you get the same error uh then I will because um also the wizard great tool made by Tolga. So we have him in the in the chat as well for um for that workshop the telegram chat that I invited you all to. So let's just see if it's something that we can work on.
Okay. So it it works now. So uh instead actually of doing the whole import from GitHub thing uh you can instead head straight to the ETH cluge here the ETH cluge tab in the wizard and we have vault uh email and lending. These are kind of in all different tiers of um of um complexity. So I recommend you start with uh this template here, the vault template and it will be the same way as it was with the solidity challenges.
uh you will get here uh the full uh project and you will have some comments with some challenges for you to solve. Also uh in in the chat in uh this chat that we made together with Alex uh where you send your um addresses to get testnet funds. You can also ask questions there if I'm busy answering someone else. If uh more people at one time have questions, uh Alex will be able to answer as well. And uh it's the same layout as with the solidity challenges.
So for stylus, we have the challenges here and we have the challenges in a solved version as well. uh in between every time that you run this uh when you're trying to um when you're trying to um uh what's it called like solve these challenges you can write test here and run this and that will be running the the rust tests for this uh challenges the first compilation is always a bit slow as you can see now uh but they they will run and then the next compilation after that will be smoother So yeah, uh start start off with uh number one, Walt, and see how far you can come here in solving this. Okay, so Alex just wrote as well in the in the chat that you should look out for this to-dos here. So when you find something that looks like to-do exclamation mark, that is uh what you need to implement. If you're watching this, I I see that some people when they are trying to create uh a new uh use the template here vault, you can see that they get repositories private.
So it's trying to import again from the GitHub instead of uh uh instead of um actually getting it down. So th this is no matter if I'm trying to import it from from GitHub um here or if I'm trying to use the template here. Okay. So when I tried to connect to my phone's um hotspot then it worked to to um create a new uh project. So try that to disconnect from this shared Wi-Fi and try to connect from your phone hotspot instead.
So unfortunately a lot of the time from from this um kind of challenge time went to technical difficulties but we still have some sometimes and sometime and then it will be a break and then we will moving on with the next module but hopefully you will be able to read through the um stylus contracts and you can also like do this whenever you feel like if you want to pick it up later. We have actually uh all of the contents for these uh for these workshops on the blog as I mentioned before. So we have all of these modules in written form as well. So you want to go to uh the the vault and for me to give a brief rundown here. Yeah.
So first of all uh we're setting up solidity interfaces. So these are to to interact with uh solidity style code. So these are uh from the ERC20 standard. Uh so every RC20 token will always have the balance of the transfer and the transfer from. Uh so having the interface like this allows us to interact with both um stylus contracts as well as solidity contracts.
Uh so this is just as an interface to use later on to actually interact with the ERC20 contract. Then we have the entry point here. This is the storage creation of the smart contract. So these are the global variables that's held in a strct. So our contract is called token vault.
It has uh the token which is an address and it has total shares which is a u256 and we have shares off which is uh like the mapping in solidity but in rust instead. So we have a storage map which takes in an address that is pointing towards a number. So query like how much uh what's the what's the balance of this address. Next up, we are preparing a lot of events uh that we will be using later on. Here we are preparing solidity style errors that we will be using later on.
Here we are uh implementing debug for error. This is to be able to print a nice error in our ter terminal when we are testing it out. And next up we have our public functions. So in it here is equivalent to the constructor in solidity. So this is what we need to do in order to actually create the uh this smart contract.
Next up we have [sighs] uh we can check what token that this vault is for. The address of the token we're getting back that address. Next up we can query the total shares of similar to the mapping uh [sighs] or no no uh here here we are getting the total shares and then we have uh a function that gets the shares of a specific address. Um next up we have a function to deposit tokens. So this is creating uh kind of an ERC contract out of the we're we're fetching the address of the token.
And then we are using the interface for the DRC20 token uh to uh be able to send and receive this uh this token. Then most things here will be pretty self-explanatory. Uh and here we have the token vault like um the non-private functions of token vault. So this is mint shares, burn shares. Shares is what you're getting back from uh depositing tokens.
You're getting like shares how how how much you are eligible for of the total supply of tokens. Um yeah, that is the functions. Uh so the the task here is to implement based on what you see from the deposit tokens uh you should uh try to implement the withdraw tokens function. So, uh, now I think that we're having, uh, 10 minutes break. Uh, feel free to like keep coding if you want to.
Uh, and we'll get back in 10 minutes to get started with building front ends for our smart contracts. Fourth and final module of the arbitum workshop here. Uh so this one is called deploy and go from contract to app. So now we have our contracts both solidity contracts as well as stylus contracts. Uh we have hopefully deployed some contracts together.
So therefore uh there's one component missing to have a fullyfledged app and that is a front end. So again uh if you haven't already go to the GitHub repository that me and Alex prepared. uh we'll have a lot of uh useful links there and for this uh for this module again we need test net tokens so make sure that you have requested test net tokens from the telegram channel from Alex uh so we will be creating a front end using react uh and we will be creating it using the vagme library uh vagme is an a library to interact with EVM uh chains is built on top of um an Ethereum library that's called VM on TypeScript. So, uh again, I think most of you have this already, but make sure that you have MetaMask installed. Make sure that you have superposition tokens and also uh that you have added superposition to uh your MetaMask.
And lastly, we're going to go to stack blitz. So if we change from uh from the slides to my computer screen. Perfect. So uh what we're going to want want to do first is that we want to take the GitHub repository. We want to copy this again and then go to stack blitz.
com. It will look like this. Uh next up we will be open a GitHub repository here. So as you can see we want the repository owner and name here. So uh make sure make sure that you have um an account already because I I don't think you can import without an account.
So create an account on stack blitz and then import it like this. Uh let me know when you have it uh imported imported. So you need to remove GitHub from the URL. So you only have stylus developers guild/clusion-2026. Then you will press open repository.
So it should look like this. Um let me know when you're there also to I can explain uh a bit further. uh the main um the main map that we want to work from is this front- end code along here. So we will be doing code alalong together. Uh so what this map is the front end code along is that I have uh used locally the pnpm package manager to install vagme and then that will give me a command to create a new vagme project.
So I did that locally as well and this is more or less like a vanilla vagme project and uh I have added some comments to it to make this code along a bit easier to uh yeah to do a bit faster. So we can also here in the terminal now change directory to uh this front end code along that we want to work from uh like so. Then we can first uh first write in the terminal pnpm install. This will install all of the dependencies uh that we have to run in order to uh do I need to make this a bit bigger by the way. Yes.
So let me zoom in like that. So once it's installed we can run uh pnpm rundev. So this will create this will start up a dev environment for our front end. And we can see here see here to the right this is our front end right now. Uh this is the default vanilla front end that uh vagme creates for uh a project.
So within this frontend code along we have three files that is of interest for us. We have the main.tsx. This is basically where you land uh when you're opening this URL. This is like what's rendered.
This is connected to an app tag which is from app.tsx. This is uh kind of the app router. It will do all of the app specific logic here. And this will update in real time.
So I can update co connection and write uh uh gm cluge like that and I can hit command save and that will now render here on the right. Uh next up we have vagme.ts TS and this is the configuration for our uh EVM connection. So we want to interact with superp position. Uh so this is where we will be starting to code.
So as you can see here if we go through the code we are importing a hook for conf creating a config. We're also importing uh pre-prepared uh objects for Ethereum mainet and Ethereum Sapoleia testnet. And further down here we are creating a config with both mainet and seapia. We want to uh we want to uh swap this out to superposition. Therefore the first step that we need to do is to import define chain uh from uh VM like this.
We can save. Um next up we can uncomment this code block here. Uh this is basically uh the same type of object that we imported for uh both mainet and sepoleia here. So we can see that it contains chain ID. It contains the name of the chain as well as some information about the native currency, the RPC URL so on.
So uh we want to use this instead of mainet and seapoleia. So we can remove the import of mainet and seapia like this and then hit save again. And now we can see that uh oh our app is not rendering anymore. That is because here we are trying to reach mainet and and sapoleium when we want superp position. So we can instead update this to be super position.
And then instead of having two lines we're only supporting one network. So let's swap out here mainet again to super position. Um I can save and now we see that it all works again. So uh given if I am connected to Ethereum mainet from the start here this is just to demonstrate something. If I press the MetaMask button here my MetaMask will be prompted.
Uh let's see. Uh okay. So, I'm getting uh I'm getting this scary looking thing from uh from MetaMask right now. This scary looking alert, but this is fine because this is our own web container. Make sure that you're on stack blitz.
So, we are connecting anyway. We connect and we see that our wallet is connected. Uh we see here that the chain ID is one. But we have a problem here which is that uh the chain ID that we want to have is uh 98985. So uh what MetaMask is doing right now is that it's connecting to the chain ID that you just happen to be on when you're connecting your wallet.
But we want to interact with superp position directly. So if you were to send transactions right now, you would have uh like they would probably most likely break because uh they would probably most likely error because it would try to send to uh mainet ETH instead of uh super position. So therefore uh we want to write logic that on a successful uh on on a successful connection we will also update the chain. So we will write that in app.tsx.
So we will go here to the hooks and we can kind of format here a bit nicer so it's easier to read. Then we can add la last here by the imports uh use switch chain like this. And we can also imple uh we can also import import uh superposition uh that superposition object that we just made from from the file uh vagme not the actual library vagme. Next up we're going to go to this hook um creations here. We're going to create a new hook which is uh mutate switch chain uh equals to use switch chain like so.
So we now have our prepared hook. Um then we will navigate down here because we want this to happen when we trigger this button. So we will kind of try to find here we can find a connect header and here is the button that actually handles our connection. So on click here this is where we actually get connected. So we can create a new line here like so we can write comma here open up new curly brackets and on a successful uh connection we want to execute a function that looks like this.
uh switch chain and it will uh send the arguments Shane id superposition id like so. So I I hit command save again. Now I disconnect and now when I'm connecting my wallet it should connect to the 98985 instead of chain one. And you can see that it did. So now we're connected to the correct chain.
Uh next up, what I want to do is that I want to interact with the wrapped uh wrapped ethereum address of superposition. So the wrapped Ethereum address is uh a standardized or wrapped Ethereum contract. It's a standardized contract that exists on more or less every EVM chain. It takes the native currency and wraps that into an ERC20 to token so that you can have your native currency interact with other smart contracts. Uh and in the case for superposition uh since the native currency of superposition is not um ether it's superposition then it will be called wrapped superposition on super position.
Uh but I will use these terms kind of interchangeably just so you know. So what I want to do is that I want to uh interact with these this contract. So what in in order to interact with a contract I need two things. Uh one I need the address of the the contract. So for that we can go to the test net explorer of superposition.
We can uh browse the tokens here and we can find the wrapped superposition here. So we can see here I can open this up. We can see that the the address is uh 214C. Let's see if uh looks like it's a bit slow. The here uh 214 C and I already prepared uh this con constant here which have the 214C.
So I have the wrapped Ethereum address here. So I will just uh uncomment this. Uh secondly, we need something that's called an AI. So an AI is basically this huge JSON object that uh is telling us how we can interact with the smart contract. It's basically like guardrails to interact with the smart contract.
So it will tell us what uh function signatures we have available and uh how we can interact with these. So uh unfortunately the wrapped superposition token is not verified. So I can't get it from here. here I will just get this huge pile of op codes here but I can go to since it's standardized and the same on every chain I can go to mainet ether scan and I can uh browse for tokens here instead look for the top tokens and we can see that we have wrapped ether here and from here I can read the contract and uh get the AI. So this is kind of how the API looks uh when I get it.
Uh same as with the address I have already prepared that. So if you go to uh inside of our front end code along to AIS we have the wrapped ethereum.ts it actually exports the entire AI. So from app here we can import [sighs] uh wrapped ethereum abi from abis slash started with like that slash uh we like that. Then uh in order to what I want to do from the start is that I want to read the total supply of wrapped ethereum.
How many or how many wrapped superp position does it exist. We can see here on the scan that there are uh approximately three and a half million wrapped superposition. Uh so in order to do that I will be using uh I'll be using um a a read function that's called total supply. So use read contract is the hook that we want to use. Then here we can create our call which will look like this const uh data is total supply and that is use read contract and we need to send in some information here.
So first of all we need uh the AI like this. Then we need the address like this. Lastly we need the function name. So function name is and it's a string. So total supply like that.
Uh then we can go to the bottom of our page here. We can add a tag like this and write total supply is and then we can have inline here total supply. So let's save that again. We can see that it pops up. So we see here that we get this huge number here.
Uh with one problem uh we don't have any decimals here. Uh if we go through the the superposition test net here we see that it is uh 3 and a half million and it is 76.5 and if we go to that decimal point 76.5 uh we can see that uh the decimal isn't inserted. This is because uh the EVM can't handle decimals whatsoever.
It's only full numbers and therefore every smart contract uh stores the decimal uh point as well. So you have to export the decimal point as well as the number in order to actually be able to render this correctly. This comes down to that computers in general are uh horrible at handling uh decimals and since the EVM is kind of like a financial thing, it's kind of important to get numbers right. Um so uh then to uh to get the decimals we can just copy the code from total supplier. Copy this.
Uh do it like that. It's decimals decimals. Uh [sighs and gasps] and then we will need to to format this in order to in order to render this correctly. So we will use uh from VM import format units. This will uh use these decimals in order to display it correctly.
from VM. Um, but now we're about to do like math on top of um on top of these numbers that we're getting back from the blockchain. And the problem here is that whenever we're reading from the blockchain, uh that is actually us sending an a request over the internet, an API request to actually get that number back. There's no guarantee that we actually get what we expect back from that. uh we wish to get the number but we can get something else.
We can get an error. A lot of things can happen on the way. Uh so uh this vagme library solves that by either giving you what you want or it will give you undefined. And uh same as with uh the rust logic when you're trying to operate over this number if it is undefined that will completely break. So therefore we kind of need to take this in consideration now when we're about to format the the results here.
So instead of displaying total supply like this we can uh [sighs] open up a curly bracket here we can create a condition an if else statement. So if uh total supply is not equal to undefined uh meaning that if we actually get the format that we expect from total supply uh and not an undefined and if decimals is not equal to undefined then we will be printing uh total supply is then format units total supply and decimals. If however any of these two isn't uh like if if we fail to fetch either total supply or decimals, we will instead uh send back could not get total supply. So now we can save again and now we can see that when we update that we do get three and a half million and we get that seven 76.5 corrected decimalization.
So very good. Uh lastly I want to because right now we're just reading from the contract. If we want to send um send a function that is actually interacting with this contract uh like hitting a state changing uh function then we can use the very intuitively named since we just use use read contract we can use write contract. Uh in order to use this we can create a new function here which will be a tag. So function mint like that mint will return uh couple of uh HTML here.
So it will return form uh we don't need an action just yet. Uh we have a header in the form which is called uh mint wrapped superposition and we're excited. So we do a couple of exclamation marks. Then we will create an input field here. The input field will be of type number.
And we can format this a bit nicer like this. Uh so [clears throat] name is amount to mint. ID is amount to mint. and step here which is like the decimal precision that we have for this input field is 0.001.
This will give us uh like three decimal precision when we are changing the number otherwise it will just be whole numbers. Uh we will create a label for this which will be a label for amount to mint which says amount like that. Lastly, we will create a button which will say mint. Uh button will be of type submit. Then down here we will be adding the tag that we just wrote.
So mint like this. So we can save that. And we can see that we we're getting this mint mint button here. Right now it doesn't really do anything. If I press it, it just like refreshes.
Uh because we haven't implemented any of the logic to do that yet. So now I set uh on form here we set on submit equals to uh then mint. So we will create a mint function within uh the capital mint function. So async function mint it will take e which is uh react dot sub uh mit event and it will take html uh uh form element like that. So first of all we want to prevent uh the possibility that someone just hits the submit button when we don't have any text here.
So therefore the first line will be e dot prevent default like that. Next up we want to fetch what we actually got here from the amount to mint. So we do that by first creating one const that's called form data which is a new form data from e.target as uh html form element. Then uh we want to extract the amount to mint from this.
So const mint amount equals to form data.get and we're sending in the key amount to mint in here. So now to set up uh our hook here, our write contract hook, we are writing const uh data hash then write contract equals to use write contract like this. Then we will then the actual call is very similar to the use read contract. So we will use write or uh write contract then open up like this and we're sending in AI which is uh wrap ethereum AI.
We are sending in the address which is uh wrapped ethereum address function name which in this case is uh deposit and lastly we want to send in a value too and this value will be the mint amount but remember what I said that the EVM can't handle decimals and right now this uh form is uh using decimals so like you see like I I will type in 0.01 or something like that. Therefore uh we must be able to handle that too. So within uh this import for format unit we will add another import with it which is parse ether. This will take a regular number and parse that into an ether value correctly and that will take a string.
So therefore we must take this as string. Then we update here. So value is equal to parse ether and into that we're sending the mint amount like this. Uh I think this is it. Uh so lastly, we want uh for our users, we want some feedback for for them to know if their transaction actually went through or not because right now it would just be me pressing the mint button and then uh I would have to I don't know guess if my transaction went through or not.
So let's create that as well that logic. So if we get a hash then we will render a p tag um like this uh that says transaction succeeded hash is equal to uh then inline hash like this. So I press save again and now fingers crossed uh we are send we want to mint 0.001 uh wrapped super position. So I hit mint and it should trigger my metam mask and uh I need to acknowledge that I am fine with this.
So here now we can see that transaction succeeded hash and I get the hash. So I can copy this hash and again go to the supernet test net explorer. I can search this hash and uh the explorer is a bit slow. So right now it hasn't find the matching result. If I try to refresh, we can see that I have my transaction here.
So I can go into this. I can see that I indeed uh minted 0.001 001 superposition tokens wrapped superposition token and that did this happened 25 seconds ago. So this is how you would write uh a front end using the the vagmail library in uh react. So the the last uh the last and final challenge here will be for you to use the previous uh contracts that we deployed.
So for example, if you want to deploy something from our metam mask uh or from the remix here uh where we were implementing not this one but actually the one here. If you want to deploy anything from solidity challenges solved here uh smart contracts or if you want to deploy uh anything from the wizard uh with uh the wall vault that we were creating and then you will take that uh that contract address and you can uh create it's kind of an open-ended challenge here. So uh through stack blitz here create your own front end for that contract. So I will be here around to help you um with any questions that you might have uh during this process.
Automatic transcript — names and jargon may be misspelled.