UTxO Model
Cardano's ledger is a set of unspent transaction outputs (UTxOs). A transaction consumes some UTxOs (inputs) and produces fresh ones (outputs). That's the entire state model. There's no global "account balance"; "balance" is just the sum of UTxOs you can spend.
Validators 101
A validator is a function (context) -> void | fail that the Cardano ledger calls when a UTxO is spent, a token is minted, or a similar event happens. If the call returns, the action is allowed; if it fails, the action is rejected.
Datum & Redeemer Flow
Validators in Pebble communicate with their off-chain partners through two channels: the datum (per-UTxO state) and the redeemer (per-action intent). Understanding which goes where, and when, is the difference between code that "compiles" and code that actually validates the transactions you intend.