When Cameron and Tyler Winklevoss, the twin brothers who famously feuded with Mark Zuckerberg over the creation of Facebook, attended a 2012 meeting about Bitcoin, they expected a professional overview of investment opportunities in the new cryptocurrency.

What they got was a 22-year-old Orthodox Jewish stoner living in his parents’ Brooklyn basement.

Charlie Shrem was the founder of BitInstant, one of the first firms to buy Bitcoin for clients. In his Midtown office, with weed paraphernalia on every shelf, he kept three bongs on his desk — and was toking from one as he met the millionaires.

“Welcome to the ‘Bakery,’ gentlemen,” said Shrem, according to the new book by Ben Mezrich, “Bitcoin Billionaires: A True Story of Genius, Betrayal, and Redemption” (Flatiron Books), out Tuesday.

“If these walls could talk — well, they’d sound pretty f–ked up. There’s been a lot of secondhand smoke in this room.”

Shrem’s pitch: The Winklevosses could become two of the burgeoning phenomenon’s premier investors. The brothers bit, investing $800,000 in BitInstant in exchange for 22 percent of the company.

They quickly became the world’s top buyers of Bitcoin — so much so that they drove up the price and eventually became the currency’s first billionaires in 2017.

Shrem, however, would end up burned by his own hubris.

The day the three met, BitInstant was selling three out of every 10 Bitcoin and the currency was trading at $7.43 a coin. By early 2013, Bitcoin was going for $100 a pop.

BitInstant was a pioneer in a lucrative field. CEO Shrem was profiled in Bloomberg Businessweek, and became part owner of a Midtown club, EVR, where he held court nightly, downing shots and “making it rain” by throwing cash in the air.

“For the first time in Charlie’s life, people listened to him, and he had discovered that was a high on a par with [marijuana],” Mezrich writes.

The new millionaire was finally able to escape his parents’ basement — he moved upstairs from the club — and began dating an EVR waitress, Courtney Warner, who was a head taller than Shrem and, Mezrich writes, “way out of his league.”

On their first date, Shrem slammed shots of Bacardi and threw up all over Warner.

“When he’d gone to the bathroom to clean himself up,” Mezrich writes, “he’d assumed she’d be racing for the door, but [she didn’t]. At that moment, Charlie had known she was the one.”

The partying was affecting his professional life. At a meeting with a venture capitalist, Shrem showed up “barely vertical,” reeking of alcohol, with three shirt buttons opened.

“Charlie launched into his presentation like the Tasmanian Devil,” Mezrich writes. “He’d been almost unintelligible, nonsensical.”

After the meeting, the angry twins told him that maybe he was not the best person to be CEO.

His response: “Sometimes you guys can be such suits.”

Shrem was not only CEO, but also chief compliance officer, which would prove to be his downfall.

Though a finance and economics graduate of Brooklyn College, he had never educated himself on laws governing US money transmission.

BitInstant had a $1,000 daily limit on Bitcoin purchases, but a user known as BTCKing regularly tried to bypass this, attempting to buy $4,000. Shrem relented — something a good compliance officer would not have done — and BTCKing became one of BitInstant’s biggest customers, eventually spending some $900,000.

In January 2014, Shrem, returning from meetings overseas, was accosted at JFK Airport by 15 agents from the IRS, FBI, DEA, NYPD and more. He was charged with conspiracy to commit money laundering, failure to file a suspicious-activity report, and operating an unlicensed money transmitter.

The Bitcoin BTCKing bought had been used for illegal drug purchases. Shrem was facing 25 years in prison.

Shrem was released on bail on the condition he had a stable place to live. So it was back to the basement.

In 2015, he struck a plea deal and was sentenced to two years in prison. Released after a year, he and Warner married and moved to a boat off the coast of Florida.

Last November, the Winklevosses sued Shrem, claiming he shorted them out of 5,000 Bitcoin they had paid him to purchase for them. Shrem denied this, and in February the brothers were ordered to pay him more than $45,000 in legal fees. Last month, both parties settled the suit under confidential terms.

Shrem, now 29, hasn’t strayed too far from his passion with his latest business venture, the cryptocurrency-information Web site Crypto.IQ.

As he told the court before his sentencing: “Bitcoin is what I love and all I have. It’s my whole life. It’s what I’m on this Earth to do … it ­allowed everyone to be equal.”