Solidity Essentials: Web3 Development Blockchain Programming | Amir Rimer | Skillshare
Drawer
Search

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Solidity Essentials: Web3 Development Blockchain Programming

teacher avatar Amir Rimer, My great passion in life is to teach others

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction To Solidity Training Course

      1:31

    • 2.

      What Is Remix IDE

      2:50

    • 3.

      Create A SOL File

      2:00

    • 4.

      Our First Line Of Code In Solidity

      3:12

    • 5.

      Defining A Contract

      3:43

    • 6.

      Errors, Warnings, and Comments

      8:11

    • 7.

      Uint256

      3:01

    • 8.

      Function Declarations

      2:03

    • 9.

      Deploying A Contract

      4:56

    • 10.

      Visibility

      2:32

    • 11.

      Updating A Variable

      1:56

    • 12.

      Scope

      3:43

    • 13.

      Structs

      4:55

    • 14.

      Arrays

      1:57

    • 15.

      Adding To An Array

      2:52

    • 16.

      Types of Arrays (Dynamic, Fixed)

      1:17

    • 17.

      Memory

      3:58

    • 18.

      Mapping

      5:20

    • 19.

      Deploying To A Live Network

      3:01

    • 20.

      What Next After This Course

      0:53

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

82

Students

--

Project

About This Class

Hi, my name is Amir Rimer, and welcome to my step by step video course: Solidity Essentials

In this course I will take you by the hand and teach you everything you need to know about the basics of blockchain programming.

I will teach you the basics of Solidity, blockchain, web3, blockchain development, blockchain programming, Ethereum, so you can start your journey to become a blockchain developer.

This course will be perfect for people who are completely new to programming in general and Solidity in particular. Even if have never heard about solidity programming, smart contract, dapp, don't worry, I will walk with you step by step and teach you everything there is to know in this course.

After each lesson we will have a short quiz inside the training which will let you asses the skills that you gained in the matching lesson.

This is a project based course which means that I will walk you through the basics of Solidity through a real world project that we will do together during the lessons. At the end of the course you will have a project that you can complete.

Once you finish the course, you will be able to knows the basics of solidity programming.

Here is exactly what you will learn inside the course:

  • What Is Remix IDE

  • How to create your first .SOL File

  • How to write code in Solidity

  • Defining A Contract

  • Errors

  • Warnings

  • Comments

  • What is uint256.

  • Function Declarations

  • Deploying A Contract

  • Visibility

  • Updating A Variable

  • Scope

  • Structs

  • Arrays

  • Adding To An Array

  • Types of Arrays (Dynamic, Fixed)

  • Memory

  • Mapping

  • Deploying To A Live Network

If you have never even heard about Solidity, Programming, Ethereum, Gas, Crypto, and Blockchain or heard about it but never took the time to really go into it, then this is an amazing chance with this Solidity Essentials course.

Meet Your Teacher

Teacher Profile Image

Amir Rimer

My great passion in life is to teach others

Teacher

Hi, my name is Amir.

I love learning new things, and then share those new things with others. When I discover something new that gets me excited I want to immediately share it with others to get their reaction. Online teaching is my great passion in life.

As a certified elementary English school teacher, and an online instructor for the past 28 years, I have under my belt countless hours of learning and teaching experience.

See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction To Solidity Training Course: Hi there. My name is Amir. I'm an internet marketer and a certified elementary English schoolteacher. In this course, we will learn the basics of the Solidity programming language. Now, this course is for complete beginners. There is no need for any prior knowledge about solidity or any other programming language. We'll also don't need any prior knowledge about the blockchain or quick to go and see. In the course we will go for exciting topics such as what is Linux, and I'll create your very first solidified. In this course, you will learn how to write your very first lines of code in salinity. We will learn how to define a conflict, how to deal with coats, warnings and arrows, and out wide comments that will help both you and other people understand your code. Bento. We will also learn how to create and update a variable. We will learn about functions, conflict compiling and deployment. Scopes, start fixed and dynamic arrays, memory storage mapping. Now to deploy our conflict to allow network for the cost of the project that you can complete, which you can use for practice purposes and to your portfolio. Now, I'm going to share with you everything that they know about solidity. So you will get a complete yet still simple and easy introduction to solidity. 2. What Is Remix IDE: Hi everyone. In this lesson I want to explain what remix IDE is. Remix is a web, free web and desktop application. It is an open source and it is used to write, compile, and debug solidity code. It gives users the ability to develop, deploy, and administer smart contracts for a film like blockchains, IDE stands for Integrated Development Environment, or in simple terms, it is a software which makes it easier for users to build programs. Let's now access the remix IDE web application. To do that, we will first go to Google, then we will want to type remix space. And then the world IDE inside the Google search line. And then once we see the Google search results, we will want to click the remix. I find it helium Id search result. Once we do that, we will find ourselves on the remix ID webpage. If you have not landed on the remix IDE page, then there is no need to worry. Simply move your mouse cursor until you reach your Internet browsers web or this line. And then left-click on your browsers web address line. The web others line will be highlighted in blue. And then you just need to press your keyboards backspace button. Then type remix that if helium.org. And finally press the Enter button to inform your web browser that you wanted to go to that web address. Once you do that, you will reach the remix IDE webpage. Just as a side note, due to the nature of the Internet and due to the fact that remix keeps evolving, the interface that you see might change from time to time. But I don't feel it will change drastically in such a way that you will not be able to follow my lessons. Saying this, always feel free to contact me if you get stuck. There are many icons and some text on this page. And this page might look confusing or maybe even daunting if you have never interacted with it before. So let's just focus on our corn goal. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 3. Create A SOL File: Hello and welcome to the lesson. In this lesson, we are going to create our very first Solidity file. So we should now all be on the remix that if feeling that all webpage now on the upper left side of the screen, right under the default underscore woke space drop-down list, we will want to click on the tiny file icon. Notice that whenever we added our mouse over one of the icons at the left side of the screen. We see a small notification which gives us the name of the icon. In this case, the name of the icon is create a new file. Once we click on the Create New File icon, a new file will be created below all the folders and the ReadMe file. We can now name this new file. Let's simply type department store and then press the Enter button to apply the new name. Now, notice that remix as added, the solid extension at the end of the world department store. The reason for that is that every Solidity file needs to have a duct soul extension in its end. Sol stands for solidity. Now, if for any reason we want to delete the file, rename it, we can simply right-click it and then choose the option that we want, in this case, delete. So after we created and named our file, we will see a blank space at the right side of the screen. And this blank space will be the area in which we will type our code. Okay, so that's it for this lesson, and we'll see you in the next lesson. Goodbye. 4. Our First Line Of Code In Solidity: In this lesson, we will be writing our first line of code in solidity. The first line of code in any solidity program will usually be the solidity version. So let's now type the first line of code together. And right after we will do that, I will explain what we typed. So let's click the first line inside the code area space at the right side of the screen. And then let's type the keyword pragma. Then we will want to press the space button on our keyboard. Then type the keyword solidity. And then we will press the space button again. Next we would want to hold down the Shift buttons on our keyboard. And while holding the Shift button plus the number of six keyboard button at the top of the keyboard to create a carat symbol. Then we will want to type the solidity compiler version that we will be working with. And to find the solidity compiler version, we would want to tap the solidity compiler icon at the left side of the screen. Then click the drop-down list and the compiler caption. And then in this specific example, we will want to select version 0.8, 0.0. Now because solidity keeps updating the version numbers that you will see on your screen might be different from the solidity versions on my screen. But again, for our example, just locate the 0.8, 0.0 compiler version in the drop-down list. We will both be working with the same compiler version. Lastly, we will want to type a semicolon. At the end of the line. We end all statements in solidity with a semicolon. So the first line of code of any Solidity file is called a pragma statement. And we use it to simply tell solidity the compiler version that we are using in our current Solidity file, our code will not work with earlier or later compiler versions. So in our example, our code will only compile compiler versions that are below 0.9 and above 0.8 gray. We have achieved our goal for this lesson, which was to create our first line of code in Solidity. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 5. Defining A Contract: Hi everyone. In this lesson I will show you how to define a conflict in solidity. Just as a refresher in the previous lesson, we type our first line of code in solidity. In our first line of code, we define our solidity version. Okay? So our mouse COSO should now be at the end of the first line of code. And we will now want to place the Enter button on our keyboard to times in order to go down two lines. Now we can define our conflict. So let's start. We'll start by inserting the word conflict, which is a keyword that stands for the smart contract. Next, we will want to place the space button on our keyboard and then name our conflict. So e.g. let's name our contract department store without adding a space between the votes department store. Then we want to place the space button again and then type a left curly bracket. Now, two things to notice before we continue. First off, let me show you how to create a left curly bracket. The left curly bracket button can be found on our keyboard, right next to the P button, P as in the word problem. So we would want to press the left bracket keyword button while holding one of our keyboard shift buttons. After we press the left bracket and one of the shift buttons together, we will get the left curly bracket. We will also notice that once we create a left curly bracket, the right curly bracket will automatically be created for us by Olympics, which is a very good feature in my opinion. Just as a side note, if we ever want to create a right curly bracket, we will need to press the right bracket keyboard button together with one of the shift buttons. The right bracket button can be found right next to the Left Bracket. Okay, Let's continue. After we created the left curly bracket, we will want to press the Enter button on our keyboard. So our boss causal, will enter into the contents of the smart contract. The space between the two buckets will be the space in which our contract will be written in. The curly brackets are basically boundaries of our conflict. In other words, the contract will start after the left curly bracket and will end before the right curly bracket. So currently our contract is empty, but we still have a valid smart contract that can be compiled and deployed to save and compile your code. If you are using the Windows operating system like me, you just need to press the Control button and the S button together on your keyboard. If you're using a Mac, then you can save and compile your code by pressing the Command and S buttons together on your keyboard. Let's compile our code now. If you walk your code correctly, then you will not get any of those. Great. So we have achieved the goal for this lesson. We have defined our very first solidity contract. It's not contract that doesn't do anything, but is still a valid smart contract which can be deployed in its current state to the blockchain. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 6. Errors, Warnings, and Comments: Hi everyone. In the previous lesson, we defined our first contract in solidity. When I compile my code in the previous lesson, the code was compiled successfully, yet, this might not have been the case at your end. If you got a red error message, e.g. then know that red error message is a compiler error. And it basically means that your code will not be deployed until you fix the l. So I will now make some changes to the code to make it produce an eval. Then we'll explain what the role is. And finally, I will fix the L. Okay, so e.g. I. Will click the drop-down list under the compiler caption at the left side of the screen. And choose a compiler version which will be different from the compiler version that I typed in my first line of code, the line of code in which I defined the solidity version for my program. Then again, it will compile my program by pressing control and S buttons together on my keyboard. Okay, So I now got a one, a whole message notification at the left side of the page. And I also got an L notification next to my first line of code. We will see a red notification, Dale. And if we add our mouse cursor over it, we will see the message text. So in this case, the beginning of the error message says source file requires a different compiler version. So even if this is the first time that we have ever seen this code, we can already understand what the problem is. Just form the overall message under the compiler caption, I need to change the compiler version in the drop-down list to match the compiler version I specified in the first line of code. So I'll click the drop-down list and then change the compiled version so it will match the solidity version that I typed in the first line of code. Then I will press the Control and S buttons together on my keyboard to compile my code again. Great, so the red error message disappeared. I now have a yellow error message. So the message is a compiler L That must be fixed before we can deploy our code. And the yellow SH is a compiler warning. A compiler warning, as the name suggests, is a warning and not enable. Which means that it is simply a tip that we don't have to fix and it will not prevent us from compiling our code. When we see a yellow warning message, we just need to know that the compiler is advising us to go over our code and see if everything was written properly. In my case, the compiler warning is SP dx license identifier not provided in source file. This warning message might look scary, but it just means that we need to add a short line of texts before our code. Let's type it now. First, we start by typing forward slash twice. Whenever we type two forward slashes at the start of a line in solidity, we are basically creating a single line comment. And once we add the two forward slashes, they will turn to go in. Now everything that we typed after the two forward slashes will not be compiled because by having the two forward slashes in the beginning of a line, we are telling the compiler that the line of code that follows the two forward slashes is just a single line comment and not an actual code that the compiler needs to compile. Everything that we will type below the comment line will not be Glean, which means that it will not be regarded as a comment by the compiler. Yet if we do want a line to be a comment, we will again need to add two forward slashes at the beginning of each specific line that we want to turn into a comment. Now, if we want to have a one-line comment, then two forward slashes will do the trick. Yet, if we want to have a comment that extends to several lines of code, we can also use multi-line comment. Meaning at the start of our comments, we can replace the second forward slash with an S trick and then put an asterisk and a forward slash at the end of the statement. And this will turn all the lines in-between 21 big comment. To create an aesthetic. Just place one of the shift buttons on your keyboard and the number eight keyboard button together. Now in our example, we just want to have the first line in our application comment. So I will just undo the changes that I made. Let's now type a line of code and shortly after I will explain what we typed. So after the two forward slashes, we will want to type S, P as in the word pogrom, D as in the word document, and x, then an hyphen, basically a minus. You will find the minus keyboard key right next to the zero keyboard key. Then let's type the word license. Then let's add a hyphen again. Then let's type the word identifiable. Then let's add a colon. The colon is created by pressing one of the shift buttons on our keyboard, with the keyboard button right next to the L button, we need to pass those two buttons together. Then we will want to press the space button and then type MIT Ts in teaching in capital letters. Now, I will explain what this line means very briefly. In short, the compiler advises us add this SP dx line to our code just to indicate that our smart contract is a license. There are just different legal issues with regard to smart contract copyrights. And by adding this specific SPD x line to our code, we just indicate that are smart contract is licensed. By having a code that comes with a license, we established more trust in the smart contract. The license itself just says that our code can be used by anyone wants to use it. Okay, let's continue. Now. Let's compile the code again by pressing Control and S buttons on our keyboard together so we can see if the code compiles properly. Great, So my yellow error message is gone, and I now have a green checkmark. And this means that the compiler didn't find any other arrows. Oh, warnings if your code doesn't have any arrows than U2. Now, if a smart contracts, smart contract, which doesn't do anything, but it is still a smart contract that can be deployed to the blockchain. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 7. Uint256: In the previous lessons, we have created our very first smart contract. And in this lesson we are going to start filling it up. So again, we have our contract which we named department store. And the first line of code that we want to have in our department store contract is a line of code in which we declare a variable that stores an integer, meaning a whole number. Let's first type the first line of code. Then we will analyze it together. Okay, so let's type uint8, then the number 256. Next, let's press the space button. Then let's type the world's item pies, e.g. without space, and then end our first line of code with a semicolon. Now that we have written the entire line of code, Let's analyze this line of code together so it will be fully understood. We started the line of code by typing you end. You end means a non negative unsigned integer type. Or in other words, a whole number which is not positive or negative. Then we type the number 256. 256 stands for 256 bits. By typing the number 256, we tell solidity that we want to store a number inside this integral, which is up to 256. Then we pressed the space button on our keyboard, and then we type our variable. In this case, we named the variable item price. Of course, we could have picked whatever name we wanted. And then we ended the line with a semicolon. So to summarize, in our first line of code, we basically asked solidity to create for us a variable called Item pies that can store all numbers which are up to 256. So solidity will create the item price variable for us as we asked. But it will also do something else for us by default that we didn't specifically ask for it. We'll initialize our new item price variable with the numbers evil. We could have just added a space equals and an umbrella before the semicolon to store our own number like seven or maybe zero. But because I didn't, solidity will store the number zero inside my new variable by default. So if e.g. we have been hired to create a program for a department store that is just opened its doors. And we are not yet given the prices for the items in this store, then by default, we can set the zero value for all of the items. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 8. Function Declarations: Hello and welcome to the lesson. In this lesson, we will create our very first function in Solidity. A function or a method is a self-contained block of reusable code that will perform a certain task for us. By reusable code, I mean a code that we only have one time, but we can use over and over again to define a function. We will start by typing the keyword function. Then we will type the word set, e.g. settled be the name of our function. Then we will put parenthesis. We add fantasies because we want to pass a variable to our function. Inside the parentheses, we need to specify two solidity, the kinds of variables that our function accepts. So inside the parentheses, we can insert type uint8 256, meaning unsigned integer 256. And then we push the space button and give it a name, e.g. underscore, I can place. Then after the parentheses, we will press the space button again. Then type the word public more on that in a future lesson. And then add a left curly bracket, which will automatically write curly bracket to our code. Let's go down the line. Now, let's type item price equals the variable that we are passing. In our case, it is underscore icon pies. And we will end our line with a semicolon. Great, So we have created our very first function in Solidity. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 9. Deploying A Contract: Hi everyone. In this lesson, we will deploy our very first contract in solidity. So we should all now be inside Linux. And together let's now click on the deploy and run transactions icon and the left side of the screen. And once we do that, heightened next to the deploy and run transactions icon, we will see a deploy and run transactions caption at the top of the screen. And under the deploy and run transactions caption, we will see few fields that we will now talk about. So if we look at it under the deploy and run transactions caption, we would see a drop-down box under the environment caption. And inside this drop-down box, we can see that by default, we will be using a JavaScript VM environment. Now, in a few words, let's discuss what a JavaScript VM environment means. Javascript is a programming language, and V M stands for Virtual Machine. So JavaScript VM environment just means that all the changes that we will make with the mix will not affect a real blockchain, but rather a fake environment, which will just emulate the functionality of blockchain. In other words, when we walk with the Linux, we will be using a simulated blockchain environment that will only exist in our browser. And it will be completely erased once we refresh or close our Internet browsers webpage. One of the major advantages of using a fake environment overlaid one is the transactions will be processed extremely fast because we will not need to wait for minus to process the transactions for us. If you would like to learn more about minus, then we have a separate lesson in this course about that. Speaking of fake environments. If we look at the drop-down list under the account caption, which is like under the environment caption, we can see that by default, the mix is deposited one under the fill into our fake account. Let's clarify what this means. You see, whenever we interact with the blockchain, we need to pay a certain gas. A gas fee is like a transaction fee on our credit card. And thus to simulate this deduction in a fake environment, we get 100 that we can use to spend on fake transactions. More on that in a future lesson. But just in a few awards. We will see that later on when we deploy our contact, it would cost us a certain amount of gas phase. And thus a certain amount of helium will be deducted from our account. You will notice that after deployment, we will have less than 100 it fill in our account, but again, more on that later. And this is also why we can see our guests limit under the gas limit, again, to simulate a real blockchain environment. So to sum it all up, linux has created a fake virtual machine for us that aims to simulate a real interaction with allele blockchain. And thus the mix has given us some of the same fields that we would have when we process a real blockchain transaction. Linux has given us a fake account with 100, fake a fill and a fake guess limit. If you want to learn what guests means, then we have a separate lesson in this course in which we talk about guests. Let's now click the Deploy button, which we would find the button of all those fields and see what happens. So a few things have happened. If we look at the terminal area, which is located at the button side of the screen, we can see a notification from Linux, which just acknowledges that our code was deployed. Now, if we scroll down and then click on the transactions recorded option, which is an option that we will find under the Deploy button that we previously clicked on the button left side of the screen, we can see our recorded transactions. We can also scroll down even more and click on our contract, which is under the diploid contracts caption and see the contact that we have just deployed. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 10. Visibility: Ideal. Okay, so we have learned out-of-stock a number using a function. We named our function set. But the question that arises is, how can we actually see the number that we have stalled? In order to see the number that we have stored, we will have to define the visibility of the variable in which our number is stored. Now, there are four different types of visibility in Solidity. External, public, internal and david, the difference between the full different functions lies in all can call them. In our specific contexts, we will only use the public function. A public function can be called by anybody. It can be called by both functions and variables. So we would want to type the word public before our variable item price. So we can both see the value that is stored inside the item price variable and also return the value that is inside the item price variable. Now, let's place the control and S buttons on our keyboard together to compile our code. Next, we will delete our previous contract by clicking the X button at the end of the line, which is under the contract caption at the left side of the screen. And then we will click the Deploy button. Then if we scroll down, we will see our new item button right until the orange set button. And if we will now click the item Pies blue button. Show us the non bill inside the item price variable, which we initialized to zero in the previous lesson. Now it is important to know that in solidity, the visibility is always set as internal. By default. This is why we didn't see any value inside our item price variable. And for that reason we had to add the public function in order to see the value inside our item pies variable. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 11. Updating A Variable: Hi everyone. In this lesson, I just want to show you how our contract country walks. Okay, so when we click the blue item Paste button, which is located at the bottom left side of the screen. We can see the value that is inside our item price variable. The value is under the blue button. Now, because we have not updated our item price variable with any numbers since we initially created it. The icon pass variable will keep its initial value just as a refresher. Whenever we declare a variable, it gets the zero value by default. Now, besides the icon peice variable, we have also created a function that we named set. And the set function gives us the option to update the item price variable num will form the initialized zero value to any other number that we want. Okay, So inside the set function we have fantasies, and inside those parentheses, we have typed the votes you in 256 underscore item price. This means that we can pass a value of type uint8 256 to our function, which will change the icon price variable with any value that we pass to it, food, the underscore item price variable. So we can type any number that we want inside the line that is right next to the orange said button. Click the Set button. And then if we click the blue item pies button under the orange set button, we will see the new value that we just stored item and we will bloom item Paste button. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 12. Scope: Hi there. In this lesson, we will talk about the variable scope. Now, if you've been wondering how we will able to access the item price variable inside our set function. Then the reason for that is that we have defined our item price variable is public. By doing that, we have given our item price variable a global scope. We've also defined our set function is public because we want it to function to be used both internally and externally. If we change our set function to play it, then our set function will only be visible for our department store, but not for any derived contexts. If we create e.g. a new variable like you to other than 56 item pies equals seven in a new line inside our set function. We wouldn't be able to use the new item pies two variable outside the set function. You see functions are like self-contained volts, meaning they only know about what happens inside of them. Or in other words, they only know about the variables that are inside the same scope. So we will not be able to use the icon pies too valuable outside the set function. Because the item pies two variable can only be used inside the set function if we create a new public function, e.g. under our set function, let's call the new function set to. The new function set two will not know that our new item pies two variable, which is inside the set function, even exists. If our new item pies two variable was inside the same scope of our new set to function. Then set to function would know of its existence, thus would have been able to use it. Now, how can we tell that the item price variable as a global scope? We can tell that our item price variable is global because the only bracket that's above it is the one of our department store conflict. Now, the reason that we can tell that our new variable item pies two is inside the set scope, is that our set function as two brackets above it, the left curly bracket of the set function and the left curly bracket of the department store conflict. Now, the set to function is not inside the set function or inside the set scope. It can't affect the item pies two variable. Now let's undo the changes that we've just made by removing the new set to function, changing our set function from private back to public. And by removing the item price to variable line completely. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 13. Structs: Hi everyone. In the previous lessons, we have created our set function, which allows the user authorial program to store a price of an item. Now, that's great if we are just creating a program for a department store that only sells one item. Yet, if we want the program that can end up with a list of prices, we need to code our program differently. In other reason that we would want to write a different code is if we want to associate a specific item pies to a specific item. So the different ways to code our program to achieve this result. And in this lesson we will explore one of those ways. We will be using a custom data type called struct, which starts, we can define new types in solidity by grouping several variables together. And as a result, we will be creating new objects. We would want to create a slug of type items, which will allow the user to store an item name which will be associated with an item price. We can have different types inside our struct. Okay, so let's type struct plus the space button and then type items. Then a left curly bracket. And as always, the right curly bracket will be added automatically for us, interspace between the curly brackets, we will type string, space, item, name, and a semicolon. Then we will go down a line and type uint8 256 space. Then type item pies and a semicolon. Okay, So let's discuss what we have done so far. We have created a new type of type items that as an item name, item price inside of it. Now under the left curly bracket of our struct, we can type items. Public Item equals items. And then let's create curly brackets inside rounded brackets. Inside the curly brackets we will type item name, colon. Now let's come up with the product name, e.g. I. Will type shared inside quotes. Then let's add a comma and type. I can price colon and the number six, e.g. and then let's end the line with a semicolon. Let's now press the Control and S buttons together to compile our code. Then let's delete our previous contract and then deploy our code. So we can now see our new blue button item, which is our item stocked. We also see that our item name variable was indexed is zero and that our item price variable was indexed as one. So it is important to note that solidity always uses numeric indexing store variables, e.g. the very first variable, you wind 256 item pies in our contracts, department store is at index zero. Now if we go down a line and type item pies two e.g. and then a semicolon, then the item pi X2 variable would be at index one. And if we were to go one more line again, and type, I can pies free. And then a semicolon I can pies free would be at index two. So to sum this part up, if we were to write our contract like that, I will either pies variable would be at index zero. Our item pies two variable would be at index one. And our item pies free would be at index two. And the same numeric indexing happens within the struct as well. The opening first line of code inside the struct gets the zero index and the second line of code gets indexed one. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 14. Arrays: Hello and welcome to the lesson. Before we start this lesson, let's first delete the line of code that starts with items, public item. Then delete our previous conflict. Okay, let's begin. So far we have created one item. Now, you may be wondering how we can store a list of objects. We can store a list of objects or types by creating an array to create a item. So e.g. we will type items and then without pressing the space button, we will add square brackets. To create square brackets, we would want to place our keyboard left square bracket button, which we will find right next to the P button, P as in Paul Glenn. So the Eigen survey is our type. Once we create the left square bracket, the right square bracket will be created by remixed automatically for us. Then we will want to type the word public, and then the name of our array items. This is the name that we will live to our array. And we will end the line with a semicolon. And now if we deploy our contact, we will see the item survey at the bottom left side of the screen. Notice that if we click the items blue button, nothing will happen. The reason for that is that we have just created our eye and thus we currently don't have anything inside it. Okay, so that's it for this lesson, and I will see you in the next lesson. Bye. 15. Adding To An Array: Hello and welcome to the lesson. In our previous lessons, we have created an empty array. And then we talked about two different types of surveys, a dynamic array and a fixed size array. In this lesson, we are going to add an item into our dynamic array. Let's now create a function that adds an item into a dynamic array. Let's go down two lines under the closing curly parenthesis of our set function and type function Item. And then let's create parentheses. Inside the parentheses, Let's type string memory. We will talk about the memory keyword later on in the course. Underscore item name, coma. You wind 256 plus the space button, and then type underscore item price. And then type the word public to make our function public. Then inside our function, we will now write the code that will give us the option to insert a new item into our array. We will do it using a method called push. Let's type items dot push. Then let's create round parentheses. And inside our round parentheses, we will type items, meaning a new item. And then we will give the new item our variables. Now let's create new round parentheses, and inside them, Kelly parentheses. And inside our new curly parenthesis, Let's type item price, colon space, then add our variable underscore item price, coma, item name, colon, underscore item name. And then we will want to add a semicolon at the end of our line of code. So that's it for this lesson, and I will see you in the next lesson. Goodbye. 16. Types of Arrays (Dynamic, Fixed): Hi everyone. In the previous lesson, we started talking about arrays. And in this lesson we will continue our discussion about it. So our empty array is a dynamic array, meaning it's size is not fixed, it is dynamic, and thus it can change. It is called unclear of size zero. Yet if we add an element to it, it will be of size one. There is another type of folly, and it is the fixed size array. And as the name suggests, it is an array that can stall a fixed size collection of elements. In the array code line, we can add the number one inside the square brackets. And by doing that, we have limited the size of the array to one. Meaning after this change, we are limited to only adding one item to our own way. So in our example, we will choose to walk with a dynamic array over a fixed size array, because we want to add a random number of items into our array. Okay, so that's it for this lesson, and we'll see you in the next lesson. Goodbye. 17. Memory: Hi everyone. In this lesson we will talk about how we store information in Solidity. Solidity, there are two ways to store information. We can store information in memory or install which memory is a temporary place to store data, but not any kind of data. Memory stores short-lived the data. If you're familiar with the thumb random access memory in computer hardware, the memory in solidity is similar to one. So when data is stored in memory, it will only be stored during execution of functions 0 of a contact call. When execution finishes, the memory is removed, so it will be available for the next execution. Now, if the data is stored in storage, it is stored forever. It means that the data will be stored after the function executes. If you're familiar with database data, then storage in Solidity works in the same way. Stringing solidity is basically an arbitrary length byte array that we can. And text tool. We will want to decide whether we want to store the data inside our string item name, whether we want to store it in memory or install, which in this case we can store our string in memory because we only need our itemName during execution. And whenever we will add new items into our array, we will store them in storage. Now, let's deploy our conflict. Okay, at the bottom left side of the screen, we have the Add Item, orange button. It is orange and not blue because it operates a function that can make changes to the blockchain. Now in the line which is right next to the orange add item button, we can type the word shelf inside quotes, then add a comma, and then the number six, e.g. if we will now click on the Items button, nothing will happen. Let's add another item to our department store, e.g. we can add a chill that costs $72. So let's type chill 72. Then click the Add Item button. And now if we click the blue items button, we will see the chill at index zero and the price 72 at index one. Great, so we can now just continue to add as many items as we want to our department store. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 18. Mapping: Idle. In the previous lesson, I showed you how to add items to our list. And in this lesson I will show you how to find a specific item inside of our list. We do it by using a data structure of type mapping. Mapping is a dictionary like data structure or a hash table which stores data. Again, mapping is not the same as the dictionary or hash table. Yet it is similar. Mapping takes a key which holds one value and then simply gives back the value that it is mapped to. So let's say that the patents to example, we want to use an item name to find its bias. So let's create a new line of code under our item survey line. Then type mapping. Let's add round parentheses. Then inside the parentheses, we will want to type the word string. Then place the space button on our keyboard. Then we would want to type equals. And then a right angled bracket. We will know that we have added the equals symbol and the right angled bracket symbol correctly. If together they form an arrow like simple, that points right? Graphically speaking, of course. Next we would want to pass the space button on our keyboard and type uint8 256. With our arrow symbol, we show in our code that our string is mapped to our uint8 256. Meaning we can use the item name shield e.g. to find its item price, which is $6. In this case. After the closing fantasies, we will replace the space button and then type the visibility that we want. And in this example we want the visibility to be public. So let's now type the word public. Next, we would want to press the space button on our keyboard. Then let's call it name two pies. And then we will end our line of code by typing a semicolon. And if we deploy our code, we will see the name to Pies blue button. And the button would be low because we have not portland it to make a change to the blockchain. Notice that if at this point we will insert the name shield inside quotes in the line next to the name to pause button. And then click the name to pause button. Nothing will happen because we haven't added the mapping in yet. Now we can go inside our addItem function. Then type name to pies, create squared fantasies. And inside the square parentheses type underscore name, which is going to be our key. So the key e.g. can be shared. Then we can place the space button type equals then puts the space button again, then type underscore item price, and then end the line by adding a semicolon. Let's tell delete our previous contract. Then compile our code again. We do it by pressing control and S buttons together on our keyboard. And then let's deploy our code. So we will now scroll down type shield inside quotes in the line next to the name to pies button. Then if we pass the name to Paste button, we will not get any output back. Yet. If we type quotes, put the word shells inside of them. Then add a comma. Then the number inside the line which is next to the orange arrow icon button. And then press the Add icon button. We will be able to get an output back if we click on the name to pies button. Okay, so that's it for this lesson. And I will see you in the next lesson. Goodbye. 19. Deploying To A Live Network: Hi everyone. First of all, congratulations for making it to this part of the course. We're finished creating our department store contract. A contract that lets us add items and the biases. Now before we will actually deploy our department store conflict to a real live if feeling blockchain so other people can actually interact with it. We will first want to test that our code is working properly on a test, a test environment. Basically, the test net that we are going to use is the rink be destiny. Now because I think B is a testlet, the currency that we will be using on this test net will not the wolf anything. So our Kong goal is to get test it filename in a test net wallet. Okay, Let's start inside our Internet browser. Let's delete our web address line where it says www type, link, token contexts, placental. And then click on the link token contexts channeling documentation, search result. Once we do that, we will end on this webpage, which is on dogs that chain that link forward slash docs, forward slash link, iPhone token, hyphen contacts. Then we would want to scroll down until we reach the ring, the caption. And all of these caption, we will want to click on the link that is right next to the testlet if it's available. Form. Once we do that, we will reach the webpage facets that chain, that link forward slash link B. Now, I could have just told you to go to facets that chain that link for sludge shrink be page directly and not food chain IC website page. And of course you can do that. Pages on the Internet, go offline or stop working all the time. So it will be better that you will go to this page for the chain link website, which is an extremely popular website, and dusk will always update with the most up-to-date link be links. Now inside the limits on the deploy and run transactions page. All we need to do for now is to scroll up to the top of the page, then click the drop-down list under the environment caption, it is located at the upper left side of the screen and then change from Linux VM London to inject it, provide a MetaMask. Okay, so that's it for this lesson, and I will see you in the next lesson. Goodbye. 20. What Next After This Course: Hi there. I hope you've enjoyed the course. I want to congratulate you for finishing it and just know that I'm here for you for any questions or comments that you may have. So this is goodbye for me. And if you're wondering what you can do next, then my recommendation is to learn about LFTs and the metal grills. Nft is metal verse and solidity really go hand-in-hand. With solidity, we can create smart contracts which are heavily used in virtual worlds. Aka, the metal fails to manage the trading of unique digital assets. Aka. So, if you like the way I teach and you understand nothing or very little about. And if t is 0 and the metatarsals, then I have an NFT course and a methods course, which will help you tremendously with learning the basics. So that's it. By enjoy the rest of your day.