Chapter 4
Solidity Basics
Solidity is the language most beginners use to write Ethereum contracts. Its syntax feels familiar to JavaScript developers, but its purpose is different: define state, expose functions, and describe what should be logged on chain.
State variables live in storage, which means they survive after a transaction ends. Functions define behavior, from simple reads to complex token swaps or voting flows. Events do not change state, but they help wallets and dashboards understand what happened.
Solidity also includes types, control flow, and error handling, but these three contract parts are the best mental anchor for new readers. They tell you what the contract knows, what actions it permits, and what signals it emits.