Roadmap › 6. Web3 & Blockchain › Step 56
Sol

Solidity & Smart Contract Development

Solidity syntax, data types and data locations, functions, visibility and modifiers, events, errors, inheritance and interfaces, ERC-20/721 with OpenZeppelin, payable and Ether transfers, upgradeable contracts, gas optimisation, testing with Hardhat/Foundry, deployment and security vulnerabilities.
What it is & where it is used

Solidity is a statically typed, curly-brace, contract-oriented language for writing smart contracts on the EVM (Ethereum and EVM-compatible chains: Arbitrum, Optimism, Base, Polygon, BNB Chain, Avalanche...). Syntax is influenced by C++, Python and JavaScript. Created by Gavin Wood and others; developed by the Ethereum Foundation's Solidity team (first released 2015).

A contract is like a class: state variables (stored permanently on-chain), functions, modifiers, events, errors, and can inherit from other contracts. Code is compiled with solc into EVM bytecode plus an ABI.

Smart contract development is high-stakes: deployed code is public, usually immutable, and often holds money — bugs are exploited quickly. Interviews focus heavily on security, gas costs and testing.

Versions & history
VersionYearNotable changes
0.1–0.32015–2016Early releases
0.4.x2016–2018Widely used in the ICO era; constant functions; many legacy contracts
0.5.02018Explicit data locations, address payable, explicit visibility required
0.6.02019virtual/override required, receive()/fallback() split, try/catch for external calls
0.7.02020now removed (use block.timestamp), constructor visibility removed
0.8.0Dec 2020Checked arithmetic (overflow/underflow reverts by default; unchecked {} to opt out), ABI coder v2 default
0.8.42021Custom errors (error InsufficientBalance(...) — cheaper than revert strings)
0.8.18–0.8.302023–2025User-defined operators, named mapping parameters, transient storage (transient keyword, 0.8.28, after Dencun's EIP-1153), new EVM version defaults (Cancun, Prague)
0.9 (planned)—Further breaking cleanups

Always pin the compiler: pragma solidity 0.8.28; (or ^0.8.24) and use a recent 0.8.x release. Library versions: OpenZeppelin Contracts 4.x (2021–2023) → 5.x (2023+, custom errors, Ownable(initialOwner), namespaced storage).

Lifecycle

Development lifecycle:

  1. Specify — requirements, roles, invariants ("total supply equals sum of balances"), threat model.
  2. Write — Solidity using audited building blocks (OpenZeppelin).
  3. Compile — forge build / npx hardhat compile → bytecode + ABI.
  4. Test — unit tests, fuzz tests, invariant tests, fork tests against mainnet state; coverage.
  5. Static analysis — Slither, compiler warnings, linters (solhint).
  6. Audit — internal review + external audit; bug bounty.
  7. Deploy — testnet (Sepolia) → mainnet with a script; record addresses; deploy through a multisig where possible.
  8. Verify — publish source on Etherscan/Blockscout.
  9. Operate — monitoring (events, Defender/Forta), admin actions via multisig + timelock, incident response (pause).
  10. Upgrade or migrate — through a proxy (if designed) or by deploying a new contract and migrating state.

Contract execution lifecycle (per call): transaction/call reaches the contract → EVM loads bytecode → function selector (first 4 bytes of calldata = keccak256("transfer(address,uint256)")[0:4]) dispatches to the function → modifiers run → body executes reading/writing storage, using memory/stack, possibly calling other contracts → emits events → returns data, or reverts (all state changes undone, remaining gas returned except for what was used).

Contract lifecycle on-chain: creation transaction runs the constructor (init code) → runtime bytecode stored at the new address → used via calls → (legacy selfdestruct is effectively disabled since Dencun/EIP-6780 except within the same transaction as creation).

Tools used to develop
ToolUse
Remix IDE (remix.ethereum.org)Browser IDE — learning, quick tests
Foundry (forge, cast, anvil, chisel)Rust-based toolkit; tests in Solidity; fast fuzzing
Hardhat (v3)JS/TS toolkit; plugins; Hardhat Network; Ignition deployments
OpenZeppelin Contracts / Wizard / Upgrades plugin / DefenderAudited contracts, generator, proxy tooling, ops
solc, solc-selectCompiler versions
Slither, Mythril, AderynStatic analysis
Echidna, Medusa, Foundry invariant testsFuzzing
Certora, Halmos, SMTCheckerFormal verification / symbolic execution
TenderlyDebugging, simulation, monitoring
Etherscan / BlockscoutVerification, reading contracts
VS Code + Solidity extension (Nomic Foundation/Juan Blanco)Editing