This is a short introduction to Solidity, the programming language used to create smart contracts on the Ethereum VM.
π§΅ππ»
1οΈβ£ What Is Solidity?
Solidity is an object-oriented, high-level programming language designed to implement smart contracts on the Ethereum Virtual Machine.
It is statically typed, supports inheritance, libraries, and complex user-defined types.
Solidity is a domain-specific language. Besides Python or JavaScript, which are general-purpose languages, Solidity is only meant to be used for smart contract development.
The language was initially proposed in 2014 and later released as the primary language of smart contract development on Ethereum by the Ethereum foundation.
It is inspired by languages like C/C++, JavaScript, as well as Python.
2οΈβ£ What Is Solidity Used For?
As already stated, Solidity is used to create smart contracts. You can imagine the latter to be like specific objects, in this case, contracts.
A smart contract is a program that runs on a blockchain. Within this contract, any interaction between contracts of the same kind, contracts of another kind, and its users are programmed into.
Stable coins, as long as they are not the native currency of their own blockchain, are implemented as smart contracts, and so are NFTs or other tokens.
You could also implement a full election process within a smart contract, for example, or a vending machine.
3οΈβ£ About Its Syntax
Solidity is a curly brace language inspired by C, C++, JavaScript, and some Python. However, it still looks pretty different from those languages and has a unique touch to it.
You can see an example of a basic Solidity contract below. ππ»
Perhaps you have noticed that modifiers on functions are actually placed behind the parameter list of a function. This is one example of Solidity's different syntax.
Those modifiers have some pretty special meaning and are very important.
As writing to blockchains is transaction-based, you need to mark functions that alter the state of a contract and thus require a transaction accordingly. Functions that don't alter the state of a contract and thus don't require a transaction have to be marked, as well.
Other than the aforementioned, Solidity follows the C-standard of declaring variables with a leading type and the identifier after. It has loops, arrays, and anything else other languages also have.
You can see an example of a simple for-loop, below. ππ»
4οΈβ£ How To Get Started?
The easiest answer is sometimes the best: Start hacking!
Remix is an online Solidity IDE that allows you to get started without the need to install anything.
If you want to get deeper into Solidity and learn the language, I already compiled a list of resources that I found pretty valuable. Perhaps they are to you, as well!
You did some Solidity tutorials, and now you're stuck because you don't know what else to build?
Let me help you out by giving you three simple ideas for dApps, perfect for beginners!
π§΅ππ»
1οΈβ£ A Voting dApp
Build a dApp that lets users create elections. Any user can start an election and choose a registration period, a voting period, and an ending time.
During the registration period, users can sign up as a candidate.
Once the registration period closes, no one should be able to register anymore. Instead, the voting period starts where anyone can vote for their favorite candidate.
Your frontend should show open elections, the current period, the time remaining, and the candidates.
Do you know what many dApp developers struggle with?
Which data to put on-chain. More data on the chain can drive the cost up. Too much data might render your app unusable. Storing fewer data might not be an option.
Here are some ideas for you to fix this. π§΅ππ»
1οΈβ£ Use A Dedicated Database
This approach will make your dApp into an app. If you bring in central data storage, you can circumvent the limits of some blockchains but it doesn't keep the promise of being decentralized.
You can store anything that you can't store on-chain in your database and associate it with a user. Whenever you need that type of data, you fetch it from your database.
Want to get into smart contract development and learn Solidity? Want to get into an area of software development where salaries currently rise through the roof?
Here are 5 awesome resources that help you to get into the language of the Ethereum VM!
π§΅ππ»
1οΈβ£ CryptoZombies
CryptoZombies is an awesome approach to teaching Solidity. You learn Solidity by basically playing a game, and it's free!
Learning through CryptoZombies definitely isn't as dry as the zombies are themselves!
EthereumDev gives you a full free course that covers everything you need to know in the beginning. It also covers interacting with the blockchain through JavaScript, which definitely helps you to build your own dApps!
Code Reviews are an awesome way to use the experience and knowledge of a team to create good software. Not all review processes are enjoyable, though.
Here are 6 tips to make your review process better and more enjoyable for everyone!
π§΅π½
1οΈβ£ Make Expectations Clear
A good review process should both be standardized and individual. The terms of the process should be written down and transparent for everyone on the team. Each team member should know what is expected of them and all team members should agree ...
... on the terms. Changing the terms should always be a democratic process within the team. If the team disagrees on changes or terms, it should discuss the issues until there is consent.
On the other hand, the process should be flexible enough to allow for individuality.