typestar

Language basics

28 steps in 9 sets of Solidity.

Solidity is the language of the Ethereum Virtual Machine: contracts that hold funds and enforce rules once deployed, where a bug is not a ticket but a loss, and every line costs gas someone pays. That discipline shapes the whole dialect — sized integers, explicit data locations, checked arithmetic since 0.8, custom errors over strings, and patterns like pull-payments that exist purely because the adversarial environment demands them.

This tour types the working language through a community orchard cooperative: contract shape and value types, view against pure, constant and immutable, mappings and structs and enums, require and typed custom errors, modifiers, events with indexed topics, payable and the withdraw pattern, data locations, gas-aware loops, inheritance and interfaces and abstract contracts, libraries with using-for, try/catch on external calls, keccak256 fingerprints, the block context, unchecked arithmetic, and the fallback pair. The Encore deploys three complete contracts: the membership roll, an hours-based harvest split, and a one-member-one-vote ballot.

Start this tour

Contracts

Storage

  • MappingsThe key-value store; missing keys read as zero.
  • Structs and arraysBundle fields, then push them into a growing list.
  • EnumsName the phases; walk them in order with a cast.

Guards

Ether & events

Data & gas

  • Data locationstorage persists, memory is scratch, calldata is the call.
  • Loops and gasEvery pass costs gas; bounded arrays keep loops honest.
  • unchecked0.8 checks arithmetic; unchecked opts out where safe.

Composition

The environment

  • The global contextmsg.sender, block.timestamp, block.number: the environment.
  • keccak256The fingerprint of anything, via abi.encodePacked.
  • try/catchGuard external calls that may revert.

Surfaces

  • Getters and tuplespublic state writes its own getter; functions return tuples.
  • fallbackThe catch-alls: fallback for unknown calls, receive for ether.

Encore

The other Solidity tours