The pair of Bitcoin hearings held this week by Senate committees could have been a disaster for fans of the virtual currency. After all, Bitcoin first came to mainstream attention in 2011, after reports that it was being used to power a shadowy online drug marketplace called Silk Road.

Yet the tone of the hearings — held Monday by the Senate Homeland Security and Governmental Affairs Committee and Tuesday by the Senate banking committee — was overwhelmingly positive, with consensus that the federal government needs to be careful to avoid hampering the growth of the world’s first completely decentralized payment network.

That wasn’t a coincidence. The cordial atmosphere at the hearings was the culmination of months of careful diplomacy by Bitcoin advocates. Since the spring, leaders of the Bitcoin community and sympathetic policy advocates have been engaging with federal regulators, lawmakers and other influential figures inside the Beltway.

Bitcoin’s positive reception from policymakers was just one sign that the cryptocurrency is becoming increasingly mainstream. On Thursday, the largest private university in Cyprus, the University of Nicosia, announced it would allow tuition to be paid with bitcoins. Richard Branson’s Virgin Galactic said Friday that it would accept Bitcoin payments for space travel. And the Bitcoin start-up Bitpay says that 12,000 merchants have signed up to receive payments through its service.

That climb to respectability has been painstakingly managed by Bitcoin’s advocates, who faced a far different welcome on a previous visit to Washington. On June 13, many government officials got their first opportunity to meet senior figures in the Bitcoin community at a conference sponsored in part by the Center for Missing and Exploited Children. A major theme of one panel was the use of bitcoins to purchase child pornography, which led to a particularly tense exchange.

“Child pornography is like Bitcoin in some ways,” said panelist Andrew Oosterbaan, who prosecutes child pornography cases for the Justice Department. “It has intrinsic value to people who want it. . . . When you add an anonymous currency, you’ve taken individuals who are already incentivized to produce, given them a far more meaningful incentive to do so.”

“Bitcoin is nothing like child pornography,” shot back a visibly angry Patrick Murck, general counsel of the Bitcoin Foundation. “If there was one instance of a child being abused because of Bitcoin, that’s one too many. I’m a father; I think there’s a special place in hell for people who do that.”

But Murck also stressed that the Bitcoin community is willing to work with federal regulators. “I want to craft a sane regulatory environment,” he said, urging regulators to “engage stakeholders.”

Despite the sometimes confrontational tone, that conference was a turning point. Behind the scenes, Murck met keynote speaker Jennifer Shasky Calvery of the Financial Crimes Enforcement Network, which enforces the nation’s laws against money laundering. Their conversation led to a meeting in August between regulators and Bitcoin advocates.

At that meeting, high-level administration officials heard an impassioned defense of Bitcoin. “What the Bitcoin Foundation tried to stress is that Bitcoin is less useful for [illicit] purposes than other centralized virtual currencies,” said Jerry Brito, a researcher at the Mercatus Center, a libertarian think tank, who attended the meeting. Bitcoin advocates also stressed that excessive regulation in the United States would merely push more of the Bitcoin economy overseas, where U.S. regulators might not be able to reach it.

In addition, the day after the June conference, Murck was introduced to staff members on the Senate homeland security committee, beginning a conversation that culminated in this week’s hearings.

Committee staff members had begun to study the topic in earnest in April, when the value of one bitcoin spiked to $266, generating a wave of media attention.

Over the summer, committee staff members interviewed about 50 experts in industry, government, academia and nonprofit organizations to learn how the Bitcoin network worked and how it might affect the economy and law enforcement. Committee staff members talked to government agencies, bankers and technologists. They also talked extensively to representatives of the Bitcoin Foundation.

When the hearings took place this week, all the discussions and meetings seemed to have had an impact, because government officials echoed many of the Bitcoin supporters’ arguments in their testimony.

“We are attuned to the criminal use” of Bitcoin, said Mythili Raman of the Justice Department. But “there are many legitimate uses. These virtual currencies are not in and of themselves illegal.”

Calvery testified that “virtual currencies have yet to overtake more traditional methods to move funds internationally” for “criminal purposes.” She added that “innovation is a very important part of our economy,” and cautioned that premature regulation could stifle Bitcoin innovation.

In perhaps the strongest measure of the turnaround executed over the summer, even Ernie Allen, president of the International Center for Missing and Exploited Children, spoke favorably of Bitcoin.

“We are enthusiastic about the potential of virtual currencies and the digital economy,” Allen told the Senate committee Monday. Allen said he remained concerned about the use of the currency for exchanging child pornography, but he warned that “draconian” regulations could push Bitcoin enterprises underground and overseas, where it would be much harder to police for illicit uses.

Allen said later in an interview that the June conference had catalyzed the creation of a task force to consider how policymakers should respond to Bitcoin’s emergence. It is expected to issue its recommendations early next year.

“We always intended that conference to be a launching point,” he said, adding that conversations since then among members of the task force have changed how he thinks about the online payment network.

Murck says that not everyone in the Bitcoin community was happy about his engagement with Washington. The Bitcoin community has a strong libertarian streak, and many devotees worry that conversations with federal regulators could help to legitimize and encourage regulation.

But to the surprise of many, the Bitcoin advocates’ charm offensive actually changed the minds of many D.C. insiders. Winning over Allen was a particular coup. Allen’s warnings against the dangers of premature regulation were especially noteworthy coming from a long-time activist against child pornography.

“Part of the effort was not just to address these issues from a law enforcement perspective, but to listen to the leaders of the Bitcoin movement,” Allen said. And when he listened to them, he found some of their arguments to be surprisingly persuasive.