Cobalt phosphide changes its surface as it makes hydrogen, helping the catalyst stay active and avoid damage. The finding could guide cheaper, durable catalysts for clean hydrogen production.