A record-breaking estimated 30,000 California medical pot farmers, family, friends and fans swamped Santa Rosa for a gargantuan marijuana festival dubbed the Emerald Cup at the Sonoma County Fairgrounds over the weekend.

The agricultural competition featured more than 1,100 flowers, extracts, edibles and other formulations — a 50 percent increase from last year — battling it out for the title of best in California. Judges spent the past month sampling up to 300 strains each.

“The awards is the highlight of Sunday,” said marketing director Jordan Caballero. “It’s the whole reason why we’re here. It’s everyone’s hard work for the entire year and season coming together and culminating at the cup. ... Walking away with a top 10 finish in the Emerald Cup — people say it’s like winning a Grammy or Emmy in cannabis. It’s a very big deal.”

The cup offered the first major gathering and celebration since California legalized adult-use cannabis with Proposition 64 on Nov. 8. Adults 21 and over can lawfully possess up to an ounce of cannabis flowers, 8 grams of pot extract and grow six plants, regardless of their medical status.

“It’s a big thing. The drug war is over. It’s the end of that. Now we’re fighting for our economic lives and branding,” event producer Tim Blake said.

High-ranking officials such as the state’s chief pot regulator, Lori Ajax; Assemblyman Jim Wood, D-Healdsburg; and Board of Equalization Member Fiona Ma mingled among the throngs at the annual music showcase, expo and competition, which celebrates a billion-dollar bumper crop of medical and recreational pot in the newly legalized state.

Hotels were reportedly sold out for 30 miles in every direction, and attendees flew, drove and bused in from New Jersey, Michigan, Florida and beyond — gifting the region a weekend economic boon measured in the tens of millions of dollars, organizers estimate. Attendees of what was billed as the world’s largest outdoor organic pot contest reported waiting two hours to get in due to lines and traffic.

Santa Rosa activist Pat Bakalian, 68, said she was “amazed and flabbergasted” at the throngs in the fairground. “I never thought it would come this far. I thought it would be underground forever. People are really friendly, they’re mellow. The scale is wonderful.”

Guests to the medical cannabis competition needed a doctor’s note to buy and consume flower buds and baked goods in the sprawling, crowded, roaring cannabis bazaar. But doctors were on hand to rapidly write those notes for $100 each.

In the “medication area,” California’s leading growers and medical collectives handed out free joints and hash to guests who signed up. Patients resupplied on THC-infused mouth drops and skin rubs, buying for friends with medical conditions, or just Christmas shopping. A dull roar, punctuated by coughing, filled the skunky, hazy sky on Saturday.

Sunday was the more mellow day, with partly cloudy skies replacing drizzle. Both guests and vendors seemed fully oriented, credentialed and settled in.

Farmers spent the day in educational panels, learning marketing and branding tips, and studying new state medical and adult-use regulations.

“Everyone here is smiling, passing joints — all these sorts of stuff,” said Emerald Cup judge Swami Chaitanya of Mendocino County. “We bring the mountain down to the city, and the city comes up and plays with us.”

Outside the medication area, huge lines snaked out from food trucks all day long as attendees waited for servings of hot Old Mexico Loco Nachos, Wings & Things, Mission Hill Creamery ice cream and Ultimate Souvlaki.

By contrast, the fairgrounds’ beer gardens were barren, and the Santa Rosa Police Department did not list any significant incidents as of Sunday morning. “We have not had a single notarized police altercation in 13 years,” Blake said.

Jerry Garcia’s daughter Trixie was a celebrity judge and said her marijuana tolerance had skyrocketed. After a while, only the most potent entries stood out, she said. “You kind of maintain a high plateau,” she said. “If suddenly you feel like someone opened a window — it’s doing something.”

Commercial and personal farmers snatched up coveted seeds for next year’s crop, paying as much as $250 for a 10-pack of seeds. Award-winning Colorado seed seller Rare Dankness sold out of much of its stock by Saturday afternoon, with patients paying $80 per pack of seeds.

“They’re asking for ‘one of everything,’ or they come with a list and get five packs of each kind on their list,” said Rare Dankness’ Paul Garrett. “It’s a blast. I look forward to this trip every year.”

In addition to full legalization, California’s medical cannabis industry is in the middle of historic regulations. California Department of Pesticide Regulation’s Brian Leahy warned growers during a Saturday panel that a reckoning was coming for the state’s tainted marijuana supply chain.

“If we enforce the law like we do for carrot growers, the industry would be shut down. It’s amazing,” he said. “You need to understand the (regulatory) world you’re entering. It’s very intense.”

Historic draft regulations for California pot will be publicized in the first quarter of 2017, said Ajax, the Bureau of Cannabis Regulation head. The state isn’t waiting for direction from the incoming Trump administration, because state deadlines mandate the release of license applications and licenses for the industry.

“We’ve got to keep moving. Time is not on our side,” Ajax said. “We’ve just got to see what happens with the new administration.”

The Emerald Cup started as a harvest party and friendly contest on a private lot in Mendocino County in 2003. Farmers back then didn’t list their names and accepted awards in disguise, Chaitanya said. The event grew exponentially, keeping pace with the rise of support from the medical industry and the movement for recreational legalization. It moved to the Sonoma County Fairgrounds in 2013.

Chaitanya predicts that with the spread of legalization across eight states and Washington, D.C., the cup’s growth “is going to be exponential. It’s going to keep spreading out.”

“It’s like Harry Potter,” he said. “We’re the wizards, and now we’re trying to share with the muggles.”

Chronicle correspondent

Max Savage Levenson contributed to this report.