When Juan Pinto gets in line at the movie theater, he takes out his phone and trades just enough bitcoin for Venezuelan bolivars to pay for the ticket by the time he gets to the counter. Pinto lives in Venezuela, but doesn’t keep any of his money in the national currency. The 29-year-old quit his job as a mechanical engineer to dedicate his life to cryptocurrency three years ago, when he says he “fell in love with the technology.” Venezuela’s crumbling economy played a part as well. “Being a Venezuelan and living in the situation that I’m in, I was more willing to take some risks,” he tells me over Skype.

In the US, bitcoin is primarily a speculative investment, whose soaring price has been compared to a bubble. But in Venezuela, where inflation topped 2,616 percent last year, cryptocurrency is a way around restrictions on holding foreign currency, and in some cases, a means of survival. That’s made Venezuela an interesting laboratory for cryptocurrency serving as both a real currency and a viable means of storing value. As the government prints more bolivars, their value plummets; the government recently released a 100,000-bolivar note, currently worth less than 50 US cents at the black-market rate. Bitcoin holders, by contrast, have something most people don’t: a currency that’s worth something.

The national currency, officially called the “strong bolivar,” has lost 98 percent of its value against the dollar at the black-market rate in the last year, and the International Monetary Fund predicts that the country’s economy will shrink by 15 percent in 2018. Even President Nicolás Maduro’s government seemed to have lost confidence in the bolivar when last month it introduced a cryptocurrency of its own, the “petro.” Maduro says his digital money is backed by the country’s natural resources such as oil, gold, and diamonds.

The petro may be novel---a digital token centrally controlled by a government is ideologically at odds with the original idea for cryptocurrencies. Bitcoin relies on a ledger, called a blockchain, stored on millions of computers. By design, the currency, created in the wake of the 2008 financial crisis, is not owned or controlled by any single person, company, or government. Many Venezuelans who have turned to bitcoin and other cryptocurrencies in recent years have done so precisely because their government has nothing to do with it.

“Being a Venezuelan and living in the situation that I’m in, I was more willing to take some risks."

Pinto started earning bitcoin in 2015 by mining it from his home, meaning his personal computer was continuously running software that works to solve complex math problems, which over time earns you fractions of the digital money. He still has six mining machines but he’s shipped them all to a business partner in China, for safety reasons.

The low cost of electricity in Venezuela makes the socialist country one of the most popular places to operate the energy-guzzling mining computers, but it’s also one of the most dangerous places to do so. Mining bitcoin from home is an easy way to earn extra money in Venezuela, but Pinto says that it also puts a target on your front door. Maduro’s government, which controls the electric utilities, has gotten hip to what exorbitant energy use in a single residence means. Authorities with information on energy use show up at homes and either confiscate the machines or extort the miners, and sometimes arrest and detain them as well. Pinto says he’s heard too many stories like this, and that for him, mining inside Venezuela is not worth it.

One Caracas software developer, who did not want to be named for security reasons, mines cryptocurrencies on five machines that he’s installed in the homes of five different friends. On average, the coins he’s mining yield a value of $300 to $500 per machine each month. He and other clever miners in Venezuela spread out their machines so there’s no detectable increase in their electricity use.