# Solidity

> The main code language for smart contracts. It runs on Ethereum.

**Field:** Software Development  
**Category:** Blockchain & Web3  
**Also known as:** Solidity Language, Solidity Programming

## Think of it like

It is the words you use to tell a snack machine what to do.

## Definition

Solidity is the main language for writing smart contracts on Ethereum. Its code looks a bit like JavaScript, with curly brackets. Each value has a type that is set before the code runs. You write the code in a .sol file and then compile it. The result runs on the Ethereum Virtual Machine (EVM). That is the engine each Ethereum computer runs.

## Example

Lucy writes a counter contract in Solidity. She compiles it and puts it on the chain. Now anyone can press add.

## Example code

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Counter {
    uint256 public count;

    function add() public {
        count += 1;
    }
}
```

A tiny contract that keeps one number. Anyone who calls add makes it go up by one.

## Why it matters

Most smart contracts are written in it, so it is the first thing to learn if you want to read one.

## Common mistake

Treating it like JavaScript. Every step costs gas, and a bug cannot simply be fixed once it is live.

## Three principles

- **Typed.** Each value has a set type.
- **Compiled.** It turns into bytecode.
- **Runs on the EVM.** Every Ethereum computer runs it.

## Related terms

- [Smart Contract](https://learn.benibix.com/term/development/smart-contract)
- [Ethereum](https://learn.benibix.com/term/development/ethereum)
- [Compiler](https://learn.benibix.com/term/development/compiler)
- [Statically Typed Language](https://learn.benibix.com/term/development/statically-typed-language)
- [JavaScript](https://learn.benibix.com/term/development/javascript)
- [Gas Fee](https://learn.benibix.com/term/development/gas-fee)

![A flow from left to right. A person presses a button on a web page, the front end of a dApp. Their wallet signs a transaction and pays a gas fee. The transaction reaches a smart contract, lit up, that sits on the blockchain with its own address, its code and its data. The contract runs and the new result is stored in the next block.](https://learn.benibix.com/diagrams/dev4-smart-contract.svg)

---

Source: https://learn.benibix.com/term/development/solidity
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
