Once upon a time there was a hero who took down the corrupt French Maid, who had manipulated and stolen from the Dread Pirate Roberts on The Silk Road.

It sounds like the plot line of a swashbuckler movie, but actually, it's part of the tale of Kathryn Haun's rise as a federal prosecutor who helped lay the groundwork for the government to capture cryptocurrency criminals.

Right now, the value of just one bitcoin is hovering around $5,000, leading to rampant media coverage, pushing digital currency lexicon into the mainstream. But wide adoption depends much on the safety and security of the new technology, which is often compared to the Wild West.

Haun, first as a federal prosecutor and now as a bespoke legal consultant for emerging technology companies, has contributed much to beefing up security in the industry. In the U.S. Attorney's Office for the Northern District of California, she was the first digital currency coordinator. She handled cases that taught prosecutors to work through challenges in convicting cryptocurrency criminals, and sent loud-and-clear messages to digital currency companies to increase financial safeguards. (Last year, The Recorder named Haun as a woman leader in tech law.)

As for that pirate-themed case with the bizarre pseudonyms, it involved Haun's criminal investigation in 2015 and prosecution of two corrupt government agents, Carl Mark Force IV and Shaun Bridges. Haun uncovered a digital trail on the blockchain that revealed they were stealing hundreds of thousands of dollars in digital currency during their participation on a task force meant to secure a murder-for-hire charge against Dread Pirate Roberts, also known as Ross Ulbrict, who ran the Silk Road, a dark net drug marketplace.

Now, as a consultant, she's enjoying the freedom of giving companies advice so they don't get in trouble in the first place.

“They would ask me a lot of times, naively, 'You're with the government. Can you help us? We really want to follow the law,' ” Haun said.

Having left the U.S. Attorney's office in May, Haun these days is serving on the boards of technology companies such as Coinbase, a large digital currency exchange, and consulting for businesses focused on drones, artificial intelligence and other emerging technologies.

“As with any relatively new technology, there are few people who have vision and drive and savvy to really dive into it and understand it,” said Mike Lempres, general counsel of Coinbase, commenting on Haun's special knowledge. “Those people set forth a path for the future of that technology.”

Haun had been considered a potential appointee for the U.S. Attorney spot in San Francisco, which remains unfilled. Asked if her potential appointment played a role in her career move, she declined to comment.

Nobody could say Haun started out in the law meaning to influence an important new technology. While studying at Stanford Law School, she thought she would practice mergers and acquisitions in Big Law. But instead, she gravitated toward classes about criminal procedure and evidence.

She clerked from 2004 to 2005 for U.S. Supreme Court Justice Anthony Kennedy, after clerking earlier for Judge Alex Kozinski on the U.S. Court of Appeals for the Ninth Circuit.

From there, Haun entered life as a federal prosecutor in Alexandria, Virginia. She left for two years to serve in public policy roles in the U.S. Department of Justice, and then went “back to the line” as a federal prosecutor. In 2009 she moved to the U.S. Attorney's Office for the Northern District of California in San Francisco, for personal reasons, she said. There, she prosecuted the most violent types of crime, including murders, biker gang crime and bank robberies.

In 2012, Haun finished a two-month-long trial in a biker murder case. Burned out, she was ready to move on. It was then that the bitcoin door opened.

“My chief came into the office and asked, 'How would you like to prosecute bitcoin? It's this new criminal technology,'” Haun recalled. “I said, 'Great.'”

The invitation led Haun to a year-long educational process to learn more about bitcoin and its underlying backbone, blockchain technology.

“I got the first bitcoin search warrant, and had to explain to a federal judge—who never heard of bitcoin—how it works,” Haun recalled.

In 2009, bitcoin emerged as the first digital currency. It runs on open-source software and allows peer-to-peer transactions. Rather than having a centralized bank record a financial transaction using just one computer file, bitcoin verifies transactions using a decentralized ledger—the blockchain—saved and updated among a network of computers to verify transactions. Today, there are too many types of digital currencies to list here, and each one runs off its own blockchain.

Any type of crime that can involve cash can also be committed with digital currency, noted Haun. She went after criminals who made spin-offs of The Silk Road and committed narcotics offenses. She prosecuted money laundering involving digital currency. In one cybercrime case, she prosecuted hackers who stole bitcoins from Mt. Gox, a digital currency exchange that went out of business. Haun said that bitcoin could also be utilized in child exploitation cases or even white-collar crimes like fraud.

The tricky part of cryptocurrency is that it offers varying levels of anonymity, Haun explained. Bitcoin isn't truly anonymous, because a prosecutor can examine the blockchain ledger and trace the movement of stolen bitcoin to different online wallets. When a criminal attempts to use a digital currency exchange to liquidate stolen bitcoin into cash, it allows a prosecutor to go to that company with a subpoena or search warrant and learn the criminal's identity.

However, other types of cryptocurrencies and some digital currency exchanges offer higher levels of anonymity—ramping up challenges for prosecutors.

It's also problematic when a digital currency exchange doesn't have the proper safeguards in place to check customers' identities. For example, Haun investigated Ripple Labs Inc., a digital currency exchange that didn't have the best know-your-customer and anti-money laundering programs in place. Her work there made a big impact in the cryptocurrency industry.

Hogan Lovells partner Greg Lisa of Washington, D.C., worked closely with Haun on the Ripple Labs case when he was the head of enforcement for the U.S. Treasury's Financial Crimes Enforcement Network, known as FinCEN.

The seminal case came to an end in May 2015 when Ripple accepted a civil settlement. The $700,000 civil penalty included the forfeiting of $450,000 to resolve possible criminal charges. FinCEN found that Ripple violated the law by acting as a money services business and selling virtual currency without registering, failing to maintain an adequate anti-money laundering program and failing to report suspicious financial transactions. The company agreed to take remedial steps to get into compliance with its legal requirements.

Lisa said it was groundbreaking in large part because of Haun's efforts.

“It was a very important step to ensuring the whole industry acknowledges itself as financial institutions and is subject to anti-money laundering principals and requirements,” Lisa said.

Haun is a welcome member to the private legal sector, Lisa said. Many emerging tech companies aren't fully aware of legal, regulatory and law enforcement interests and risks. On the other side, the federal government doesn't always appreciate the benefits that companies can offer. Haun can be a buffer between the government and tech companies, Lisa said.

“She's someone who really does bridge the divide,” he said. “She's got real street cred with the government, so if she does go into a board room and says, 'This is how the government is going to look at you or these are some of their concerns'—she's right.”

Follow Angela Morris on Twitter: @AMorrisReports