The cryptocurrency has wowed markets this year with breakneck gains as investors flocked to an asset that exists only in cyberspace. But the laborious creation of each digital bitcoin by private computer networks has real-world consequences in the form of massive energy use – including from fuels that cause the most pollution.

Eight 100-metre-long metal warehouses in northern China are a case in point. Bitmain Technologies runs a server farm in Erdors, Inner Mongolia, with about 25,000 computers dedicated to solving the encrypted calculations that generate each bitcoin. The entire operation runs on electricity produced with coal, as do a growing number of cryptocurrency “mines” popping up in China.

The global industry’s power use already may equal 3 million US homes, topping the individual consumption of 159 countries, according to the Digiconomist Bitcoin Energy Consumption Index. As more bitcoin is created, the difficulty rate of token-generating calculations increases, as does the need for electricity.

“This has become a dirty thing to produce,” said Christopher Chapman, a London-based analyst at Citigroup.

Energy has always been part of bitcoin’s DNA. The person credited with creating the currency, identified only as Satoshi Nakamoto, devised the system that awards virtual coins for solving complex puzzles and uses an encrypted digital ledger to track all the work and every transaction. As the market grew from a hobbyist culture in 2009 to a global phenomenon this year, ever-more computing power was needed by large networks.

Bitcoin prices have surged more than 2,000 percent in the past year on some exchanges and touched a record of more than $17,500 this week. Cboe Global Markets Inc. began offering bitcoin futures on 11 December, reaching $18,850 on the first day of trading. There are other cryptocurrencies, such as ethereum and litecoin, but bitcoin is by far the largest.

China, which gets about 60 percent of its electricity from coal, is the biggest operator of computer “mines” and probably accounts for about a quarter of all the power used to create cryptocurrencies, according to a study of the industry published in April by Garrick Hileman and Michel Rauchs at Cambridge University.

About 58 percent of the world’s large cryptocurrency mining pools were located in China, followed by the US at 16 percent, the researchers said. China is the biggest producer and consumer of coal, and server farms in provinces such as Xinjiang, Inner Mongolia and Heilongjian are heavily reliant upon the fuel.

Estimates of how much electricity goes into making cryptocurrencies vary widely – from the output of one large nuclear reactor to the consumption of the entire population of Denmark. But analysts agree that the industry’s power use is expanding rapidly – especially after a price rally that made bitcoin almost four times more valuable than just three months ago.

Total electricity use in bitcoin mining has increased by 30 percent in the past month, according to Alex de Vries, a 28-year-old blockchain analyst for accounting firm PwC.

“The energy-consumption is insane,” said de Vries, who started the Digiconomist blog to show the potential pitfalls in cryptocurrency. “If we start using this on a global scale, it will kill the planet.”

Some analysts dismiss such claims as overly alarmist, noting that even the high-end estimates of demand account for only about 0.1 percent of what the world uses. Advances in technology also may make operations more energy efficient.

Still, it’s getting more expensive to produce cryptocurrency as the energy use of the process rises. Miners – especially the big ones – will look for the cheapest power to better weather price volatility, according to the Cambridge study. Electricity costs in China, which has surplus capacity of coal-fired generators and vast reserves of the fuel, is well below what consumers pay in the US or Europe.

Bitcoin’s algorithm dictates that after a certain number of tokens are created, more work is required for the next batch, said James Butterfill, the head of research and investment strategy at ETF Securities in London who has been studying cryptocurrency markets.

Using estimates of electricity prices and the rising speed with which calculations must occur, Butterfill estimates the marginal costs of each bitcoin will more than double from $6,611 in the fourth quarter to $14,175 in the second quarter of 2018. At the start of 2017, the cost was $2,856. With costs rising, there’s a greater risk for miners should prices tumble.

“You’d be hard-pressed to find anywhere where it isn’t profitable to mine,” said Butterfill, who set up computers at his home in England to mine tokens in his spare time and joined a network of 120,000 others to boost processing capacity and returns. “But if you’re investing in a bitcoin rig, you have to look at the long term, and with the volatility as high as it is, it’s probably still doesn’t make sense to mine bitcoin in Europe.”

Not all cryptocurrency mining is dirty. Computers in Iceland get power from geothermal plants. Even in China, some are clustered around hydroelectric facilities in Sichuan and Yunnan.

In Austria, Hydrominer IT-Services put servers inside hydro-power plants. It was the cheapest option, said Michael Marcovici, a company founder, who began mining in 2013.

“Frankly, we didn’t start this as an environmental project,” Marcovici said. “It is bad for bitcoin to have this news all the time about this dirty energy. People don’t want dirty energy to be used. But the problem is, in Europe, the energy is just too expensive.”