Despite their name, fireflies are actually beetles which use an enzymatic reaction involving a chemical compound called luciferin to produce their typical greenish flashing light. As well as possibly warning predators about their toxicity, it is thought the main purpose of their flashing abdomen is to attract mates.