Introduction to Blockchain, Ethereum & Solidity

A blockchain is an append-only, replicated ledger maintained by a network of nodes that agree on its contents through a consensus protocol.

1.1 What is a blockchain?

A blockchain is an append-only, replicated ledger maintained by a network of nodes that agree on its contents through a consensus protocol. Data is grouped into blocks; each block contains the cryptographic hash of its parent, so altering history would require recomputing (or re-attesting) every later block.

Key properties:

Decentralized — no single operator; thousands of independent nodes.

Immutable — confirmed history is practically impossible to change.

Transparent — every transaction and every contract's code and state are public.

Permissionless — anyone can send transactions or deploy code.

Deterministic — every node re-executes every transaction and must reach the same result.

1.2 What is Ethereum?

Ethereum (launched July 2015) is a blockchain with a built-in, Turing-complete virtual machine — the Ethereum Virtual Machine (EVM). Programs deployed on it are called smart contracts. Since The Merge (September 2022), Ethereum uses Proof of Stake: validators stake 32 ETH (up to 2048 ETH per validator after the Pectra upgrade in 2025) and propose/attest blocks every 12-second slot.

native currency; pays for gas; 1 ETH = 10^18 wei code + persistent storage living at an address signed message from an externally owned account that changes state ordered batch of transactions, produced every 12 s on mainnet software that stores and validates the chain (execution client such as Geth, Nethermind, Reth, Besu, Erigon + consensus client such as Lighthouse, Prysm, Teku) unit measuring computational work after ~2 epochs (~13 minutes) a block is finalized and cannot be reverted without slashing

1.3 What is a smart contract?

A smart contract is a program whose code and state live on-chain. Once deployed, its bytecode cannot change (except through explicit upgrade patterns, Chapter 29). Anyone can call its public functions; every call is executed by every node.

Typical uses: tokens (stablecoins such as USDC, DAI), decentralized exchanges (Uniswap), lending markets (Aave, Compound), NFTs, DAOs, multisig wallets, bridges, games, identity, and supply-chain tracking.

1.4 What is Solidity?

Solidity is a statically typed, contract-oriented, curly-brace language designed to target the EVM. It was proposed by Gavin Wood in 2014 and is developed by the Solidity team at the Ethereum Foundation (with Christian Reitwiessner as long-time lead).

Syntax influenced by C++, JavaScript and Python.

Contracts are like classes: state variables, functions, events, errors, modifiers.

Supports inheritance (including multiple inheritance), libraries, interfaces, user-defined types.

Compiles to EVM bytecode and an ABI (Application Binary Interface) in JSON.

Two compilation pipelines: legacy (direct to EVM) and via-IR (through the Yul intermediate representation, with a stronger optimizer).

Other EVM languages exist — Vyper (Pythonic), Huff (low-level macros), Fe, and raw Yul — but Solidity is used for the overwhelming majority of deployed contracts.

1.5 Where Solidity code runs

Solidity targets any EVM-compatible chain: Ethereum mainnet, Layer 2 rollups (Arbitrum, Optimism, Base, zkSync Era, Scroll, Linea), sidechains and alt-L1s (Polygon PoS, BNB Chain, Avalanche C-Chain, Gnosis Chain), and private/permissioned networks (Hyperledger Besu, Quorum). Note that some popular chains are *not* EVM-based (Solana uses Rust, Starknet uses Cairo, Sui/Aptos use Move).

1.6 Smart contract mindset

Writing contracts differs from ordinary programming:

Code is law and public — attackers can read your code and call any external function with any input.

Bugs can be permanent and costly — billions of dollars have been lost to exploits.

Every operation costs gas — efficiency is a real cost to users.

No floating point, no randomness, no clock you can fully trust; limited and expensive storage.

Composability — your contract can call (and be called by) any other contract.