Once, this thriving orb that is our home was an inhospitable ball of molten lava. A catastrophic collision around 4.5 billion years ago blew what existing atmosphere early Earth had into space, forming our Moon and for a time, melting our entire planet.

How our current atmosphere then became so unlike anything else in our Solar System, has been an enduring mystery. Some have speculated it was due to Earth having a distinct initial composition, perhaps because some parts of the inner planetary embryos came from the outer regions of the Solar System. Others suspect Earth's subsequent evolution allowed it to form an atmosphere that could birth life.

Now scientists have used chemical reactions recorded in ancient rocks and levitating lava balls in the lab to work out our atmosphere's earliest incarnation.

Our planetary neighbors both have carbon dioxide (CO2) rich atmospheres with a sprinkling of nitrogen (N2), which is very different from 4.54-billion-year-old Earth's current nitrogen-oxygen (N2-O2) dominated air, despite all the inner planets forming in much the same way.

A team of researchers led by ETH Zürich geochemist Paolo Sossi recreated balls of molten lava – mini early Earths – in the lab out of common mantle rock called peridotite. They floated these lava balls in different streams of chemical gases that Earth's atmosphere may have once been composed of.

"Four-and-a-half billion years ago, the magma – the molten rock that now lies beneath the Earth's crust – constantly exchanged gases with the overlying atmosphere," Sossi explained. ​"The air and the magma influenced each other. So, you can learn about one from the other."

After the team laser heated the mini Earth's in their streams of different 'atmospheric' gases until it became molten lava at nearly 2,000°C (3,632°F), they rapidly cooled them. The resulting marble-sized glass spheres caught a record of the 'atmosphere' they were in, just as Earth's mantle would have long ago.

Iron bonds to oxygen differently depending on the concentration of its exposure. When there isn't much oxygen it will bond one iron atom to one oxygen atom, but when there is plenty of oxygen it will bond in a 2:3 ratio. Comparing their experiments with actual rock samples formed on early Earth, Sossi and colleagues concluded the oceans of melted Earth breathed out our planet's early atmosphere of CO2 and N2.

"When you have an atmosphere produced from magma at the right oxidation state, you get one made up of about 97 percent carbon dioxide and 3 percent nitrogen once it cools down, the same ratio found today on Venus and Mars," Sossi explained.

Life-forming amino acids would not form very easily in this combination of atmospheric chemicals.

But then, unlike its neighboring planets, Earth became a water-world.

Venus's water was likely almost entirely lost during its early evolution, thanks to its nearness to the Sun, and Mars's water was likely trapped into ice caps before the planet was 3.8 billion years old because it was too far.

"The prolonged presence of surface water on Earth is key to the subsequent development of its atmosphere," the team wrote in their paper.

They suspect this ocean of salty water slurped the CO2 from the atmosphere, allowing our planet's plate tectonics to digest and deposit it into Earth's crust and mantle. Earth's mass and perfect position from the sun allowed our planet to retain liquid water long enough to change the entire atmosphere. This began Earth's rather tempestuous relationship with an oxygen atmosphere that paved the way for life.

Their research was published in Science Advances.