The Earth's core: an approach from first principles