Atom-dispersed copper and nano-palladium in the boron-carbon-nitrogen matric cooperate to realize the efficient purification of nitrate wastewater and the electrochemical synthesis of ammonia.