  We use the theory of Kolyvagin systems to prove (most of) a refined class
number formula conjectured by Darmon. We show that for every odd prime $p$,
each side of Darmon's conjectured formula (indexed by positive integers $n$) is
"almost" a $p$-adic Kolyvagin system as $n$ varies. Using the fact that the
space of Kolyvagin systems is free of rank one over $\mathbf{Z}_p$, we show
that Darmon's formula for arbitrary $n$ follows from the case $n=1$, which in
turn follows from classical formulas.
