Nanostructured ionic compounds have driven major technological advancements in displays, photovoltaics, and catalysis. Current research focuses on refining the chemical composition of such compounds. In this study, a strategy for creating stoichiometrically well-defined nanoscale multiple-cation systems, where the atomically precise structure maximizes the synergistic cooperation between cations at the atomic scale is reported. The unprecedented construction of Heusler-type PtRuP2 double-walled nanotubes through sequential anion/cation exchange reactions is demonstrated. The PtRuP2 catalyst exhibits record-high catalytic performance and durability for the hydrogen evolution reaction (HER) in alkaline electrolytes and anion-exchange membrane water electrolyzers. The investigations highlight the crucial role of Pt/Ru dual centers, providing multiple active sites that accelerate the HER kinetics within a single phosphide material, in the sequential operation of H2O activation/dissociation at Ru and H2 production at adjacent Pt sites. These findings open new avenues for optimizing ionic compound-based HER electrocatalysts, offering platinum-metal alternatives in acidic and alkaline media.