MAGOG, Que. -- Emiliano Grodzki moves his right hand across the front of a series of small, rectangular machines, each fitted with a fan blowing warm air inside a former metal factory in Quebec's Eastern Townships.

Grodzki and the rest of the Bitfarms team modified the building to house two giant opposing walls of shelves holding thousands of powerful computing systems built for a single purpose: mining for digital currency.

Known as hashing, the hunt for cryptocurrency is essentially an exhaustive attempt by a computer to solve a mathematical problem. Every second, each computer in Bitfarms' factory in Magog, Que., conducts 13.5 trillion attempts at solving a math problem.

Grodzki, 42, an entrepreneur from Argentina and Bitfarms' chief strategy officer, stops his hand in front of one machine that is unlike the others: It's blowing cold air. "This one is not hashing," he says.

Bitfarms' machines are solving math problems in order to collect or mine Bitcoin, the world's most famous digital currency. Companies have sprouted all over the world in an attempt to cash in on the cryptocurrency industry. But Bitfarms stands out.

The Montreal-area company is trying to set itself apart as much by its infrastructure and vertically integrated business model as for its attempt to reduce the social stigma associated with the industry's voracious energy usage.

Since its inception in November 2017, Bitfarms has been rushing to retrofit factories in Quebec regions emptied out by the decline of the province's manufacturing industries. The company leases a former Tupperware plant in Cowansville, an old carpet factory in Farnham and an ex-cocoa storage facility in St-Hyacinthe, all to mine cryptocurrency.

And it is currently turning the former Sher-Wood hockey stick factory it bought in Sherbrooke into a fifth mining operation.

Key to the company's success is securing a stable, reliable -- and relatively inexpensive -- energy source. That's where Quebec comes in, with its abundant, renewable and comparatively cheap hydroelectricity. Hydro-Quebec recently designated 668 megawatts for the growing cryptocurrency sector, more than is consumed by the province's conventional mining industry.

But Bitfarms recognizes it also needs to partner with local communities and convince them they aren't trying to suck as much power as possible, make a quick buck and leave.

The company recently signed an electricity agreement with Sherbrooke city council that is serving as a model for how towns across the province can make money partnering with players in this new industry.

"We have a long-term mentality," said Pierre-Luc Quimper, the 35-year-old co-founder and president of Bitfarms, who started his first website-hosting company at 14 in his New Brunswick hometown. "We want to be long-term partners."

Bitcoin began in 2009, and its creator is unknown. Every time a Bitcoin is bought and sold online, the transaction is recorded in a public, electronic ledger.

The technology behind the ledger is called blockchain, which is composed of a series of linked "blocks" that each contain up to one megabyte worth of transaction data.

Every time a block of transactions is closed, a complex mathematical problem is created. The hashing machines located in Bitfarms' four factories are in competition with all the other hashing computers around the world to solve the problem.

The first computer to come up with the winning number is authorized to create a new block in the chain, in which more Bitcoin transactions can be recorded.

The winning computer is also awarded a set amount of Bitcoin, which can be transferred into hard currency or used to buy anything from food to homes.

Bitfarms' factories house at least 16,500 hashing machines between them. Together, they conduct 220 quadrillion attempts every second to solve the single math problem created when a block of Bitcoin transactions reaches capacity.

Hydro-Quebec, the provincial utility, helped the Bitfarms team find locations around the province for mining operations. Then the City of Sherbrooke came knocking with a novel idea for the industry.

Cities across Quebec purchase enough electricity from Hydro-Quebec to satisfy peak demands, most often during the dead of winter. But for much of the rest of the year, the energy grids have surplus electricity, and the provincial government has been pushing municipalities to come up with ways to sell the extra power, said Christian Laprise, director of Sherbrooke's municipal power utility.

The deal inked with Bitfarms secures the company 98 megawatts of electricity from Sherbrooke. But Bitfarms will have to reduce operations and use less energy during peak moments of the year when the grid is being taxed by residents.

A couple of years ago, Laprise had no idea what Bitcoin and blockchain were, but now he thinks the technology can help develop the digital economy in smaller cities in the province.

"It can be very volatile," Laprise said, referring to the market price of cryptocurrencies, "but according to the research I've done, it's pretty unanimous that blockchain is a system of the future."

Laprise said he hoped companies like Bitfarms diversify "and that they are sustainable over the long-term."

Bitfarms says its long-term goal is to expand into other applications of blockchain, but at the moment it's concentrating on building its mining infrastructure.

Toward the end of 2017, the price of Bitcoin exploded, jumping from about $6,700 in September 2017 to an all-time high of roughly $26,500 per coin, before dropping rapidly in early 2018. One Bitcoin is currently priced at roughly $8,500.

In 2018, Bitfarms earned US$33.8 million in revenue and a gross profit of US$10.9 million, representing a 32-per-cent profit margin. But due to the massive drop in Bitcoin's price over that period, the value of its mining equipment declined significantly, resulting in an US$18-million operating loss.

Back in Magog, Grodzki said the broken hashing machine blowing out cold air would be repaired by the company's technicians at its laboratory in St-Jean-sur-Richelieu, Que., south of Montreal.

The company's program department created and manages software that tracks the performance of each computer. Their four factories -- five when the Sherbrooke operation is operational -- run on an electrical system maintained by Volta electrique, a wholly owned subsidiary.

Quimper says he remembers what it felt like when he was 10 years old discovering the internet. He said the blockchain technology and cryptocurrencies are at the same stage now as the internet was in 1997.

"For the last four years, I've had the same feeling I had when I was 10 years old," he said. "Everything is in front of us."