Solidity Basics

Filip, amazing explanation of mappings!

Yes this is very interesting term “mapping” that is utilized to search using the “public” or “private” key to find a specific “value”.

1 Like

Hey, I was wondering about the gas price. Since theres a lot of defi and future growth in Ethereum potentially, if the price of ETH goes up a lot, wouldnt gas prices rise a lot? Do you think this could be a problem with respect to costs of smart contracts and more complex contracts with a lot of parts?

1 Like

I had .sol with a capital S it’s fixed now

1 Like

the gas prices fluctuate already, so yes that is definitely impacting the DeFi systems.

@filip Really like this course and your teaching style. You also tought me indirectly how to open my own account on GitHub, which will be very useful as well. Love the small steps we’re taking. Makes it easier to digest.

1 Like

@filip You say in the intro to the course to use version 0.5.12 of the compiler. It is now only 7 months since your recording and they offer 0.6.6 as the latest version. That is 12 new releases in that short amount of time, which obviously shows the dynamics in this new field. To your knowledge are there any major changes, that maybe you could touch on in one or two additional videos.

In the video about mappings you mention in the end that there is a bug in the code and that there would be an assignment to work on that bug. I couldn’t find that assignment. The next step comes up as a multiple choice quiz. What bug were you referring to?

@ivga80 @David_Wyness - I am using Brave and I just right clicked on the tab with the name of my .sol file and it gave me a ‘save as’.
image

3 Likes

Hey @filip or anyone else who might be able to help. I’m literally only at Hello World and I’m already having issues. I don’t see the same options on the left on Remix as I see in the course. I tried an older version but that looked totally different. Any help?

AAAAND never mind. Got it. Had to click Solidity. Thanks.

1 Like

It did? Finally, did they include that in their last update?
That’s fantastic. Thanks for letting us know, bro.:+1:t2::wave:

Ivo

I think he maybe will a newer compiler in a new upcoming course? I don´t really think It’s important what compiler you are running as long as you use 0.5.12 when you go through this basic course.
:wink:

@filip
One question regard the createPerson example. When I create a person like you (Bob1 etc…) and then I create another person with this unique address (e. g Bob 3…). Then Bob1 will be overwritten and is not there anymore, right?

Hi @KryptoDr
Yes because you will save your new user at the same index in your mapping, as the index is the msg.sender address

1 Like

Hey guys and girls.

I know its probaly is a stupid guestion, but when I try to run my first Helloworld code in remix, it complains about I dont have enough gas. I did choose Javascript VM, so it should be free right?

pragma solidity 0.5.12;

contract HelloWorld{
    string public message = "Hello World";
    // this is a get funtion 
    function getMessage() public view returns(string memory){
        return message;
    }
}

Screenshot 2020-05-08 at 00.39.06

Screenshot 2020-05-08 at 00.38.48

Ok i should simply close the remix and open it again, and my VM now had 100 ether to play with.

1 Like

NM I was leaving out “public” between “Person[]” and “people”.

On the structs vid Remix isn’t giving me the second function, people, so I am unable to see the people I am creating.

How can I write this in?
I know you said Solidity creates that function automatically.
Not sure why Remix isn’t giving it to me.


I can’t tell you how many struct vids and articles I’ve been through trying to figure out what structs are and how to use them.

THANK-YOU!

I originally joined Ivan on Tech Academy for a month last year when I was installing Truffle. One of your YouTube vids was SO helpful that I went searching for a way to send you $50, because your free video had saved me easily $50 worth of my time.

I found the Academy and that you were part of it, so I went ahead and paid a month.

Now I’m back.

The offerings have improved, the support seems to have improved, and this new Ethereum coding course is amazing.

Now I am excited not frustrated and I really am gulping this down
like Mz PacMan with hard core coding munchies.

THANK YOU.

THANK YOU IVAN as well.


I went ahead and put it all in one post.

Wow.

I couldn’t tell you how many tutorials I’ve done on coding on Ethereum.
Filip, your explanation and demo of arrays…

NOW I understand so many bug problems in contracts I was trying to work with.
Wow.

3 Likes

Hi
I have coded the uint arrays, “get” and “set” functions. All compiles fine but i am getting an error message saying i do not have enough GAS. Can someone help out with what’s going on here please?

Thanks

Ok. I also closed down remix and opened up again and all was fine. Strange but not complaining.

1 Like

Hello

Has anybody else had this issue when trying to type in the array numbers after compiling:

pragma solidity 0.5.12;

contract HelloWorld{
string public message = “HelloWorld”;

uint [] public numbers = [0, 20, 45];

function getMessage() public view returns(string memory){
    return message;
}

function setMessage(string memory  newMessage)public{
    message = newMessage;
}

function getNumber(uint index) public view returns(uint){
    return numbers[index];
}

function setNumber(uint newNumber, uint index)public{
    numbers[index] = newNumber;
}

}
i get the error message…transact to HelloWorld.setNumber errored: Error encoding arguments: Error: invalid number value (arg="", coderType=“uint256”, value=“10.0”, version=4.0.45)

I can not see any errors and in any case the compiler indicates the green tick so i don not understand. I have also changed the pragma versions around and still nothing. I’m getting a bit annoyed with this remix editor, i just want to code and i am spending more time trying to get the editor itself to function…

Any help is welcome

Thanks

Hi @NetworkP

Compilation is working but the execution is not. The problem doesn’t come from your editor, it just gives you information that what you are trying to do with your code is not possible.

For example if you are doing this:

setNumber
newNumber:
1
index:
2

Is it working ?

As we can see in your error

Error: invalid number value (arg="", coderType=“uint256”, value=“10.0”, version=4.0.45)

You are using an invalid number value 10.0, the type require is uint256 but you are using a number of type float.

https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/

The function setNumber allow you to modify existing numbers in your array.
So you can modify the index 0 1 and 2 with a value of type uint256 ( a positive whole number between 0 and 2^256 – 1).

For information floating number doesn’t exist in solidity so you ll never be able to use 1,5 or 10.6 ect…

1 Like

Hi Gabba, thanks for reaching out. I’m a little confused. I am mimicking exactly what filip does in the course and he does input 10.0 in the “set” number box which then returns 10 when you put “0” into the the “get” function icon box. I am only copying what he is doing. it works on the "Types & Arrays course but not for me…