Lesson 01 of 25
Introduction to Solidity
What is Solidity and how does the Ethereum Virtual Machine work?
BeginnerWhat is Solidity?
Solidity is a statically-typed, contract-oriented programming language designed for developing smart contracts that run on the Ethereum Virtual Machine (EVM). Created by Gavin Wood and first proposed in 2014, Solidity borrows syntax from JavaScript, Python, and C++, making it approachable for developers from many backgrounds.
Smart contracts are self-executing programs stored on the blockchain. Once deployed, they run exactly as programmed — without downtime, censorship, fraud, or third-party interference.
The Ethereum Virtual Machine (EVM)
The EVM is the runtime environment for smart contracts on Ethereum. It is a sandboxed, isolated virtual machine that:
- Executes bytecode deterministically across all nodes
- Charges gas for every operation to prevent abuse
- Maintains a global state — accounts, balances, and storage
- Is Turing-complete (with gas as a limiting factor)
Your First Look at Solidity
Every Solidity file starts with a
pragma directive specifying the compiler version, followed by a contract declaration — similar to a class in object-oriented languages.
Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
string public message = "Hello, Ethereum!";
function setMessage(string memory _msg) public {
message = _msg;
}
}
Key Concepts to Remember
- Immutability — deployed contract code cannot be changed
- Gas — every computation costs ETH to execute
- Determinism — the same inputs always produce the same outputs
- Transparency — all contract code is visible on the blockchain
- Trustlessness — no intermediary is needed to execute the logic