The formation of the solar system
When our star forms, its immense gravitational pull sucked 99.99% of all the matter in the solar system. Our sun formed over the course of about 100,100 years in what called Solar Nebula. Then the nebular compress to a star, probably triggered by nearby supernova. Mercury, Venus, Earth and Mars it's cold enough for volatile gasses to hang around and even become liquids and solids. That's why the inner planets like us are rocky, and the outer planets, Jupiter, Saturn, Uranus and Neptune are these humongous gas giants. Pluto don't act like a planet. So...
At first, the earth is a molten ball. The heave elements sank to the core. And the lighter elements like silica form the mantle. Light element floated and form the crust. "HADEAN ERA"
Some day, the earth get crashed. The debris clumped together and became the Moon.
As the earth cool down, the water vapor accumulated in the atmosphere fell into torrential rains. The downpour lasts millions of years, which created the first ocean about 3.8 billion years ago.
The Plate Tectonics.