Purifying of copper using electrolysis