On a sunny morning in San Francisco's Mission District, half a dozen men and women scoot around a tiny chocolate factory, wrapping bars, checking temperature settings, sorting beans. Cacao beans that have been fermented, dried, roasted, shelled, and ground tumble with sugar in a row of shiny metal mixers. After three days of gentle mixing, the buttery smooth results will be transferred to a tempering machine to shape the cacao’s natural fat molecules into stable crystal structures.

Related Content The First Name In Recorded History Belongs To An Accountant

This is the home of Dandelion Chocolate, a small-batch chocolate maker founded in 2010 by two former tech entrepreneurs. The tools and flavors have changed, but the work of roasting and grinding fermented cacao beans, and mixing them with a few simple ingredients to create a divine food, is a practice that goes back to early Mesoamerican civilizations.

The Olmecs of southern Mexico were probably the first to ferment, roast, and grind cacao beans for drinks and gruels, possibly as early as 1500 B.C., said Hayes Lavis, a cultural arts curator for the Smithsonian’s National Museum of the American Indian. “There is no written history for the Olmecs,” he said, but pots and vessels uncovered from this ancient civilization show traces of the cacao chemical theobromine.

“When you think of chocolate, most people don’t think of Mesoamerica. They think of Belgian chocolate,” says Lavis. “There’s so much rich history that we’re just beginning to understand.

In their raw state, plucked from tangy-sweet, gummy white flesh lining a large pod shaped like a Nerf football, cacao seeds are bitter and unrecognizable as chocolate to a modern American palate. “How would you think to take the seed, harvest it, dry it, let it ferment, and roast it? It’s not something you would normally think to do,” Lavis said. Perhaps, one theory holds, someone was eating the fruit and spitting seeds into the fire, and the rich smell of them roasting inspired the thought that “maybe there’s something more we could do with this.”

The naturally bitter flavor of cacao came through at full strength in early Maya recipes. “This was before they had really good roasting techniques, before they had conching, which is a step that mellows out the flavors, before they started looking at genetics,” says Dandelion co-founder Todd Masonis.

“Rarely did they add any sweetener — once in a while honey, but mainly to try to ferment it,” says anthropologist Joel Palka, of the University of Illinois at Chicago. A variety of herbs were on hand, however, for seasoning cacao-based food and drink. “There were literally dozens of things that would be used to flavor it,” says Lavis, ranging from chili and vanilla to magnolia.

In traditional preparation methods, which are still used by some small-scale producers, farmers take seeds out of the pods, ferment them in a leaf-covered pile. In more modern methods, the seeds are fermented in raised wooden boxes that enable aeration, drainage, and more consistent results. Dandelion acquires beans that have been fermented for several days and then dried. While the company pours dried beans into a modified coffee roaster carefully calibrated for each type of bean, traditional cacao roasters would have simply placed beans on a fire. “They'll get almost burnt,” Masonis says.

Cacao figured into pre-modern Maya society as a sacred food, sign of prestige, social centerpiece, and cultural touchstone. “You would have to get together to prepare the chocolate,” Palka said. “It's the whole social process.” Around Chiapas, Mexico, Palka co-directs an archaeological project focused on Maya culture on the frontier of the Spanish empire. To this day, he encounters people in the area who grow chocolate as a family tradition and cultural practice. “Like coffee in the Arab world, or beer in northern and Eastern Europe, it's not only something that's good, but part of their identity,” he says.

Cacao drinks in Mesoamerica became associated with high status and special occasions, Palka said, like a fine French wine or a craft beer today. Special occasions might include initiation rites for young men or celebrations marking the end of the Maya calendar year.

After the Olmecs, the Maya of Guatemala, Yucatan, and the surrounding region incorporated cacao seed into religious life. Paintings recovered from the time show cacao in mythological scenes and even court proceedings. In the early 12th century, chocolate was used to seal the marriage of the Mixtec ruler 8 Deer at Monte Albán, a sacred site in the Valley of Oaxaca. “It’s one of the few food crops that was used as a dowry or part of [wedding] ceremonies,” Lavis said. Early records of Maya marriages in Guatemala, he added, indicate that in some places, “a woman would have to make the cacao and prove that she could make it with the proper froth.”

“When they had to communicate with their gods related to nature, rain, and the fertility of the earth, I'm sure they were pulling [cacao] out and drinking,” Palka said. Many vessels uncovered in the ruins of Maya buildings and burial sites have cacao residues in them, Palka said. “A lot of cacao pots were buried with people,” he said, but it is unclear whether people were simply buried with their dishes, or if these pots were involved in funeral ceremonies.

Around Chiapas, Palka said, residents prepared chocolate drinks as offerings for gods related to nature as recently as 1980. “It was something that people enjoyed,” he said, “and so they knew their gods enjoyed it, too.”

In addition to its loftier role in ritual and celebration, cacao also served decidedly material functions in some early American civilizations. Cacao beans were used as currency, and the seeds were so valuable that it was evidently worth the trouble to counterfeit them. At multiple archaeological sites in Mexico and Guatemala, Palka said, researchers have come across remarkably well-preserved “cacao beans.” “Then they touch them, and they're clay,” he says. The clay beans may have been passed off as money, Palka says, or substituted for real cacao in rituals. Aztec rulers accepted cacao as tribute payments, and cacao, like valuables including jadeite and cotton mantles, was commonly exchanged in Maya marriage negotiations at the time of European contact. “Sometime in the 1500s, you could buy a turkey for 100 cacao beans,” says Lavis.

Archaeologist Eleanor Harrison-Buck, however, cautions against distilling cacao’s importance to its economic value as “a form of currency that elites could control and administer as a means of consolidating their power.” Rather, she said, the production, acquisition, and circulation of cacao as a resource among the ancient Maya was grounded in social relations.

“I think that chocolate became so important because it's harder to grow,” compared to plants like maize and cactus, which were used to brew early versions of beer and tequila, respectively. “You can't grow cacao in every region in the Americas,” Palka says. “It requires a certain kind of soil, amount of rainfall, and especially shade because the midges and little flies that pollinate the cacao trees have to live in shade.” As a result, cacao requires an area of limited sun and plenty of humidity.

According to archaeologist Harrison-Buck, an official Spanish account from 1618 describes the Belize River town of Lucu, which had “much thick cacao that turns reddish-brown and tastes good by itself.” Vanilla vines and annatto trees growing nearby were used to flavor cacao beverages. And art recovered from the Maya Lowlands shows cacao as a staple in ancient Maya feasts. The fact that cacao “served as a key cultigen and staple in ritual feasts for numerous Mesoamerican cultures for thousands of years,” Harrison-Buck says, “makes it something particularly important to study and understand in this region.”

But the pollen, fossilized plant tissue, and botanical remains of this important crop do not preserve well, she says, in the wet, tropical environments of the Maya Lowlands where cacao was grown and continues to grow today. As a result, archaeologists know more about the early uses of cacao than they do about ancient methods of producing the bean. “There’s a lot we still don’t know and may never know,” Lavis says.

To better understand how ancient civilizations produced cacao, however, Harrison-Buck and soil scientist Serita Frey have been working in Belize to find out whether cacao orchards leave a distinctive biological footprint in soil. Over the past year, the pair have collected soil in areas where cacao is currently grown in eastern Belize, and begun analyzing it in Frey's lab. They've also sampled soil from floodplains adjacent to ancient Maya sites, and from lands that supported cacao in colonial times.

“We know that when the Spanish arrived in the 16th century, the Maya planted cacao trees right on the riverbanks,” says Harrison-Buck. At these humid, biologically diverse sites littered with fallen leaves, the scientists often hear birdsong in the morning. Troops of howler monkeys swing, cry, and feast in fig trees that grow along the river and provide the shade that cacao trees need to thrive.

According to Harrison-Buck, the team has successfully uncovered evidence of a theobromine signature, but the signature is difficult to consistently isolate from older orchard sites. Eventually, by comparing chemicals in soil from these various sites, they're hoping to map out the molecular signposts that indicate ancient cacao cultivation, and reconstruct where cacao was produced in the Belize Valley in historic or even prehistoric times.

Chocolate is often said to have been seen as an ancient medicine and aphrodisiac. Cortez wrote to King Carlos I of Spain of “xocoatl,” a drink that “builds up resistance and fights fatigue.” And one officer serving Cortez reportedly observed the Aztec ruler Montezuma drinking more than 50 cups per day of a frothy chocolate beverage mixed with water or wine and seasonings including vanilla, pimiento, and chili pepper.

But according to Lavis, some of these tales are likely overstated: “I don’t think any living person could drink 50 cups of cacao.” The Spanish also probably attributed medical benefits to chocolate that the Maya didn’t—instead, cacao was simply part of Mayan life. “I think it was just part of their diet, and they knew it was good for them,” Lavis said.

“When you have something that people drink for ritual, people think it's good for you,” Palka said. “I would categorize it with eating maize: you have to eat it to sustain your body and your self and your soul. Chocolate fits clearly into that.”

SPICY CHOCOLATE DRINK RECIPE FROM JOEL PALKA

Put 3 tablespoons of ground cocoa in a mug and fill it with hot water. Cut up your favorite kind of chili (Palka recommends poblano for a slightly spicy, smoky flavor or habanero for extra spice. Drop the chopped chili into the liquid and stir. “If you really want to appreciate the chili, chop it up finely so it will float,” Palka says. For less heat, use bigger pieces, which will sink to the bottom. “It’s more of an aftertaste.” For a more bitter drink, Palka adds two chocolate beans, dry and chopped. To sweeten, add two teaspoons of sugar.