0%
Overview page background
HomeOverviewsLearn Solidity
The Best Way to Learn Solidity for Free (2024)

The Best Way to Learn Solidity for Free (2024)

Written by Frederik B

Brady Werkheiser headshot

Reviewed by Brady Werkheiser

Published on 2023-09-228 min read

Solidity is an object-oriented, high-level language for programming smart contracts. Learning Solidity will allow you to create smart contracts and decentralized applications (dApps). 

This article covers the most common methods to learn Solidity and introduces important Solidity concepts that students need to learn to become an Ethereum developer.

Why is learning Solidity important?

Solidity, the programming language for writing smart contracts on Ethereum and EVM compatible blockchains, is one of the most important skills for blockchain developers. As the ecosystem around Ethereum and other smart contract platform grows, so does the demand for Solidity developers.

The average yearly salary for a Senior Solidity Developer is $120,000 to $225,000 per year before adding token-based equity or employee stock options. According to cryptocurrencyjobs.co, the average base salary for Solidity developers in the US is $127,500, with a low base salary of $80,000 and a high base salary of $180,000. In contrast, remote developers make $111k - $200k per year. Compared to the average US-based developer salary of $103,000, it's clear that blockchain specialization is in high demand.

The following is a list of location-based salary structures of Solidity developers per year (US Dollars):

  • North America - $125K-$200K

  • Europe - $80K-$135K

  • Asia - $46K-$116K

  • Oceania - $85K-$120K

  • South America - $49K-$150K

  • Africa - $49K-$75K

  • Remote - $111K-$200K  

Not only can learning Solidity provide tremendous financial opportunities, but it also allows you to build amazing dApps that can have a huge impact on the world. In fact, Ethereum alone has close to 3,000 dApps serving a range of goals from financial inclusion to sustainable energy.

Ways to Learn Solidity

There are many ways to learn Solidity including online courses, bootcamps, tutorials, and reading documentation from popular Solidity development tools like Hardhat.

Learn Solidity with Online Courses

Online courses are a great way to learn Solidity if you want more structure and guidance than tutorials provide. There are many high-quality courses available, including Alchemy University's free Solidity Development Course.

While tutorials are self-paced, online courses often have set lessons and deadlines, providing time-bound motivation for learners to stay on track. In addition, Solidity courses often include quizzes and other assignments to test your knowledge as you progress.

Learn Solidity with an Ethereum Bootcamp

If you want to learn Solidity and other blockchain development skills in a structured, immersive environment, a Solidity bootcamp might be the right option for you. Blockchain bootcamps provide intensive, hands-on training to help you become a job-ready blockchain developer.

After Alchemy acquired ChainShot, Alchemy redesigned ChainShot's 7-week, $3,000 Ethereum Developer Bootcamp, and is offering it to the public for FREE under Alchemy University. To learn Solidity with expert teachers and alongside motivated peers, secure your place in line for Alchemy University's Ethereum bootcamp.

If developers are new to development in general, Alchemy University's 3-week JavaScript crash course is a great prerequisite before starting an Ethereum bootcamp.

Learn Solidity with Tutorials

If you're a self-starter and want to learn at your own pace, tutorials are a great way to learn Solidity. There are many high-quality Solidity tutorials available online, ranging from beginner to advanced levels.

The official Ethereum developer resources include 53 tutorials tagged "Solidity," covering everything from the basics of smart contracts to more advanced topics like gas optimization and secure signing.

Important Solidity Concepts to Learn

Once you've chosen your learning method, it's time to start learning how to code in Solidity. A number of core Solidity concepts are important to understand to write effective code.

Solidity ABI

The Application Binary Interface (ABI) is a set of rules that allows two different pieces of software to interact with each other. In the context of Solidity, the ABI allows smart contracts to interact with each other, as well as with external software like wallets.

The ABI allows you to write code that can interact with any contract, regardless of whether you have the source code or not. This is possible because the ABI includes all the information needed to encode and decode data that is passed between contracts.

Smart Contracts

A smart contract is a piece of code that runs on the Ethereum blockchain and performs certain actions when a set of conditions are met. Smart contracts can be used to create digital tokens, decentralized applications (dApps), and more.

A common smart contract use case is creating an ERC20 token, which can be done in just a few lines of code. More complex smart contracts include token swaps, yield farming, and synthetic assets. These contracts are compiled using a Solidity compiler, which outputs bytecode used to deploy the contract.

ERC20 Tokens

ERC20 tokens are a type of digital asset that runs on the Ethereum blockchain. They are often used to represent real-world assets, such as commodities or fiat currencies.

ERC20 tokens are the most common type of digital asset on Ethereum. Since ERC20 tokens are also one of the easiest types of contracts to write, learning how to creating them is an important skill to master.

Contract Interface

An interface is a way to specify what functions a contract must have. Interfaces allow you to create contracts that can be easily reused and extended. For example, you could create an interface for a token contract, and then any contract that implements that interface can be used as a token.

Inheritance

Inheritance is a way to reuse code in Solidity. Inheritance allows you to create "child" contracts that inherit all the code from a "parent" contract. This lets developers avoid duplicating code and makes smart contract maintenance much easier.

Inheritance is an important concept in object-oriented programming, and it's one of the things that makes Solidity so powerful. Learning how to to create standardized contracts that can be easily extended and modified is an important Solidity lesson to master.

Functions

As with any programming language, functions are a key part of Solidity. Solidity functions are pieces of code that receive inputs, performs some action, and returns an output. 

Functions can be written into Solidity smart contracts to perform all sorts of actions, from sending tokens to storing data. A collection of functions intended for reuse is called a library.

A basic principle in coding is called the "D.R.Y. principle," which stands for "Don't Repeat Yourself." This principle states that developers should never write the same piece of code twice. Instead, developers should write a function once, and then call that function whenever you need to perform that action.

Function Visibility

One important thing to note about Solidity functions is that they have visibility settings. Visibility determines who can see and execute the function. There are four visibility levels in Solidity: public, external, internal, and private.

  • Public functions can be seen and executed by anyone.

  • External functions can be seen by anyone but can only be executed by other contracts.

  • Internal functions can only be seen and executed by other functions within the same contract.

  • Private functions can only be seen and executed by the contract itself.

Call Function

The call function allows you to execute code in another contract. This is how contracts interact with each other on Ethereum.

The call function allows you to write code that can interact with any contract, regardless of whether you have the source code or not. This is possible because the ABI includes all the information needed to encode and decode data that is being passed between contracts.

Delegatecall Function

The delegatecall function is similar to the call method, but with one important difference; it executes the code in the context of the caller. This means that any storage changes made by the called contract will be made to the caller's storage.

The delegatecall function allows you to write contracts that can be reused by other contracts. For example, you could write a contract that implements an interface, and then other contracts can delegatecall that contract to use the interface.

Modifiers

Modifiers are like functions, but with some important differences. First, modifiers can only be used on functions. Second, modifiers are called before the function is executed. An example of a modifier is payable, which allows a function to receive Ether into the contract.

Modifiers allow you to change the behavior of a function without touching the actual code. For instance, a modifier could check if a user has enough balance before executing a function, or to add an event that is triggered when the function is called.

Arrays

Arrays are linear data structures that store a fixed-size of elements of the same data types which are stored in contiguous and adjacent memory locations. An array can be both of fixed or dynamic size. The size of dynamic arrays are not predefined when they are declared, in contrast to fixed arrays which have a predefined size.

If developers need to iterate over a group of data (e.g. using a loop) then use an array. If there’s no need to iterate over a set of data, and instead developer can retrieve values based on a known key, then consider using mappings.

Structs

A struct is a way to store data in a Solidity contract. Structs are useful for creating more complicated data types that have multiple properties.

Mappings

A mapping is a way to store data in a Solidity contract. Mappings are similar to arrays, but the keys can be any type and not just integers. This feature makes mappings versatile and powerful. Mappings allow you to store data in a contract in a way that is flexible and easy to use. 

Events

Events are a way to trigger code execution when certain conditions are met. For example, developers can write an event that is triggered when a user buys a token, or when a transaction is confirmed on the blockchain.

Solidity events allow developers to write code that is executed in response to real-world events. This is how many dApps are able to interact with the real world, for example by sending an email or SMS when a condition is met.

Require (Error Handling)

The "require" keyword is one of three special functions: require, assert, and revert. Require checks if a condition is true, and if not, it will revert the transaction and return an error message.

Using require allows you to prevent errors from happening in your contract. For example, you could use require to check that a user has enough balance to make a purchase, or that an address is valid before sending a transaction.

Upgradeable Smart Contracts

Upgradeable smart contracts are a type of contract that can be upgraded without the need to redeploy the contract. Upgradeable smart contracts allow you to make changes to a contract after it has been deployed, without effecting any of the data or code that is already on the blockchain.

Proxy Contracts

A proxy contract is an updatable routing contract designed to funnel function calls to the most up-to-date implementation.

This way, protocols can upgrade their implementations without requiring all users to update their code to the new address. By using a proxy, builders can have a static address for their functions to be found.

Proxy contracts have an update function that can be called by the team to update the function routing path to new implementation contract addresses.

Multisig Contracts

A multisig contract is a type of contract that requires more than one signature to execute its code. Solidity multisig contracts are useful when developers want to require multiple people to approve a transaction before it is executed.

Multisig contracts are also useful for cases where developers want to limit the amount of money that can be spent in a certain period of time. For example, you could use a multisig contract to require two signatures for any transaction over $1,000.

Reentrancy Attacks

Reentrancy attacks are a type of attack that can occur in Solidity contracts when a contract calls another contract, and then the second contract calls back into the first contract or another untrusted contract, typically before the first contract has finished executing.

Reentrancy attacks can be used to exploit vulnerabilities in contracts. For example, an attacker could use a reentrancy attack to drain all the Ether from a contract.

The Best Way to Learn Solidity

No matter what your goals are, there is a way for you to learn Solidity that fits your needs. If you're looking for a quick and easy way to get started, tutorials are a great option. You can also check out our introduction to Solidity. If you want more structure and guidance, online courses might be a better fit. And if you're looking for an immersive, hands-on experience, a bootcamp could be the right choice.

Once you've chosen your learning method, there are a number of important concepts to ensure you get down, including smart contracts, functions, events, and more. By understanding these concepts, you'll be well on your way to becoming a proficient Solidity developer.

Overview cards background graphic
Section background image

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.