The funding transaction
Alice and Bob open a channel by creating a 2-of-2 multisig output on-chain. Before it is broadcast, each holds a signed commitment transaction spending that output back to the two of them in the initial balances, so neither can trap the other's funds.
Commitment transactions
Every channel state is a pair of commitment transactions (one held by each party, asymmetric) that could be broadcast to close the channel at the current balances. Updating the state means exchanging signatures on a new pair. Each party's version pays the other party immediately and pays itself only after a delay (a relative timelock), which creates the window for punishment.
Revocation
When a new state is signed, each party reveals a revocation secret for the previous state. With that secret, the other party can spend the delayed output of the old commitment, taking all channel funds. So if Alice later broadcasts an old state where she had more, Bob has the delay period to notice and claim everything. Broadcasting an old state is never profitable, which is what keeps both honest.
Closing
- Cooperative close: both sign a transaction paying the final balances with no delays. Cheap and immediate.
- Force close: one party broadcasts their latest commitment. Their funds wait out the delay; the other's are available at once. Used when the partner is offline or uncooperative.
- Breach: an old state is broadcast and punished.
What you are trusting
Nothing about honesty. You are trusting that you (or a watchtower) will be online during the delay to catch a breach, and that the chain is not so congested that your penalty transaction cannot confirm in time. Those are the real risks, and they are engineering problems, not counterparty ones.