How has Earth's core stayed as hot as the sun's surface for billions of years?

How has Earth's core stayed as hot as the sun's surface for billions of years?