Around 4 billion years ago, water and two poisonous gases, methane (CH4) and ammonia (NH3) was released from volcanoes.
At 3.8 billion years ago, photochemical reactions occurred among methane, ammonia, and water vapor that was triggered from solar energy. As a result, nitrogen (N2), hydrogen (H2), and carbon dioxide (CO2) was formed. The methane and ammonia were broken down, but water vapor remained.
With methane and ammonia molecules being broken down 3.6 billion years ago, hydrogen and oxygen (O2) were released into the air.
At around 3.5 billion years ago, the element hydrogen was able to escape Earth's gravitational pull because it was so light, leaving nitrogen with the greatest abundance along with water vapor and carbon dioxide.
Water vapor eventually encountered solar energy, and more chemical reactions occurred. The water vapor was broken down into oxygen and hydrogen, which also was too light for Earth's gravity. The oxygen underwent reaction with each other and formed ozone (O3). Soon, the level of ozone increased in the atmosphere, and a layer 30 km above the Earth's surface formed called the ozone layer.
The ozone layer absorbs most of the ultraviolet radiation from the Sun, shielding organisms. Before there was an ozone layer, the only living things on Earth were microorganisms, which were way below the ocean's surface to protect them from ultraviolet radiation. These microorganisms are also part of anaerobic life, and are karyotes.
At 700 million years ago, microorganisms began to appear near the surface of the ocean and eventually on land. The blue-green bacteria, or cyanobacteria, used the sunlight's energy to combine carbon dioxide and water to produce food, and release oxygen as a byproduct. This is called photosynthesis.
Instead of forming high in the atmosphere like the ozone layer, oxygen stayed near the surface of the Earth. Later, animals would breath this gas, which is aerobic life, and the blue-green bacteria would be joined by green plants. This then lead to high increase in oxygen. These plants and animals breathing in oxygen are eukaryotes.