Chemical history of the Earth's core