“When I first got into this, I’d have to explain what it was because no one would have any idea,” says Jason Klein, as he sips tea at a cafe in the Ozarks on a cold winter day. “Now it seems like I could walk up to almost anyone in this room and they’d know.”

Klein, a small business owner who lives in Nixa, Mo., is talking about bitcoin, a sensational invention that recently turned his life upside down. His story — involving undercover federal agents, courtroom drama and a community’s outpouring of support — is one he hasn’t shared until now. The tale highlights how entrancing this new technology can be, as well as the legal confusion surrounding cryptocurrencies like bitcoin: digital tokens that are minted, essentially, by computers doing puzzles.

These days it seems like everyone has gone bananas about cryptocurrencies, which many refer to as crypto (despite the grumblings of prescriptivists). Investors in Silicon Valley are obsessing over the technology that underpins these tokens, known as blockchain; crypto-related startups and hedge funds are popping up one after the other; regulators around the world are on high alert, as cryptocurrencies become more interwoven with financial systems. As prices have soared (and plummeted) over the last year, the fever has spread to America’s living rooms too, where regular people are running up credit card debt to invest in something many of us don’t really understand.

“It’s been crazy,” Klein says of the hype and what happened to him after he got hooked on bitcoin. “When you see something like that explode, go from – when I got involved – $14 apiece to over $14,000 apiece, that’s going to show up on people’s radars, whether it’s a bubble or not.” That includes the radar of the U.S. Attorney’s Office in the Western District of Missouri.

It’s hard to imagine Klein behind bars. Sitting in this strip-mall coffee shop in Springfield, Mo., the 38-year-old gives off the vibe of a patient high school teacher. Hailing from a small Kansas town, Klein describes himself as a tinkerer who got into tech in high school, back in the dial-up Internet days. Educating himself in basements and garages, he built his first computer at age 14 and learned about programming alongside other local enthusiasts. At 21, he started his first tech company, which helped link the various locations of a non-profit fighting drug and alcohol abuse throughout the state. (Klein says he still has a plaque from the organization, thanking him for “launching them into the 21st century.”)

That company, Datility, is one of two small businesses that he currently owns. It continues to provide internet hosting services to clients in Kansas. The other, a firm called Logic Forte, helps restaurant owners with analytics and currently serves about 300 restaurants across 19 states.

Like many tech guys, Klein has a history of adopting promising innovations before the masses, and his curiosity is often piqued as he tries to spot the next big thing. So he paid attention when online circles started buzzing about bitcoin in the years following its launch in 2009. An anonymous coder known as Satoshi Nakamoto created software that slowly brings digital tokens into existence, through a process known as mining, and allows people to exchange them electronically. Harnessing cryptography and mathematics, the system provided a way for two strangers to trust each other in such transactions without requiring some middle man — like a bank — to oversee their dealings.

Technology known as a blockchain keeps a public account of how much bitcoin everyone has (though individuals’ identities are concealed behind long strings of numbers and letters), so people cannot spend bitcoin that they do not possess. The upshot is that, in theory, bitcoin could function like dollars or Euros, stores of value we all trade for goods and services, while cutting out governments and fee-charging financial institutions. Especially because Nakamoto capped the amount of bitcoin that could be created, the digital tokens are also able to function like stocks, assets that rise and fall in value depending on what the market is thinking. Today, bitcoin is just one of many digital “coins” in existence.

When he first read about the innovation, Klein had a common reaction: he thought the underlying tech was “genius” but saw the tokens as more of a concept than a currency because so few people were using them. Then, one day in early 2013, he came across an online TV guide-type service that was actually accepting bitcoin as a form of payment. That made the experiment feel real.

Klein decided to buy $100 worth. Poking around, he found few easy options for purchasing the tokens and ended up mailing off a money order to an exchange based in Atlanta. “It was play money as far as I was concerned,” says Klein, who had by this time moved to Missouri, married his wife, Pam, and adopted a daughter. “It was no different than saying ‘I’m going to take a hundred bucks to the casino.’” By mid-2013, that gamble looked pretty good: the seven bitcoins he had purchased had soared in value and were suddenly worth about $1,000. Seeing this as a “first wave of legitimacy,” Klein bought more, using the same means of plopping a money order in the mail and waiting for the exchange to turn his U.S. dollars into bitcoins that he kept in a virtual wallet.

Klein felt the process was inefficient and he started sniffing around for better ways to buy and sell, which is how he found a site called localbitcoins.com. The platform allowed him to locate nearby people who would meet up in person to do a trade. Klein posted an ad on the site, offering to sell bitcoins for cash plus a roughly 10% fee. Over the next couple years, Klein says he made a few trades a month, netting a few thousand dollars in fees each year. But he says he was at least as interested in the meet-ups as the profits, seeing each trade as an opportunity to act as a bitcoin evangelist, and to learn about what led others down the rabbit hole.

If you’ve ever met someone who is into crypto, you have probably found that they love nothing more than to talk about crypto, to debate its ability to upend financial systems and discuss which coins have more potential. Klein met students doing research papers and investors looking to make some dough in an increasingly hot market. One man wanted an easier way to hire and pay overseas software developers and had been drawn to bitcoin because it is borderless, unlike the U.S. dollar. “It was exciting,” Klein says, “because it felt like other people are starting to get involved.” A currency needs to be widely adopted in order to work, however revolutionary it might be in theory, and Klein felt like he was helping to usher along the adoption process, in a part of the country that was just starting to take notice.

One day in 2015, Klein met someone he would come to view as a “weird guy.” To some extent, being weird is par for the course when your universe is individuals who are really into bitcoin. “Sometimes they’re super nerdy. Sometimes they’re very anti-social. Sometimes they’re very anti-government,” says Klein, sitting in an armchair at the coffee shop and occasionally refilling his cup of tea. Yet this would prove to be uncharted territory.

Referenced in court documents only as “Undercover Agent #1,” the guy seemed normal enough at first, Klein says: He presented himself as a business person, someone fascinated with bitcoin and wanting to learn more. They met at an Einstein Bros. Bagels shop and Klein sold him $1,000 worth of bitcoin, making his usual commission of about 10%. Then the guy asked if he could bring in a business partner who also wanted to understand what this bitcoin business was all about. “Unbeknownst to me,” Klein says, that person was Undercover Agent #2.

The U.S. Attorney’s Office in Missouri’s Western District declined multiple requests to comment for this article, including answering questions about why Klein was targeted in an undercover operation. Court documents show that Klein met with these two federal agents on several occasions over the next year and a half. “I enjoyed meeting with them,” he says. “I loved talking about bitcoin.” But he says the agents also pushed him to do bigger trades, wondering if he could sell them up to $10,000 worth of bitcoin. “I said, ‘I’m not your guy. It’s a hobby for me,” Klein says, emphasizing that the money he earned from trades generated a small amount of his annual household income. (He estimates it at about 3%.)

Yet Klein continued to meet with them, and as the value of his bitcoin grew, he did do bigger trades. He also offered to introduce them to another seller he had met through the website. According to the documents, he conducted five trades with the agents in total. On his own, he sold them up to $7,640 worth of bitcoin, and in one trade conducted with a second seller who is unnamed in the official record, the two sold them $15,000 worth. Klein made $2,122.68 in fees from these trades, according to the documents.

Federal information filed by the U.S. Attorney in the Western District of Missouri.

During one meeting these contacts suggested they would use the bitcoin to buy “Girl Scout cookies,” a reference to drugs that Klein says he didn’t understand at the time. Then, one day in late 2015, he met them to do a trade and afterward the pair outright said they were going to use the digital tokens to buy cocaine, suggesting they were drug dealers.

Klein says he found the suggestion unbelievable and wondered if his contacts were trying to impress him. “I just would never peg them for drug dealers,” says Klein. “I never saw drugs. I never felt like I was in harm’s way. The only thing I saw that would have been a side effect of that was the cash.”

In hindsight, he says, he should have known better; he should have walked away and cut off contact. Klein says he did stay away for some months, feeling weirded out. But eventually he met with the undercover agents again and did another trade. It was summer 2016. “And the next Monday morning at 7 a.m., they were on my front doorstep with like seven or eight black SUVs,” says Klein, recalling how he agonized over what his neighbors must be thinking.

At first, Klein didn’t understand why agents wearing badges that identified them as part of the Internal Revenue Service’s Criminal Investigation division had showed up at his house. Then he saw the word bitcoin in the search warrant they handed him, and he put everything together. The weird guys. The trade he had done the week before. He says the agents were professional, waiting until his 9-year-old daughter was safely out of the house before they started sifting through the closets and taking tech equipment. “I honestly think that they expected to find hundreds of thousands of dollars or something,” he says, “like I was some bitcoin kingpin.”

Klein wasn’t arrested or immediately charged with any crimes, but in the wake of the search he says he was presented with a list of potential violations that the government might bring before a grand jury. It included serious offenses like money laundering, which alone can carry a sentence of 10 years or more in prison, according to Bureau of Justice Statistics. “With the family and business and everything, I couldn’t even comprehend that,” Klein says. “Obviously I erred in continuing to meet with those guys, but I never felt like I was doing anything wrong.”

Months of negotiating began. The Kleins refinanced their home and depleted their savings, anticipating that they would go to trial and be saddled with as much as $150,000 in legal fees. Klein also sold much of the bitcoin he was holding to foot the bills, he says. At the time, each token was worth about $642. By the end of 2017, those same tokens would fetch nearly $20,000 apiece. “So that sort of stinks,” he says.

Klein recalls agents carrying around a picture of a device known as a hardware wallet when they searched his house. To him, that was a sign of how new they were to the world of bitcoin. In general, the case law regarding cryptocurrencies is “early and inconsistent,” says Angela Walch, an associate professor at St. Mary’s University School of Law in San Antonio, whose research focuses on the intersection of governance and emerging technologies.

Klein got caught in the crosshairs at a time when regulators, law enforcement and Congress are all scrambling to catch up with the implications of the cryptocurrency boom, including how officials might control digital tokens that have no physical existence and were designed to sidestep traditional financial institutions.

While criminals have turned to this hard-to-trace form of payment for nefarious reasons, investors are heralding the underlying technology as “the new Internet.” In court documents in Klein’s case, the government said that while bitcoin is not illegal in itself and has legitimate uses, it is also “ripe for use as a financial tool within criminal enterprise.” Klein’s lawyers, in turn, quoted legendary venture capitalist Marc Andreessen, who once wrote that, “Bitcoin at its most fundamental level is a breakthrough in computer science.”

Jason Klein demonstrates how he would typically check for counterfeit bills during a cryptocurrency transaction, on Feb. 28, 2018. Klein typically did trades of bitcoin for cash in person, often chatting about bitcoin over a meal or coffee as both parties waited for the electronic transfer to complete. Klein would often keep the commission he made for the trade but use the bulk of the cash to purchase more bitcoin, thus replacing what he had just sold and keeping enough on hand to do more trades. Barrett Emke for TIME

Regulators are increasingly focused on the risks that accompany this disruption. Today, cryptocurrencies are being traded on unstable exchanges; many believe that coins’ fast-rising values are part of a bubble that will eventually pop. The tokens could be stolen by hackers and thieves, and consumers have limited recourse when things go wrong. There are fears that terrorists, as well as drug traffickers, will fund their enterprises with digital coins.

All that puts the government in a tricky position, Walch says. On one hand, the government has an imperative to protect consumers and the financial system at large. On the other, regulators “want to let this innovation that could be important flourish,” she says, and have been loathe to stifle crypto with burdensome rules.

Experts say it is not clear how much authority the U.S. government has to regulate these stateless, decentralized financial instruments. Several federal agencies have released guidance, outlining legal views and concerns. But that guidance is “not necessarily an image of clarity,” says Andrew Hinkes, an attorney who is teaching a class about crypto at New York University. The likes of the Securities Exchange Commission and the Commodity Futures Trading Commission, which recently testified about cryptocurrencies before Congress, are still finding their footing.

Authorities are trying to figure out how to wield old laws and powers in this brave new world and identify gaps that might require Congress to pass fresh statutes, in a time when the language used to talk about the technology is still far from settled. “What you’re seeing right now is the attempt to implement the law as it exists,” Hinkes says, “and there will be areas where it doesn’t make sense or it’s impractical.” The nature of crypto makes consensus difficult: a circuit court judge in Florida, for instance, determined that an individual targeted in a sting similar to Klein’s couldn’t be convicted of money laundering, because, in her view, bitcoin wasn’t money. (Judges elsewhere have ruled that it is.)

David Yermack, a finance professor who is co-teaching with Hinkes at NYU, says that even if everyone agreed how much authority the government has to regulate cryptocurrencies, the practical challenges of enforcing the law would be enormous, since much of this activity is happening offshore and in the cloud. Yermack says it’s “almost comical” to see the Justice Department going after a relatively small fish like Klein when there are thefts and scams happening that potentially involve millions of dollars worth of crypto. Klein’s St. Louis-based lawyer, Mark Milton, believes prosecutors may have initially thought that pursuing his client was “going to lead to some bigger case.”

Klein starts to sound tearful as he describes the uncertainty that plagued his family as the negotiations wore on into early 2017. He knew he was in a developing legal landscape and wanted to take a stand. He also says he gave the Justice Department “a laundry list” of reasons he didn’t think he was really meeting with drug dealers. Whatever the government might have thought of those arguments, Klein says the prosecutors became more open to negotiation when it appeared that his side was willing to go to trial.

The U.S. Attorney’s office offered him a deal, he says: if he would plead guilty to charges of violating money transmitting laws, prosecutors would not pursue other potential violations. The government was suggesting that in exchanging bitcoin for cash, Klein was essentially operating a business that functioned like a Western Union or a foreign-currency exchange booth in an airport. Facing the prospect of an expensive trial that could go on for years, Klein started considering that option. Pro-crypto advocates have argued that these laws should not be applied to bitcoin sellers, but there is also precedent for prosecutors doing so successfully in court.

In the end, Klein agreed that, under the Justice Department’s interpretation of the law, he was guilty of failing to register as a money transmitting business with the federal government and to get a license from Missouri. In May 2017, he took the deal.

There remained the matter of sentencing. Ahead of Klein’s September 2017 hearing, the government planned to argue for 13 months of jail time. In court documents, prosecutors say that Klein showed “an eagerness to take advantage of bitcoin’s untraceable features and utilize the digital currency in facilitating criminal activity.” They also argue that a prison sentence would serve as a deterrent for others — and needs to — because digital currencies pose serious new risks, allowing criminals to “transfer funds across the globe at the click of a button.”

At the same time, Klein’s team tried to convince the judge he didn’t deserve to be locked up. His lawyers noted it would not be the best criminal strategy to advertise trades under the username of “jrklein.” They also mention that the likes of Expedia and Overstock.com are now accepting bitcoin as a form of payment and that Klein did not hide his involvement in crypto, becoming something of “a local expert” on the topic after he gave presentations to a local bar association and property rights council. He says he attached profits from trades to his 1040 tax form each year.

An excerpt from one of the letters sent to the judge in support of Klein

Klein’s lawyer was not the only one arguing that he was a good man who had made a bad mistake — and who also did not understand quite what he was getting into with bitcoin. More than 40 people sent letters to the court on Klein’s behalf, from coworkers to customers to the local mayor, all asking the judge to show leniency to a man who often donates his time and technological skill to help the community. Dozens of these authors showed up in court on the day of his sentencing in September.

It turned out they were there for the winning side. The federal district judge ruled that Klein should not be imprisoned. He was instead given five years probation, a $10,000 fine and 120 hours of community service (as well as a demand to pay the $2,122.68 he earned back to the IRS as restitution). “I was giving out hugs like candy,” Klein recalls. His friends had a beer waiting for him at a local bar after it was all over and clapped when he walked in. The Kleins were also able to recoup about half of the money they scraped together for a legal retainer by avoiding a trial.

Now that he has “a bitcoin crime” on his record, Klein says he has been blacklisted from major crypto exchanges. He has trouble finding anywhere to open an account and cannot do trades for cash like he used to as a condition of his probation. Yet he remains an adamant believer. The concept of digital currency, and the ledger-like blockchain technology that makes it work, will “transform” a slew of industries for the better, he says. He continues to promote the technology locally.

“There are going to be all these good, healthy byproducts of this grand experiment,” Klein says, even if he himself became something of a casualty. “Once this catches on and people start running with it, I feel like it’s going to snowball.”

Write to Katy Steinmetz at katy.steinmetz@time.com.