DEV Community 👩‍💻👨‍💻

Chiranjeevi Tirunagari
Chiranjeevi Tirunagari

Posted on • Updated on

Ethereum smart contract development using Solidity

Today, I randomly came across a website called crypto zombies.
Image of Crypto Zombie website
crypto zombies
It's a nice platform to learn solidity and smart contract dev. I completed a starting course (pretty easy if we know programming basics) which consists 15 chapters. Here r few learnings of today:

  1. In every solidity program, we need to specify the version of language we are using in it using "pragma solidity ".

  2. A smart contract or simply contract is a building block of an Ethereum app. It contains the variables, functions etc. just like a class in java/c++.

  3. This contract is deployed on blockchain which acts as the backend of our decentralized app (dapp).

  4. A contract once deployed on blockchain can't be modified. So, we need to be very careful when writing them.

  5. There are many data types in solidity just like other programming languages.

  6. Integers are broadly 2 types, signed (int) and unsigned (uint), there are different sizes as well (8, 16, .., 256 bits).

  7. Strings are used to store from letters to sentences.

  8. Arrays are also 2 types. Static and Dynamic. When we know we make changes to an array in runtime, we should use dynamic arrays as they provide push and pop functionality.

  9. "function () returns (){}".
    Above is the syntax to write a function.

  10. Public functions can be called from external contracts also and Private functions are restricted from doing it.

  11. A pure type function can only access data which is passed to it as parameters.

  12. A view type function can access data which is not passed to but present in that contract.

  13. Struct is another data type which is user-defined which contains other variables in it.

  14. Parameters can be passed in 2 ways to a function. Pass by value and Pass by reference.

  15. To pass a parameter with reference, we need to give keyword "memory" before the name of argument.

  16. We can create events, so that when that event occurs, we can perform certain things in our frontend.

  17. "event (arguments)". We can catch these events using web3JS.

  18. To fire that event in a function, we use "emit ".

  19. Push method of dynamic array returns the size of array after pushing.

20.All this info in 20 mins read. Try it if u want to get started.

My twitter: twitter
My LinkedIn: linkedin
My showwcase: showwcase

Top comments (2)

Collapse
 
borsemayur2 profile image
Mayur Borse

Awesome find. Need clarification on few points:

  • point 15. The site says Don't forget to pass the first argument by value by using the memory keyword (Course 1, Chapter 7).

Thanks

Collapse
 
vchiranjeeviak profile image
Chiranjeevi Tirunagari

There is no such thing called references in solidity. But if we just pass the value of it, we can only use it, but can't change the actual value of the variable. So, we need to pass the address along with it's value, if we want to change it. This can be understood as pass by reference where we are actually passing value but along with it's address. I mentioned passing value with address as pass by reference as it is close to it which might be easy to understand.

Let's team up together 🤝

We're Hiring

We're hiring for a Senior Full Stack Engineer to join the DEV team. Want the deets? Head here to learn more about who we're looking for.