Dear Student,
There are no samples of the Earth's core available for direct measurement, as there are for the Earth's mantle. Information about the Earth's core mostly comes from the analysis of seismic waves and the Earth's magnetic field. The inner core is believed to be composed of an iron-nickel alloy with some other elements.
The magnetic field of the Earth is generated by electric currents due to the motion of convection currents of molten iron in the Earth's outer core: these convection currents are caused by heat escaping from the core, a natural process called a geodynamo.
Regards