Solidity & Smart Contract Development
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
| Version | Year | Notable changes |
|---|---|---|
| 0.1–0.3 | 2015–2016 | Early releases |
| 0.4.x | 2016–2018 | Widely used in the ICO era; constant functions; many legacy contracts |
| 0.5.0 | 2018 | Explicit data locations, address payable, explicit visibility required |
| 0.6.0 | 2019 | virtual/override required, receive()/fallback() split, try/catch for external calls |
| 0.7.0 | 2020 | now removed (use block.timestamp), constructor visibility removed |
| 0.8.0 | Dec 2020 | Checked arithmetic (overflow/underflow reverts by default; unchecked {} to opt out), ABI coder v2 default |
| 0.8.4 | 2021 | Custom errors (error InsufficientBalance(...) — cheaper than revert strings) |
| 0.8.18–0.8.30 | 2023–2025 | User-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:
- Specify — requirements, roles, invariants ("total supply equals sum of balances"), threat model.
- Write — Solidity using audited building blocks (OpenZeppelin).
- Compile —
forge build/npx hardhat compile→ bytecode + ABI. - Test — unit tests, fuzz tests, invariant tests, fork tests against mainnet state; coverage.
- Static analysis — Slither, compiler warnings, linters (solhint).
- Audit — internal review + external audit; bug bounty.
- Deploy — testnet (Sepolia) → mainnet with a script; record addresses; deploy through a multisig where possible.
- Verify — publish source on Etherscan/Blockscout.
- Operate — monitoring (events, Defender/Forta), admin actions via multisig + timelock, incident response (pause).
- 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
| Tool | Use |
|---|---|
| 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 / Defender | Audited contracts, generator, proxy tooling, ops |
| solc, solc-select | Compiler versions |
| Slither, Mythril, Aderyn | Static analysis |
| Echidna, Medusa, Foundry invariant tests | Fuzzing |
| Certora, Halmos, SMTChecker | Formal verification / symbolic execution |
| Tenderly | Debugging, simulation, monitoring |
| Etherscan / Blockscout | Verification, reading contracts |
| VS Code + Solidity extension (Nomic Foundation/Juan Blanco) | Editing |