Compost, the result of household garbage and food leftovers being allowed to break down in dirt, is great for gardens, but all that nutrient rich material needs something to help it along. That's where the lowly earthworm comes in. Earthworms literally eat trash and digest it and it's the chemistry of this process that creates compost. Earthworms secrete calcium carbonate when they digest anything, and this balances out levels of CO2. Four key enzymes, amylase, pepsin, lipase and cellulase all of which are involved with digesting a different substance. In earthworms, the key player is cellulase, which breaks down all the fiber in the branches and leaves they eat.
In addition to the ability to break down fibers, earthworms also have drillodefensins, molecules that allow them to digest plants with polyphenols, which are toxic to most insects and other dirt dwellers. Like any creature, what they take in, has to come out at some point. Earthworms, after consuming and chemically converting all the ingredients in the average garbage pail, will excrete castings, a nicer sounding name than 'worm poop." These castings are chock full of nutrients that can sustain plants and crops. Without earthworms the cellulose present in most garbage could not be chemically broken down.