Find your route

What is Solidity in blockchain? The language of Ethereum

Updated 23 October 2026 By the editorial team How we make money
In one sentence
The main programming language for writing smart contracts on Ethereum and other EVM-compatible blockchains. It is statically typed and contract oriented.

Solidity is the main programming language for writing smart contracts on Ethereum and other blockchains that use the Ethereum Virtual Machine (EVM). Most tokens, decentralized exchanges and DeFi apps you can use from a crypto wallet are written in Solidity.

You don’t need to learn Solidity to buy or hold crypto. But it explains why smart contract code can be checked by anyone, why bugs in that code can cost users money, and what to look for before you trust a token.

What is Solidity in blockchain?

Solidity is a high level programming language designed for writing smart contracts: programs that are permanently stored on a blockchain and run exactly as written. It is the primary language of Ethereum and of the many networks that copy Ethereum’s design.

The idea came from Gavin Wood, one of Ethereum’s co-founders, in 2014, and the language was then developed by the Ethereum team. It is open source and still changes regularly, with new features added and older patterns retired. If you have used JavaScript, C++ or Python, Solidity code will look familiar: it uses curly brackets, functions and variables, and it supports inheritance, so one contract can build on others.

Three features make the Solidity programming language different from general-purpose languages:

  • Contract oriented. The basic building block is a contract, not an app. A contract holds its own data and money, and other contracts or wallets interact with it at its address.
  • Statically typed. Every variable has a fixed data type, such as a number, an address or a text string, which the Solidity compiler checks before deployment.
  • Built around money and gas. Sending ether is part of the language, and every operation has a cost in gas, so efficient code is cheaper for users.

How Solidity code runs on the Ethereum Virtual Machine

Solidity code doesn’t run on a single server. A developer writes it, the Solidity compiler turns it into bytecode, and that bytecode is stored on the blockchain, where every node in the peer to peer network can run it inside the Ethereum Virtual Machine (EVM).

The EVM is the runtime environment that all Ethereum nodes share. When you send a transaction to a contract, each node runs the same function call with the same inputs and must reach the same result. That is why smart contracts are predictable, and also why they can’t fetch a website or read a file: everything they use must be on the chain or sent in the transaction.

Deploying contracts works like a special transaction. The contract creator sends the compiled code to the network, pays a fee based on the gas price, and the contract gets its own permanent address. Newly deployed contracts can’t normally be edited. Developers who want to make future changes have to plan for that in advance, for example with an upgrade mechanism that points to a new version.

Where Solidity data lives

Solidity has rules for where data is kept, called the data location. Values in contract storage are written to the blockchain and stay there; values in memory exist only while a function runs. Writing to storage costs much more gas, which is one reason careful Solidity code keeps stored data to a minimum.

A simple smart contract in Solidity

Most introductions start with a simple smart contract that stores one number. Its file begins with two standard lines: an SPDX-License-Identifier comment that states the open source licence, and a pragma solidity line that says which compiler version the code needs.

The contract itself, often called SimpleStorage, then contains:

  • A state variable such as uint256 storedNumber, a whole number kept in contract storage.
  • A function set that anyone can call to change that number. Calling it is a transaction, so it costs gas.
  • A function get marked public view returns (uint256), which reads the number without changing anything. Reading is free when you do it from your own node or wallet app.

A slightly bigger classic example is a basic coin. It keeps a mapping of addresses to public balances, an address owner or minter set by the constructor code when the contract is created, a mint function that only the creator address may call to create new coins, and a send function for a coin transfer between existing accounts. Every ERC-20 token works on a more detailed version of the same idea.

Development tools and frameworks

Solidity developers rarely work in a plain text editor. Common development tools include:

  • Remix, a browser based IDE where you can write, compile and test Solidity smart contracts without installing anything.
  • Development frameworks such as Hardhat and Foundry, which let developers test contracts, simulate the blockchain and deploy smart contracts with scripts. Hardhat uses JavaScript code for tests; Foundry lets developers write tests in Solidity itself.
  • Shared libraries of audited building blocks, such as standard token contracts, so teams don’t reinvent code that handles money.

Other languages exist too. Vyper is a simpler, Python-like language for the EVM, and other blockchains use different ones altogether, such as Rust on Solana. But for Ethereum smart contracts, Solidity is by far the most common choice.

Why Solidity matters to you

Solidity matters to you because the code decides what a token or DeFi app can do with your money, whatever its website says. On Ethereum you can usually read that code: block explorers show the verified source of many contract addresses.

You don’t need to read it line by line to use some of that information:

  • Who can mint? If an owner address can create unlimited new tokens, your share can be diluted at any time.
  • Can transfers be blocked? Some contracts let the owner freeze addresses or pause trading. That is normal for regulated stablecoins, but a red flag for a new meme token.
  • Is it verified and audited? Unverified code is a warning sign. An audit doesn’t remove risk, but it means someone checked the code for known mistakes.

In the EU, someone who offers a new token to the public generally has to publish a white paper under MiCA. That document describes the project, but only the Solidity contract shows what actually happens with the tokens. If the two don’t match, the code wins.

Bugs in Solidity have caused some of the largest losses in crypto, from reentrancy attacks, where a contract is tricked into paying out twice in the same transaction, to simple arithmetic errors. That is the main reason to keep larger amounts in well-known, long-running contracts. See our page on smart contracts for the wider risks, and on ERC-20 tokens for how most tokens are built.

How to learn Solidity

If you want to learn Solidity, start with the official documentation and its example contracts, which cover everything from a simple storage contract to voting and blind auctions. Write and test small contracts in Remix on a test network, where the ether has no value, before you deploy anything with real money. Understanding Ethereum and gas fees first makes the language far easier to follow.

The bottom line

Solidity is the language behind most smart contracts on Ethereum and EVM-compatible blockchains. It turns rules about money into code that every node runs the same way. You don’t need to write it, but knowing what it can do helps you ask the right questions about any token or app before you trust it with your crypto.

Questions people ask

What is Solidity used for?

Solidity is used to write smart contracts: tokens, decentralized exchanges, lending apps, NFT collections and DAOs on Ethereum and other EVM-compatible blockchains.

Is Solidity hard to learn?

The basics are approachable if you know JavaScript, Python or C++, because the syntax looks familiar. Writing secure contracts is harder, because mistakes are public, cost real money and usually can't be fixed after deployment.

Is Solidity similar to C++?

Partly. Solidity borrows ideas from C++, Python and JavaScript, such as curly-brace syntax and inheritance, but it has its own rules for gas, storage and handling money that general-purpose languages don't.

Do I need to know Solidity to invest in crypto?

No. But knowing what it is helps you understand why smart contract risk exists, and why features hidden in a token's code, such as who can mint new tokens, matter to you as a holder.