Four years ago, Alberto's career prospects were bleak. The 23-year-old Venezuelan had just graduated from college with a degree in computer science, but his nation's economy was already shredded by 13 years of socialism.

"There were job opportunities, but they paid like $20 a month, and we were used to traveling and buying things from abroad so we couldn't settle for that," his friend Luis recalls. Alberto and Luis—whose names have been changed for their own safety—teamed up to start a clothing business, but the venture floundered.

Then Alberto discovered bitcoin mining.

He read about it on an Argentinian gaming forum. An item posted to the site described a process of getting paid in a new internet-based currency denominated in strings of numbers and letters, in exchange for running computations on a home computer. His parents said that the whole thing sounded like a Ponzi scheme. Alberto, however, sensed that his life was about to change.

Four years later, his country is embroiled in a humanitarian crisis. The supermarket shelves are bare. Children are fainting from hunger in their classrooms. A mob recently broke into the Caracas zoo to eat a horse. Many Venezuelans subsist on a monthly government stipend equivalent to about $9.

Alberto, meanwhile, based on his own account, is earning more than $1,200 a day mining bitcoins and other cryptocurrencies.

He's part of Venezuela's rapidly growing digital currency mining community. Faced with growing threats of violent crime and government extortion, its members interface through secret online groups and take extreme precautions to hide their activities.

In a country where cash has lost much of its value, and food and other necessities are dangerously scarce, bitcoins are providing many Venezuelans with a lifeline. The same socialist economics that caused the country's meltdown has made the energy-intensive process of bitcoin mining wildly profitable—but also dangerous.

The Only Hope to Survive

Created in 2008 by the pseudonymous computer programmer Satoshi Nakamoto, bitcoin is digital money that's tracked via a public ledger and controlled by no central bank, corporation, or individual. It's a peer-to-peer currency running on the internet, which severely limits the potential for government interference.

Bitcoin mining is a process that provides the computational power and security required to run this decentralized currency network. To start mining, anyone can purchase a special type of internet-connected computer that runs difficult computations at high speeds. Though it has almost nothing in common with mining for gold, the end result is the same: Participants are awarded with currency—in this case, newly minted bitcoins.

It's become a popular vocation in Venezuela in part because the country's economy is in such dire shape. Even computer scientists and skilled technical professionals can't reliably find work. Next year, the unemployment rate is expected to climb above 20 percent.

But the main factor driving Venezuelans to take up bitcoin mining is a price control put in place by the socialist government: Electricity is virtually free.

Bitcoin mining requires a lot of computer processing power, which in turn requires a lot of electricity. In most of the world, utility bills eat into the cost of mining. In places where energy prices are high, it can even be a losing proposition. But in Venezuela, the government has turned bitcoin mining into something akin to owning a home mint.

Price controls, of course, invariably lead to shortages, and the country's frequent electricity outages create constant headaches for bitcoin miners. But they've also come up with workarounds, such as locating their operations in industrial zones, where electricity service is generally uninterrupted.

Since bitcoin mining is a process, in effect, of converting the value of electricity into currency, Venezuelan miners are engaging in a form of arbitrage: They're buying an underpriced commodity and turning it into bitcoin to make a profit. The miners have turned socialism against itself.

In the process, they've gained access to a currency with far more purchasing power abroad than the government-issued bolivar, which trades for about one thirtieth of a penny on the black market. As the local saying goes, Venezuelan money is "no good for buying toilet paper or even wiping your ass."

Bitcoin's potential as an alternative to government-issued currency is still hotly debated outside of Venezuela. But in a country lacking food and basic health care, there's nothing theoretical about it. Bitcoin is helping to keep pantry shelves full and medicine cabinets stocked, making life tolerable—if not always easy—in the midst of a socialist hell.

Like many bitcoin users, Alberto, the miner who makes $1,200 daily, imports food from the U.S. through Amazon's Prime Pantry service. This would be impossible with bolivars because almost no one outside of Venezuela accepts them as payment, and the growing scarcity of U.S. currency has made purchasing foreign goods with dollars increasingly difficult. Though the Seattle-based retail giant doesn't accept bitcoins itself, plenty of intermediary companies do. Alberto purchases Amazon gift cards through the cryptocurrency-friendly website eGifter, using software to mask the location of his computer, and then routes his orders through a Miami-based courier service.

Alberto's mining partner Luis, 27, buys electronics, perfumes, soaps, and shampoo on Amazon. Recently he purchased a wallet, a jigsaw puzzle, and a Tommy Hilfiger shirt.

The government's crackdown on bitcoin mining started with the arrest of Joel Padrón, the owner of a struggling courier service. He spent three and a half months in a detention center, sharing a 230-square-foot cell with 12 other men.

Alberto and Luis are typical of the growing number of Venezuelans using bitcoin to put food on the table. Some are even using it to purchase goods from foreign suppliers to keep their businesses running. In more than a dozen interviews, members of the community—some of whom are miners, and others who simply use the currency—described how this technology has alleviated daily hardships, making it possible for them to live reasonably comfortable lives despite the disintegrating society. Many bitcoin users live in constant fear of being discovered and agreed to speak with Reason only on the condition of anonymity.

Alejandro, a 25-year-old miner who lives in the state of Táchira, is helping to feed his family with groceries purchased from Walmart.com using a Neteller card, which is a prepaid credit card that allows users to deposit bitcoins and spend dollars. Every three weeks, he also loads up his card with bitcoins and crosses into Colombia to stock up on provisions.

Jesús, a 26-year-old living in the city of Barquisimeto, credits bitcoin with saving his business. He's the proprietor of a small cellphone and computer repair shop located in a mall. When his suppliers ran out of inventory because of trade restrictions, his store was on the verge of going under. Then a friend introduced him to bitcoin. Now, he orders $400 in supplies from Amazon in a good month, and his business has recovered. "I have access to tools and inventory," he says, "that are difficult to find or extremely expensive in Venezuela."

Ricardo, a 30-year-old photography teacher, is earning about $500 in monthly revenue with a rack of five mining computers hidden in a soundproofed room of his family's two-story house. His mother has chronic liver disease, and the medication she needs to stay alive is no longer sold in Venezuela. With bitcoins, he's able to purchase the drug from foreign suppliers. "Bitcoin," he says, "is our only hope nowadays to survive."

Risky Business

Bitcoin miners may have unique access to foreign goods, but they also live under constant threat. Many fear they'll be discovered by the Servicio Bolivariano de Inteligencia Nacional (sebin), the country's secret police force. SEBIN officers hunt for bitcoin miners and then extort them under the threat of arrest and criminal prosecution.

The government's crackdown started earlier this year with the arrest of Joel Padrón, the 31-year-old owner of a struggling courier service in the city of Valencia. In 2015, a friend introduced Padrón to bitcoin mining as a way to stay afloat during the economic crisis. He purchased four computers from China specially engineered for the purpose and invited three friends to do the same. They set up shop in the office where Padrón ran his courier service; when his landlord found out what they were up to, he demanded their help in setting up a few computers himself.

On March 14, two SEBIN officers showed up unannounced, according to Padrón, claiming that workers with the power company had detected high levels of electricity use at that address and demanding to search the premises. That afternoon he was taken into custody. Padrón would spend the next three and a half months in a SEBIN detention center, sharing a 230-square-foot cell with 12 other men. Among his cellmates was another bitcoin miner arrested the same day, José Perales, 46, and Daniel Arraez, 30, an employee of SurBitcoin, the largest bitcoin exchange in Venezuela.

Padrón says his arrest was a way of sending a message to the bitcoin community that from then on, freedom would come at a price. Two days later, the state-controlled Venezuelan Television Corporation ran a story that referred to bitcoin as a tool of "cybercriminals" who, among other things, "evade policies on foreign exchange."

Around the same time, Padrón says an acquaintance who's also a bitcoin miner was visited by SEBIN officers and told, "Give us money or we're going to put you in jail just like your friend." Multiple other sources interviewed for this story said they also knew of miners extorted by SEBIN.

Bitcoin mining isn't illegal in Venezuela, so Padrón was charged with "contraband," for not having the proper paperwork to import the computers from China (Padrón says he did), and for "electricity theft." When they raided his office, the sebin officers chastised him for "misusing electricity" and "causing the power outages."

The charge of "electricity theft" does relate to an ongoing debate in the bitcoin community: Is mining a waste of power? Even if it's not, should it be happening in Venezuela, of all places? The country suffers from severe power shortages. Rather than raise prices to throttle demand, the government has resorted to cutting supply selectively. In April, four-hour daily blackouts were mandated in some regions of the country, and public employees were ordered to work two-day weeks to reduce power consumption in government office buildings.

One of the many advantages of bitcoin is that it's free from price controls. Hugo Chavez imposed a disastrous fixed-exchange system in 2003, and today the black market rate is nearly 3,000 bolivars per dollar.

But bitcoin mining is arguably the best possible use of electricity in Venezuela because it's providing the country with what it needs most—a relatively stable currency that retains its value across borders.

It's not just miners who benefit. By routinely selling some of their bitcoin winnings for bolivars to buy food on the black market, miners make it possible for non-miners to trade bolivars for bitcoins and also participate in this new economy.

"The government is taking the entire population hostage by locking them into a currency that's sinking," says Andreas Antonopoulos, a U.S.-based computer scientist, writer, and influential figure in the bitcoin community. "Bitcoin is freeing the hostages."

The Secret Economy

As more Venezuelans have come to rely on bitcoin, the country's miners have built their own communities for trading, selling, and sharing information. After discovering bitcoin in 2012, Alberto shared the news at tech meetups and even spoke at conferences. When the security situation grew worse, bitcoin miners, including Alberto, moved underground.

Some of that underground activity now happens on a Facebook group called "Bitcoin Venezuela," which was started in May 2013 by Randy Brito, a then-21-year-old libertarian living in Spain. Brito, whose parents fled Venezuela when he was 14, initially wanted the group to serve as an educational forum, but once "mining went viral," he says, it became all about commerce and helping users "get through their harsh lives."

Most bitcoin users in Venezuela aren't libertarians, Brito says, but it doesn't matter because libertarian principles are built into the technology. Bitcoin is highly resistant to government interference, since it's the first widely accepted digital currency that can be traded without clearing the transaction through a third-party intermediary, such as a credit card-company or a bank. It's like cash in this regard, but bitcoin has a significant advantage over paper currency: It can be exchanged through the internet, so it makes no difference if a buyer and seller live on opposite sides of the world.

The Facebook group serves as an online bazaar featuring ads for cars, bikes, boats, liquor, protein supplements, soap, smartphones, hiking boots, athletic gear, video games, and toilet paper. Its 7,000-plus members can also buy pharmaceuticals from abroad. But the most common items listed are computer parts and mining equipment.

Since bitcoin has no physical properties, it's also harder to steal. Venezuela still has a robust black market in U.S. dollars, but storing greenbacks is risky in a country besieged by crime. "Burglars smell the Benjamins as if they were hunting dogs," says Hector, a physician turned bitcoin miner.

After Padrón was arrested in March, Bitcoin Venezuela's four moderators, who are tasked with policing for infiltrators and fraudsters, made the group "secret" on Facebook, meaning that it doesn't appear in search results. New members require permission to join, and the moderators use a secondary Facebook group to filter possible candidates before inviting them in.

Brito still encourages users to keep any identifiable information off their profiles, and some members of the group—including Alberto—access it through a secondary Facebook account registered under a fake name. Current members can invite new people to join. (I was added by a source.) The moderators then examine the Facebook profiles of the invitees before allowing them in.

Venezuela's bitcoin community isn't entirely underground, however. CriptoNoticias, a public online news source published out of Caracas, is devoted to covering the bitcoin and blockchain space. The site, which launched in April 2015, is primarily focused on industry news outside the country, and it rarely covers Venezuela's growing mining community. But there are occasional stories on local issues—including a pointed rebuttal to claims in the state-owned press that bitcoin is merely a tool for cybercriminals.

One of the many advantages bitcoin has over the bolivar is that it's free from price controls. Hugo Chavez imposed a disastrous fixed-exchange system in 2003, and today the state's most advantageous rate is set at 662 bolivars per dollar, while the black market rate is nearly 3,000 bolivars per dollar.

This discrepancy has led to exponential growth at Venezuela's largest cryptocurrency exchange, SurBitcoin. The site makes it easy to trade bolivars for bitcoins, which can then be sold for dollars. By using bitcoins as an intermediary currency, it's possible to beat the black market rate with less hassle and risk. Many Venezuelan miners also rely on SurBitcoin to trade their revenues for bolivars, which they use to cover expenses like rent and food.

The SurBitcoin exchange operates out of an office 2,100 miles from Caracas, in a converted shipping and manufacturing complex overlooking the Brooklyn waterfront. It's run by BlinkTrade, a company founded in 2012 by Rodrigo Souza, a former software developer at the New York Stock Exchange and current YouTube personality known for rarely mincing words.

Souza, 36, foresaw early on that bitcoin would have an enormous impact in Latin America. A Brazilian-born libertarian who immigrated to the U.S. in 2008, it was eye-opening for him to move to a country where inflation isn't a constant drag on the economy. "I was robbed every day of my life in Brazil" because of the government's insistence on printing more and more money, he says.

There are about 1,200 daily transactions on SurBitcoin, and volume on the exchange has increased more than threefold in the last year. "It's a lot of people trading small amounts," Souza says. The average trade on SurBitcoin is the equivalent of about $35. The leading exchange in Latin America measured by the amount of money that changes hands is Brazil's Foxbit, but there's more trade activity on SurBitcoin. The government hasn't shut down the service, Souza says, in part because several public officials "have become our clients."

For expats in particular, SurBitcoin is a godsend. Maria is a 32-year-old stock trader who left Venezuela three years ago for Brazil. To send money home to her family, she initially used a human courier: A friend routinely brought cash across the border and deposited it in her parents' bank account. "It took several days and was very dangerous," Maria says. Now she sends about $350 home each month through SurBitcoin without hassle.

To send money home to her family, Maria initially used a human courier: A friend brought cash across the border and deposited it in her parents' bank account. Now she uses an online exchange without hassle.

From the U.S., it's possible to remit funds through services like MoneyGram and Western Union, but my own recent calculation shows that a user of SurBitcoin would save close to 40 cents on the dollar over Western Union. Maria says that in Brazil, MoneyGram involves so much paperwork and has such low remittance limits, it wasn't worth her time.

Souza says he's often approached by high-net-worth individuals looking to make large trades of bolivars for bitcoins. He turns them away in part out of concern they'll crowd out smaller buyers, and in part because rich people are "the ones the government is after," so doing business with them could "bring problems."

The company's biggest crisis occurred during the government crackdown in March, when a Venezuela-based SurBitcoin employee, Daniel Arraez, was detained by sebin on accusations of tax fraud and money laundering. After spending seven months in jail, Arraez was released by a judge on October 18. He's currently barred from leaving the country as he awaits a pre-trial hearing. Souza declined to discuss any of the details at the direction of an attorney.

Arraez's cellmate, Joel Padrón—the first bitcoin miner arrested—was released on July 1 after agreeing to a plea deal.

A Hopeless Country

After Padrón's arrest in March, Alberto's friends warned him to go underground, and he scrubbed his online presence. But the law isn't the only threat. Violent crime in Venezuela has skyrocketed as the economy has collapsed, and miners must be very careful to hide their wealth.

Alberto and his partners, including Luis, hide their bitcoin-mining operations in multiple locations across Caracas' poorest neighborhoods—places where the police aren't likely to come looking. Alberto wears cheap clothes and drives a used car so as not to stand out.

Anyone paying close attention, however, will realize he's not a typical 27-year-old. Extended families tend to cohabitate in Venezuela to pool their limited resources, but Alberto shares an apartment in Caracas with just his wife. Every month he converts some bitcoin to bolivars and buys about 200 pounds of chicken on the black market, which he then divides among about a dozen relatives. When he wants to go out after sundown, Alberto calls a security service that sends two bodyguards and a bulletproof car.

"My neighbors assume we have a good connection with the government," he says.

Alberto has been especially cautious lately. On a warm and clear evening last August, Alberto's mining partner Luis was driving home after dropping off a friend in the neighborhood of El Marques. He was about to turn on to the Cota Mil highway, a major artery in Caracas. It was 8 o'clock at night, and this city of 3.3 million—the murder capital of the world—was already a ghost town.

Crime has been a major problem in Caracas for Luis' entire life, but around the time that President Nicolás Maduro took over from Hugo Chavez, who died of cancer in 2013, the violence increased to the point of crippling city life. Nobody goes out anymore after dark. Five years ago, the streets would have been filled with cars, but on this night, Luis' was the only vehicle in sight.

Lost in conversation with his girlfriend seated on the passenger side, Luis suddenly noticed a car in his rearview mirror that was racing toward him. He moved to the left. The car zoomed past, pulled into the same lane, and then slammed on the brakes, causing Luis' car to smash into its rear.

Seven men jumped out holding guns that they pointed at Luis' windshield. One was carrying a grenade. They ordered the couple out of the car. Luis grabbed his girlfriend's hand and told her to remain calm.

They would spend the next five hours in the back seat of the kidnappers' vehicle with guns pointed at their heads as the men negotiated for ransom. In the middle of the night, Luis' father, who also happens to be a bitcoin miner, met them with a bag containing $6,000 in dollars and euros that he had frantically gathered from friends and neighbors. The kidnappers also demanded glasses, perfumes, watches, and jewelry.

Luis was the victim of what's known in Venezuela as an "express kidnapping," a common occurrence in a city that resembles a war zone after dusk. He was seemingly a random target, with the assailants unaware that he was a bitcoin miner. Over the next few days, Luis paid back his ransom debt by selling some bitcoins for U.S. dollars.

As violent crime and the economic crisis persist, many of the nation's bitcoin miners are looking for an exit.

Luis and Alberto are arranging to leave Venezuela as soon as they can get their affairs in order. Their plan is to head with a group of friends to Argentina, which they chose because the country is "emerging from disaster," Luis says.

Alberto is also considering applying for a U.S. work visa. He's already mulling his next business venture—commercializing his version of a small computer called a "controller" that restarts bitcoin mining operations when technical failures occur. Alberto invented the machine, which he says is singularly effective, in an effort to minimize risky foot traffic in and out of his computing centers.

Some of his partners have agreed to stay and watch over his mining operation, but ultimately Alberto says he has no choice but to walk away. The security problems have simply become untenable: Who wants to live in a country where you can't walk the streets at night without armed guards?

For Luis, his kidnapping was the breaking point. "I lost hope in Venezuela," he says. "If you behave well, despite the fear, you will end up getting damaged in some way. Being an honest, modest worker, who's productive or helpful are not qualities this society values anymore."

When Padrón's parole concludes next year, he too plans to relocate to the U.S. He dreams of living in New York City. "Before I got detained, I was one person who really loved his country," he says. "But after everything that happened, I said, 'No, it's impossible.' Even if you try and do things right, there's always somebody that's going to fuck you up."

Though he hasn't been in contact with José Perales, the other bitcoin miner who shared his jail cell, Padrón says he believes Perales has already skipped parole and fled the country.

Padrón's bitcoin mining computers were confiscated by sebin officers when he was arrested in March and never returned. But he had an alert system set up: Whenever the machines are powered up and connected to the bitcoin-mining network, he receives an automatically generated email.

A month after his arrest, a message arrived in Padrón's inbox. "I think the officers [who arrested me] have started mining bitcoins," he says.

Rodrigo Souza, the operator of SurBitcoin's exchange, is convinced that no matter what happens next in the country, bitcoin will continue to undermine state power. His company works with a domestic bank to facilitate its transactions in bolivars, and the state could take measures to revoke its permissions at any time. If that were to happen, Souza says, his customers would simply start trading bitcoins through the popular listing site LocalBitcoins, where individuals connect online and arrange peer-to-peer trades.

It would be less convenient, but users would manage. Bitcoin in Venezuela is an inexorable force, Souza says. "How can you stop software running on the internet?"

(In the online version of this article, the black market exchange rate was updated to reflect the continuing depreciation of Venezuelan currency, from 1,200 bolivars per U.S. dollar to 3,000 bolivars per U.S. dollar.)

(The print version of this article incorrectly stated that the government's most advantageous fixed exchange rate is 172 bolivars per dollar, which is an outdated figure.)