The inner core is a solid made out of heavy materials like iron and nickel. Even though the core is very hot, these materials do not melt very easily. As long as there is high pressure, the core can stay solid despite the temperature. Gravity pulls stronger on denser materials, denser materials are at the center of things, so therefore the middle of our earth is solid.