The mucus secreted by the bacteria collects grains of sediment, and they are stuck together with calcium carbonate, also from the bacteria. This builds up into the structures seen in certain sea-shore bays. Cyanobacteria use water, carbon dioxide, and sunlight to create their food, and expel oxygen as a by-product.