Network
Launch Date
Consensus
Note
Sepolia
Oct 2021
PoW
Like-for-like representation of Ethereum
Görli
Jan 2019
PoA
Proof-of-Authority
Kiln
Mar 2022
PoS
Post-Merge (for ETH2), shadow fork of the mainnet
Kintsugi
Dec 2021
PoS
DEPRECATED, use Kiln; post-Merge (for ETH2)
Ropsten
Nov 2016
PoW
DEPRECATED, use Sepolia; the Merge to happen on Jun 8, 2022
Rinkeby
Apr 2017
PoA
DEPRECATED, use Görli and Görli Faucet
Kovan
Mar 2017
PoA
DEPRECATED, use Sepolia or Görli
List of active and deprecated Ethereum testnets, including Kintsugi.
Features
Optimistic rollup 
ZK-rollup 
Proof
Uses fraud proofs to prove transaction validity. 
Uses validity (zero-knowledge) proofs to prove transaction validity. 
Capital efficiency
Requires waiting through a 1-week delay (dispute period) before withdrawing funds. 
Users can withdraw funds immediately because validity proofs provide incontrovertible evidence of the authenticity of off-chain transactions. 
Data compression
Publishes full transaction data as calldata to Ethereum Mainnet, which increases rollup costs. 
Doesn't need to publish transaction data on Ethereum because ZK-SNARKs and ZK-STARKs already guarantee the accuracy of the rollup state. 
EVM compatibility
Uses a simulation of the Ethereum Virtual Machine (EVM), which allows it to run arbitrary logic and support smart contracts. 
Doesn't widely support EVM computation, although a few EVM-compatible ZK-rollups have appeared. 
Rollup costs
Reduces costs since it publishes minimal data on Ethereum and doesn't have to post proofs for transactions, except in special circumstances. 
Faces higher overhead from costs involved in generating and verifying proofs for every transaction block. ZK proofs require specialized, expensive hardware to create and have high on-chain verification costs. 
Trust assumptions
Doesn't require a trusted setup. 
Requires a trusted setup to work. 
Liveness requirements
Verifiers are needed to keep tabs on the actual rollup state and the one referenced in the state root to detect fraud. 
Users don't need someone to watch the L2 chain to detect fraud. 
Security properties 
Relies on cryptoeconomic incentives to assure users of rollup security. 
Relies on cryptographic guarantees for security. 
Start building
on Alchemy.
Sign up for free
Start building on Optimism.
Sign up for free
Start building on Arbitrum.
Sign up for free
Start building on Ethereum.
Sign up for free
Start building on Polygon.
Sign up for free
Start building on Starknet.
Sign up for free
Start building on Flow.
Sign up for free
kiln faucet
Get free Kiln ETH.
Start building today
Goerli faucet
Get free Goerli ETH.
Start building today
mumbai faucet
Get free Mumbai Matic.
Start building today
rinkeby faucet
Get free Rinkeby
ETH.
Start building today
Start building on Ethereum.
Get started for free
Start building on Ethereum.
Get started for free
Start building on Flow.
Get started for free
Start building on Polygon.
Get started for free
Start building on Starknet.
Get started for free
Start building on Optimism.
Get started for free
Start building on Solana.
Get started for free
Start building on Solana.
Sign up for beta access
Start building on Solana.
Join the waitlist
Arbitrum logo
Start building on Arbitrum.
Get started for free
Learn
Solidity at
Alchemy
University
Get started today
curl 
https://release.solana.com/v1.10.32/solana-install-init-x86_64-pc-windows-msvc.exe 
--output 
C:\solana-install-tmp\solana-install-init.exe 
--create-dirs
Learn Solidity
SOLIDITY PROGRAMMING LANGUAGE OVERVIEW

What is Solidity?

An Introduction to Solidity: Web3's Most Popular Programming Language
Last Updated:
October 4, 2022
Table of Contents
Table of Contents
Table of Contents

{{learn-solidity}}

As the web3 industry grows, developers are met with more choices of web3 programming languages. Each language is designed with different benefits and tradeoffs for writing smart contracts. Languages may differ through supporting specific blockchains, or have different characteristics such as speed, readability, or security.

Developed as the smart contract language for the Ethereum blockchain, Solidity is a powerful programming language that is used to create decentralized applications (dApps) for the largest developer ecosystem in the blockchain industry.

In this article, we will provide an introduction to Solidity through its history, its language influences, and its uses. At the end, we will provide some of the best developer resources so you can continue learning about Solidity development.

What is Solidity?

Proposed in 2014, Solidity is an object-oriented, high-level programming language for implementing smart contracts that run on the Ethereum Virtual Machine (EVM). Solidity is inspired by well-known programming languages like C++ and JavaScript. As a web3 developer, working with Solidity is beneficial to learning web3 development.

This section introduces you to the history of Solidity, establishes similarities between Solidity and other programming languages, and explains the main use cases for Solidity.

Who created Solidity?

In 2014, the CTO of Ethereum, Gavin Wood, came up with Solidity as a language that would satisfy Ethereum’s need for a Turing-complete programming language for writing smart contracts.

The founder of Ethereum, Vitalik Buterin, proposed Ethereum as a protocol that would extend the blockchain functionality pioneered by Bitcoin, with the added functionality of smart contracts. In his vision, Ethereum would be able to run an elaborate network of smart contracts, which are conditionally executing pieces of code that run on a distributed, global network of computers. Smart contracts enable developers to create new cryptocurrencies, build DeFi apps, and much more.

The Solidity project team was led by Christian Reitwiessner, and they were successful in creating a Turing-complete, object oriented programming language for implementing smart contracts. Being a high-level language means developers create smart contracts without having to manipulate system-level information like memory or bytecode to perform computations.

Turing completeness refers to the ability of a data-manipulation system, in this case a programming language, to simulate the behavior of a Turing Machine. Theoretically, Solidity needed to be able to perform any computation developers could require of it.

On what programming languages is Solidity based?

Solidity was based on and influenced by multiple existing programming languages during its development, including C++, Python, and JavaScript. 

Solidity Similarities to C++

Solidity uses an identical syntax to C++ for variable declarations and for loops. Additionally, there is support for C++ style function overloading, which is needed when two functions have the same name but differ in the parameters they accept.

Finally, Solidity allows both implicit and explicit type conversion. This means variable types can be cast by explicit developer code or will be automatically converted if required by a computation.

Solidity Similarities to JavaScript

Solidity used to be heavily influenced by JavaScript. Now, the main visible similarity is in Solidity’s use of the ‘function’ keyword for defining functions. 

For developers familiar with some of Solidity’s greatest influences, getting to know Solidity will be fairly straightforward. Additionally, Solidity is statically typed, allows the use of libraries as well as the creation of complex types.

Solidity Similarities to Python

Solidity’s influence from Python is less apparent in terms of syntax, however, like Python, Solidity uses C3 linearization, multiple inheritance, and maintains the ‘super’ keyword. 

Using Pythonic syntax, Vyper is similar to Solidity, and is purposefully designed to increase the security of smart contracts used on EVM-compatible blockchains. 

How is Solidity used?

Specific to its nature as a blockchain coding language, Solidity was created to expressly be compiled on the Ethereum Virtual Machine (EVM). As such, Solidity is able to write secure Ethereum-compatible smart contracts, for any EVM-compatible blockchain. 

This broad compatibility, paired with its easy understandability and flexible functionality, has led Solidity to be the most widely used blockchain development language in the industry. 

How does Solidity work?

Solidity developers write smart contracts, which are programs running on the EVM. Similar to classes in other languages, smart contracts can have multiple functions, internal states and public declarations.

Solidity contracts are compiled into bytecode to be read by the EVM. After compilation, the Solidity contracts will look no different from those written in other EVM smart contract languages like Vyper or Huff.

Like any other developer tool, Solidity goes through regular version updates. Note that because smart contracts are deployed once and are irreversible after joining the blockchain, Solidity version constraints will only matter at the time of creation.

While Solidity developers can theoretically write Ethereum smart contracts directly in bytecode, high-level languages like Solidity allow engineers to write contracts more efficiently without any low-level manipulation.

How does Solidity interact with the EVM?

 The following is a summary of how Solidity works to change the state of the EVM:

  1. Write smart contracts in Solidity
  2. Solidity smart contracts are compiled to bytecode
  3. Bytecode is converted into EVM opcodes
  4. EVM opcodes alter the state of the EVM

The EVM is a virtual state machine and record keeper for Ethereum’s “global computer.” In the simplest terms, the EVM maintains the global state of the network, which includes addresses, account balances and token holdings. 

Solidity smart contracts are written to make changes to the EVM’s global state. The EVM’s global state is changed by actions such as minting tokens, sending and receiving tokens, or releasing assets. 

A host of EVM operations, encoded into EVM opcodes, prompt these changes to the global state. Each EVM opcode is designed to prompt the EVM to perform a specific kind of state change, such as sending tokens from one address to another, minting tokens, or even destroying smart contracts. 

In the last step, the EVM translates the smart contract’s bytecode into EVM opcodes, which make the necessary changes to the blockchain. 

Each opcode comes with a certain gas fee, charged in ETH to mitigate the risk of a malicious actor clogging up the network with an inordinate amount of requests. The total gas cost of a transaction is thus calculated by the price per unit of gas times the total gas cost of a transaction’s opcodes.

What EVM-compatible blockchains support Solidity?

Solidity is able to write smart contracts for any EVM-compatible blockchains, including L2s such as Polygon, Arbitrum, and Optimism. Since Solidity is flexible and easy to use, it is supported by a large number of other blockchains. Here are some of the largest projects that support Solidity:

1. Polkadot 

Polkadot is a chain focused on integrating multiple blockchains (i.e. parachains) into one chain using a relay chain. Polkadot’s goal is for parachains to be interoperable to allow scalability and increase bandwidth. One example of a Polkadot parachain is Astar, which is supported by Alchemy.

2. Avalanche

Avalanche is an Ethereum competitor that supports Solidity development. The Avalanche architecture is based on a network of three blockchains: one for issuing and trading assets (X Chain), one for coordinating the network’s validators (P-Chain), and one that allows smart contract creation (C Chain). 

3. BNB Chain (Formerly Binance Smart Chain)

Binance Smart Chain started as an ERC-20 token on Ethereum, and to support their growing ecosystem of dApps, the Binance Smart Chain (BSC) network was created. BSC and its tokens use Solidity in their smart contracts. Today, Binance Smart Chain is called BNB Chain.

How popular is Solidity?

Solidity is the most popular smart contract programming language in the blockchain industry. Solidity is the native language for creating EVM-compatible smart contracts. Even outside of the EVM, there are projects that have built-in support for Ethereum’s Virtual Machine such as Neon Labs’ Solana EVM

Since the blockchain industry is still growing, it may appear as if Solidity is less used compared to all other programming languages. However, within the industry, Solidity is the most widely applicable smart contract language. Solidity Has strong use cases on many chains and in the fastest growing web3 dApp ecosystems.

According to a report by The Next Web’s Hard Fork, Solidity appears in twice as many blockchain-tagged questions than its second closest competitor. JavaScript has just 4.8% the volume compared to Solidity’s 9.5%. 

How is Solidity used on Ethereum? 

Seeing some examples of Solidity’s use in Ethereum will give you a good sense of the simplicity of Solidity code in creating flexible smart contracts. The code examples found in the official Solidity documentation are a great introduction to the language. 

Smart Contracts

The following is a simple code example from the Solidity documentation that creates a simple currency on Ethereum.

This code creates a currency.

Notice the function declarations, private and public variables for the contract. Functions allow the contract to perform different actions on-chain, in this case sending tokens from one address to another, and minting tokens. 

Public variables are accessible from outside the contract and automatically generate getter functions for retrieving the value of those variables. The event keyword allows client applications to listen for changes caused by the contract.

In this example, a client would see the sent event, which indicates to a listener that address msg.sender sent an amount of tokens to the address receiver.

What are Solidity ERC standards?

Underlying the design of Solidity smart contracts are ERC (Ethereum Request for Comment) standards, which are guidelines made to improve and standardize the implementations of different types of Ethereum tokens.

ERC standards are proposed by EIPs (Ethereum Improvement Proposals). Once ERC standards are approved and finalized, they become a standard for writing Solidity contracts. This allows a common Solidity interface template for building smart contracts. When Solidity developers build tokens adhering to existing ERC standards, they know how their tokens will behave appropriately on the blockchain. 

Some of the most widely used ERC standards are:

  • ERC-20 - fungible token standard
  • ERC-721 - non-fungible token standard
  • ERC-1155 - semi-fungible token standard
  • ERC-4626 - yield-bearing vault standard

How to Learn Solidity Programming

So you know what Solidity is, but how do you begin learning Solidity? As the most popular smart contract language, there is a wealth of resources available online to begin learning Solidity development. 

One of the best ways to learn Solidity is with Alchemy University's 7-week Solidity bootcamp, that was originally created by ChainShot, a leading team of web3 engineers, and redesigned by Alchemy after they acquired ChainShot in August 2022.

The Ethereum developer bootcamp was originally a $3,000 certification course, and is now FREE. Secure your spot in line to join Alchemy University.

Solidity Resources

This section provides you with some of the best resources online for learning Solidity development.

  1. Official Solidity Documentation - use docs as your primary resource for learning Solidity development.
  2. Solidity by Example - compilation of Solidity examples ranging from a ‘Hello World’ program to wallet applications and DeFi.
  3. Clean Contracts - guide on how to write safe and predictable smart contracts with Solidity code examples.
  4. Ethernaut by OpenZeppelin - a smart contract based war game where each level consists of hacking a smart contract.

Start Building with Solidity

This article introduced you to Solidity and provided you with resources to begin learning Solidity development. Solidity is an extremely flexible and powerful language to develop decentralized applications on Ethereum and EVM-compatible blockchains.

Once you are comfortable with your knowledge, don’t hesitate to deploy an application on the Goerli testnet, attend a web3 hackathon, and start trying to build a web3 startup! 

ALCHEMY SUPERNODE - ETHEREUM NODE API

Scale to any size, without any errors

Alchemy Supernode finally makes it possible to scale blockchain applications without all the headaches. Plus, our legendary support will guide you every step of the way.

Get started for free
Supernode footer
Learn Solidity
SOLIDITY PROGRAMMING LANGUAGE OVERVIEW

Learn Solidity: What is Solidity?

An Introduction to Solidity: Web3's Most Popular Programming Language
Last Updated:
October 4, 2022
Don't miss an update
Sign up for our newsletter to get alpha, key insights, and killer resources.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Table of Contents

As the web3 industry grows, developers are met with more choices of web3 programming languages. Each language is designed with different benefits and tradeoffs for writing smart contracts. Languages may differ through supporting specific blockchains, or have different characteristics such as speed, readability, or security.

Developed as the smart contract language for the Ethereum blockchain, Solidity is a powerful programming language that is used to create decentralized applications (dApps) for the largest developer ecosystem in the blockchain industry.

In this article, we will provide an introduction to Solidity through its history, its language influences, and its uses. At the end, we will provide some of the best developer resources so you can continue learning about Solidity development.

What is Solidity?

Proposed in 2014, Solidity is an object-oriented, high-level programming language for implementing smart contracts that run on the Ethereum Virtual Machine (EVM). Solidity is inspired by well-known programming languages like C++ and JavaScript. As a web3 developer, working with Solidity is beneficial to learning web3 development.

This section introduces you to the history of Solidity, establishes similarities between Solidity and other programming languages, and explains the main use cases for Solidity.

Who created Solidity?

In 2014, the CTO of Ethereum, Gavin Wood, came up with Solidity as a language that would satisfy Ethereum’s need for a Turing-complete programming language for writing smart contracts.

The founder of Ethereum, Vitalik Buterin, proposed Ethereum as a protocol that would extend the blockchain functionality pioneered by Bitcoin, with the added functionality of smart contracts. In his vision, Ethereum would be able to run an elaborate network of smart contracts, which are conditionally executing pieces of code that run on a distributed, global network of computers. Smart contracts enable developers to create new cryptocurrencies, build DeFi apps, and much more.

The Solidity project team was led by Christian Reitwiessner, and they were successful in creating a Turing-complete, object oriented programming language for implementing smart contracts. Being a high-level language means developers create smart contracts without having to manipulate system-level information like memory or bytecode to perform computations.

Turing completeness refers to the ability of a data-manipulation system, in this case a programming language, to simulate the behavior of a Turing Machine. Theoretically, Solidity needed to be able to perform any computation developers could require of it.

On what programming languages is Solidity based?

Solidity was based on and influenced by multiple existing programming languages during its development, including C++, Python, and JavaScript. 

Solidity Similarities to C++

Solidity uses an identical syntax to C++ for variable declarations and for loops. Additionally, there is support for C++ style function overloading, which is needed when two functions have the same name but differ in the parameters they accept.

Finally, Solidity allows both implicit and explicit type conversion. This means variable types can be cast by explicit developer code or will be automatically converted if required by a computation.

Solidity Similarities to JavaScript

Solidity used to be heavily influenced by JavaScript. Now, the main visible similarity is in Solidity’s use of the ‘function’ keyword for defining functions. 

For developers familiar with some of Solidity’s greatest influences, getting to know Solidity will be fairly straightforward. Additionally, Solidity is statically typed, allows the use of libraries as well as the creation of complex types.

Solidity Similarities to Python

Solidity’s influence from Python is less apparent in terms of syntax, however, like Python, Solidity uses C3 linearization, multiple inheritance, and maintains the ‘super’ keyword. 

Using Pythonic syntax, Vyper is similar to Solidity, and is purposefully designed to increase the security of smart contracts used on EVM-compatible blockchains. 

How is Solidity used?

Specific to its nature as a blockchain coding language, Solidity was created to expressly be compiled on the Ethereum Virtual Machine (EVM). As such, Solidity is able to write secure Ethereum-compatible smart contracts, for any EVM-compatible blockchain. 

This broad compatibility, paired with its easy understandability and flexible functionality, has led Solidity to be the most widely used blockchain development language in the industry. 

How does Solidity work?

Solidity developers write smart contracts, which are programs running on the EVM. Similar to classes in other languages, smart contracts can have multiple functions, internal states and public declarations.

Solidity contracts are compiled into bytecode to be read by the EVM. After compilation, the Solidity contracts will look no different from those written in other EVM smart contract languages like Vyper or Huff.

Like any other developer tool, Solidity goes through regular version updates. Note that because smart contracts are deployed once and are irreversible after joining the blockchain, Solidity version constraints will only matter at the time of creation.

While Solidity developers can theoretically write Ethereum smart contracts directly in bytecode, high-level languages like Solidity allow engineers to write contracts more efficiently without any low-level manipulation.

How does Solidity interact with the EVM?

 The following is a summary of how Solidity works to change the state of the EVM:

  1. Write smart contracts in Solidity
  2. Solidity smart contracts are compiled to bytecode
  3. Bytecode is converted into EVM opcodes
  4. EVM opcodes alter the state of the EVM

The EVM is a virtual state machine and record keeper for Ethereum’s “global computer.” In the simplest terms, the EVM maintains the global state of the network, which includes addresses, account balances and token holdings. 

Solidity smart contracts are written to make changes to the EVM’s global state. The EVM’s global state is changed by actions such as minting tokens, sending and receiving tokens, or releasing assets. 

A host of EVM operations, encoded into EVM opcodes, prompt these changes to the global state. Each EVM opcode is designed to prompt the EVM to perform a specific kind of state change, such as sending tokens from one address to another, minting tokens, or even destroying smart contracts. 

In the last step, the EVM translates the smart contract’s bytecode into EVM opcodes, which make the necessary changes to the blockchain. 

Each opcode comes with a certain gas fee, charged in ETH to mitigate the risk of a malicious actor clogging up the network with an inordinate amount of requests. The total gas cost of a transaction is thus calculated by the price per unit of gas times the total gas cost of a transaction’s opcodes.

What EVM-compatible blockchains support Solidity?

Solidity is able to write smart contracts for any EVM-compatible blockchains, including L2s such as Polygon, Arbitrum, and Optimism. Since Solidity is flexible and easy to use, it is supported by a large number of other blockchains. Here are some of the largest projects that support Solidity:

1. Polkadot 

Polkadot is a chain focused on integrating multiple blockchains (i.e. parachains) into one chain using a relay chain. Polkadot’s goal is for parachains to be interoperable to allow scalability and increase bandwidth. One example of a Polkadot parachain is Astar, which is supported by Alchemy.

2. Avalanche

Avalanche is an Ethereum competitor that supports Solidity development. The Avalanche architecture is based on a network of three blockchains: one for issuing and trading assets (X Chain), one for coordinating the network’s validators (P-Chain), and one that allows smart contract creation (C Chain). 

3. BNB Chain (Formerly Binance Smart Chain)

Binance Smart Chain started as an ERC-20 token on Ethereum, and to support their growing ecosystem of dApps, the Binance Smart Chain (BSC) network was created. BSC and its tokens use Solidity in their smart contracts. Today, Binance Smart Chain is called BNB Chain.

How popular is Solidity?

Solidity is the most popular smart contract programming language in the blockchain industry. Solidity is the native language for creating EVM-compatible smart contracts. Even outside of the EVM, there are projects that have built-in support for Ethereum’s Virtual Machine such as Neon Labs’ Solana EVM

Since the blockchain industry is still growing, it may appear as if Solidity is less used compared to all other programming languages. However, within the industry, Solidity is the most widely applicable smart contract language. Solidity Has strong use cases on many chains and in the fastest growing web3 dApp ecosystems.

According to a report by The Next Web’s Hard Fork, Solidity appears in twice as many blockchain-tagged questions than its second closest competitor. JavaScript has just 4.8% the volume compared to Solidity’s 9.5%. 

How is Solidity used on Ethereum? 

Seeing some examples of Solidity’s use in Ethereum will give you a good sense of the simplicity of Solidity code in creating flexible smart contracts. The code examples found in the official Solidity documentation are a great introduction to the language. 

Smart Contracts

The following is a simple code example from the Solidity documentation that creates a simple currency on Ethereum.

This code creates a currency.

Notice the function declarations, private and public variables for the contract. Functions allow the contract to perform different actions on-chain, in this case sending tokens from one address to another, and minting tokens. 

Public variables are accessible from outside the contract and automatically generate getter functions for retrieving the value of those variables. The event keyword allows client applications to listen for changes caused by the contract.

In this example, a client would see the sent event, which indicates to a listener that address msg.sender sent an amount of tokens to the address receiver.

What are Solidity ERC standards?

Underlying the design of Solidity smart contracts are ERC (Ethereum Request for Comment) standards, which are guidelines made to improve and standardize the implementations of different types of Ethereum tokens.

ERC standards are proposed by EIPs (Ethereum Improvement Proposals). Once ERC standards are approved and finalized, they become a standard for writing Solidity contracts. This allows a common Solidity interface template for building smart contracts. When Solidity developers build tokens adhering to existing ERC standards, they know how their tokens will behave appropriately on the blockchain. 

Some of the most widely used ERC standards are:

  • ERC-20 - fungible token standard
  • ERC-721 - non-fungible token standard
  • ERC-1155 - semi-fungible token standard
  • ERC-4626 - yield-bearing vault standard

How to Learn Solidity Programming

So you know what Solidity is, but how do you begin learning Solidity? As the most popular smart contract language, there is a wealth of resources available online to begin learning Solidity development. 

One of the best ways to learn Solidity is with Alchemy University's 7-week Solidity bootcamp, that was originally created by ChainShot, a leading team of web3 engineers, and redesigned by Alchemy after they acquired ChainShot in August 2022.

The Ethereum developer bootcamp was originally a $3,000 certification course, and is now FREE. Secure your spot in line to join Alchemy University.

Solidity Resources

This section provides you with some of the best resources online for learning Solidity development.

  1. Official Solidity Documentation - use docs as your primary resource for learning Solidity development.
  2. Solidity by Example - compilation of Solidity examples ranging from a ‘Hello World’ program to wallet applications and DeFi.
  3. Clean Contracts - guide on how to write safe and predictable smart contracts with Solidity code examples.
  4. Ethernaut by OpenZeppelin - a smart contract based war game where each level consists of hacking a smart contract.

Start Building with Solidity

This article introduced you to Solidity and provided you with resources to begin learning Solidity development. Solidity is an extremely flexible and powerful language to develop decentralized applications on Ethereum and EVM-compatible blockchains.

Once you are comfortable with your knowledge, don’t hesitate to deploy an application on the Goerli testnet, attend a web3 hackathon, and start trying to build a web3 startup! 

As the web3 industry grows, developers are met with more choices of web3 programming languages. Each language is designed with different benefits and tradeoffs for writing smart contracts. Languages may differ through supporting specific blockchains, or have different characteristics such as speed, readability, or security.

Developed as the smart contract language for the Ethereum blockchain, Solidity is a powerful programming language that is used to create decentralized applications (dApps) for the largest developer ecosystem in the blockchain industry.

In this article, we will provide an introduction to Solidity through its history, its language influences, and its uses. At the end, we will provide some of the best developer resources so you can continue learning about Solidity development.

What is Solidity?

Proposed in 2014, Solidity is an object-oriented, high-level programming language for implementing smart contracts that run on the Ethereum Virtual Machine (EVM). Solidity is inspired by well-known programming languages like C++ and JavaScript. As a web3 developer, working with Solidity is beneficial to learning web3 development.

This section introduces you to the history of Solidity, establishes similarities between Solidity and other programming languages, and explains the main use cases for Solidity.

Who created Solidity?

In 2014, the CTO of Ethereum, Gavin Wood, came up with Solidity as a language that would satisfy Ethereum’s need for a Turing-complete programming language for writing smart contracts.

The founder of Ethereum, Vitalik Buterin, proposed Ethereum as a protocol that would extend the blockchain functionality pioneered by Bitcoin, with the added functionality of smart contracts. In his vision, Ethereum would be able to run an elaborate network of smart contracts, which are conditionally executing pieces of code that run on a distributed, global network of computers. Smart contracts enable developers to create new cryptocurrencies, build DeFi apps, and much more.

The Solidity project team was led by Christian Reitwiessner, and they were successful in creating a Turing-complete, object oriented programming language for implementing smart contracts. Being a high-level language means developers create smart contracts without having to manipulate system-level information like memory or bytecode to perform computations.

Turing completeness refers to the ability of a data-manipulation system, in this case a programming language, to simulate the behavior of a Turing Machine. Theoretically, Solidity needed to be able to perform any computation developers could require of it.

On what programming languages is Solidity based?

Solidity was based on and influenced by multiple existing programming languages during its development, including C++, Python, and JavaScript. 

Solidity Similarities to C++

Solidity uses an identical syntax to C++ for variable declarations and for loops. Additionally, there is support for C++ style function overloading, which is needed when two functions have the same name but differ in the parameters they accept.

Finally, Solidity allows both implicit and explicit type conversion. This means variable types can be cast by explicit developer code or will be automatically converted if required by a computation.

Solidity Similarities to JavaScript

Solidity used to be heavily influenced by JavaScript. Now, the main visible similarity is in Solidity’s use of the ‘function’ keyword for defining functions. 

For developers familiar with some of Solidity’s greatest influences, getting to know Solidity will be fairly straightforward. Additionally, Solidity is statically typed, allows the use of libraries as well as the creation of complex types.

Solidity Similarities to Python

Solidity’s influence from Python is less apparent in terms of syntax, however, like Python, Solidity uses C3 linearization, multiple inheritance, and maintains the ‘super’ keyword. 

Using Pythonic syntax, Vyper is similar to Solidity, and is purposefully designed to increase the security of smart contracts used on EVM-compatible blockchains. 

How is Solidity used?

Specific to its nature as a blockchain coding language, Solidity was created to expressly be compiled on the Ethereum Virtual Machine (EVM). As such, Solidity is able to write secure Ethereum-compatible smart contracts, for any EVM-compatible blockchain. 

This broad compatibility, paired with its easy understandability and flexible functionality, has led Solidity to be the most widely used blockchain development language in the industry. 

How does Solidity work?

Solidity developers write smart contracts, which are programs running on the EVM. Similar to classes in other languages, smart contracts can have multiple functions, internal states and public declarations.

Solidity contracts are compiled into bytecode to be read by the EVM. After compilation, the Solidity contracts will look no different from those written in other EVM smart contract languages like Vyper or Huff.

Like any other developer tool, Solidity goes through regular version updates. Note that because smart contracts are deployed once and are irreversible after joining the blockchain, Solidity version constraints will only matter at the time of creation.

While Solidity developers can theoretically write Ethereum smart contracts directly in bytecode, high-level languages like Solidity allow engineers to write contracts more efficiently without any low-level manipulation.

How does Solidity interact with the EVM?

 The following is a summary of how Solidity works to change the state of the EVM:

  1. Write smart contracts in Solidity
  2. Solidity smart contracts are compiled to bytecode
  3. Bytecode is converted into EVM opcodes
  4. EVM opcodes alter the state of the EVM

The EVM is a virtual state machine and record keeper for Ethereum’s “global computer.” In the simplest terms, the EVM maintains the global state of the network, which includes addresses, account balances and token holdings. 

Solidity smart contracts are written to make changes to the EVM’s global state. The EVM’s global state is changed by actions such as minting tokens, sending and receiving tokens, or releasing assets. 

A host of EVM operations, encoded into EVM opcodes, prompt these changes to the global state. Each EVM opcode is designed to prompt the EVM to perform a specific kind of state change, such as sending tokens from one address to another, minting tokens, or even destroying smart contracts. 

In the last step, the EVM translates the smart contract’s bytecode into EVM opcodes, which make the necessary changes to the blockchain. 

Each opcode comes with a certain gas fee, charged in ETH to mitigate the risk of a malicious actor clogging up the network with an inordinate amount of requests. The total gas cost of a transaction is thus calculated by the price per unit of gas times the total gas cost of a transaction’s opcodes.

What EVM-compatible blockchains support Solidity?

Solidity is able to write smart contracts for any EVM-compatible blockchains, including L2s such as Polygon, Arbitrum, and Optimism. Since Solidity is flexible and easy to use, it is supported by a large number of other blockchains. Here are some of the largest projects that support Solidity:

1. Polkadot 

Polkadot is a chain focused on integrating multiple blockchains (i.e. parachains) into one chain using a relay chain. Polkadot’s goal is for parachains to be interoperable to allow scalability and increase bandwidth. One example of a Polkadot parachain is Astar, which is supported by Alchemy.

2. Avalanche

Avalanche is an Ethereum competitor that supports Solidity development. The Avalanche architecture is based on a network of three blockchains: one for issuing and trading assets (X Chain), one for coordinating the network’s validators (P-Chain), and one that allows smart contract creation (C Chain). 

3. BNB Chain (Formerly Binance Smart Chain)

Binance Smart Chain started as an ERC-20 token on Ethereum, and to support their growing ecosystem of dApps, the Binance Smart Chain (BSC) network was created. BSC and its tokens use Solidity in their smart contracts. Today, Binance Smart Chain is called BNB Chain.

How popular is Solidity?

Solidity is the most popular smart contract programming language in the blockchain industry. Solidity is the native language for creating EVM-compatible smart contracts. Even outside of the EVM, there are projects that have built-in support for Ethereum’s Virtual Machine such as Neon Labs’ Solana EVM

Since the blockchain industry is still growing, it may appear as if Solidity is less used compared to all other programming languages. However, within the industry, Solidity is the most widely applicable smart contract language. Solidity Has strong use cases on many chains and in the fastest growing web3 dApp ecosystems.

According to a report by The Next Web’s Hard Fork, Solidity appears in twice as many blockchain-tagged questions than its second closest competitor. JavaScript has just 4.8% the volume compared to Solidity’s 9.5%. 

How is Solidity used on Ethereum? 

Seeing some examples of Solidity’s use in Ethereum will give you a good sense of the simplicity of Solidity code in creating flexible smart contracts. The code examples found in the official Solidity documentation are a great introduction to the language. 

Smart Contracts

The following is a simple code example from the Solidity documentation that creates a simple currency on Ethereum.

This code creates a currency.

Notice the function declarations, private and public variables for the contract. Functions allow the contract to perform different actions on-chain, in this case sending tokens from one address to another, and minting tokens. 

Public variables are accessible from outside the contract and automatically generate getter functions for retrieving the value of those variables. The event keyword allows client applications to listen for changes caused by the contract.

In this example, a client would see the sent event, which indicates to a listener that address msg.sender sent an amount of tokens to the address receiver.

What are Solidity ERC standards?

Underlying the design of Solidity smart contracts are ERC (Ethereum Request for Comment) standards, which are guidelines made to improve and standardize the implementations of different types of Ethereum tokens.

ERC standards are proposed by EIPs (Ethereum Improvement Proposals). Once ERC standards are approved and finalized, they become a standard for writing Solidity contracts. This allows a common Solidity interface template for building smart contracts. When Solidity developers build tokens adhering to existing ERC standards, they know how their tokens will behave appropriately on the blockchain. 

Some of the most widely used ERC standards are:

  • ERC-20 - fungible token standard
  • ERC-721 - non-fungible token standard
  • ERC-1155 - semi-fungible token standard
  • ERC-4626 - yield-bearing vault standard

How to Learn Solidity Programming

So you know what Solidity is, but how do you begin learning Solidity? As the most popular smart contract language, there is a wealth of resources available online to begin learning Solidity development. 

One of the best ways to learn Solidity is with Alchemy University's 7-week Solidity bootcamp, that was originally created by ChainShot, a leading team of web3 engineers, and redesigned by Alchemy after they acquired ChainShot in August 2022.

The Ethereum developer bootcamp was originally a $3,000 certification course, and is now FREE. Secure your spot in line to join Alchemy University.

Solidity Resources

This section provides you with some of the best resources online for learning Solidity development.

  1. Official Solidity Documentation - use docs as your primary resource for learning Solidity development.
  2. Solidity by Example - compilation of Solidity examples ranging from a ‘Hello World’ program to wallet applications and DeFi.
  3. Clean Contracts - guide on how to write safe and predictable smart contracts with Solidity code examples.
  4. Ethernaut by OpenZeppelin - a smart contract based war game where each level consists of hacking a smart contract.

Start Building with Solidity

This article introduced you to Solidity and provided you with resources to begin learning Solidity development. Solidity is an extremely flexible and powerful language to develop decentralized applications on Ethereum and EVM-compatible blockchains.

Once you are comfortable with your knowledge, don’t hesitate to deploy an application on the Goerli testnet, attend a web3 hackathon, and start trying to build a web3 startup! 

Build web3 with Alchemy

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

Get started for free