Electrolysis of aqueous ionic compounds