Here's a breakdown:
* Outer Core: This liquid layer, mostly composed of iron and nickel, is constantly moving due to convection currents. The movement of these molten metals generates electric currents.
* Inner Core: This solid sphere, also primarily composed of iron and nickel, is incredibly hot but under immense pressure.
* Magnetic Field Generation: The electric currents in the outer core create a magnetic field that extends far out into space, forming the magnetosphere.
Think of it like this: the Earth's core is like a giant dynamo, with the movement of molten metal acting as the generator. This magnetic field acts as a shield, protecting us from harmful solar radiation and charged particles from the sun.