For people living in some remote villages in Indonesia, heating houses and fuelling stoves can be a real challenge. The resources required, like gas and wood, have to get shipped in and distributed to individual households, and not only does this process take a whole lot of time - some families wait weeks for new gas to arrive - it also produces a tonne of emissions that contribute to global warming.

The good news is that this antiquated system is now on its way out, thanks to an unlikely source: tofu

You're probably familiar with tofu as a delicious, fluffy treat that's made from bean curd, but in Indonesia, tofu isn't just a snack - it's a livelihood, with hundreds of small, family-run shops producing tofu in massive quantities every day.

Now, thanks to a government-run program, the waste water from all that tofu production is getting transformed into biogas that can be pumped directly to houses.

According to Nick Perry in an AFP report, locals living in Kalisari, Indonesia and rapidly adapting to this new system. But how does it work?

First, let's talk about tofu. Tofu has been made the same way for generations, and it's a rather simple, yet time-consuming process.

Basically, producers start by soaking and grinding soybeans to separate the soy milk from the soy pulp. This step takes the longest because the beans have to soak for hours before they are ready for separation.

After the separated parts go through a filtration system, the protein and oil are separated from the soy milk. A chemical coagulant, which varies based on the producer, is added to firm everything up. Once formed, you have tofu ready for cutting. So, in essence, tofu is coagulated soy milk that you can pick up and eat.

Though simple in practice, "an enormous amount of water is required to make tofu - roughly 33 litres (8 gallons) for every kilogram (2.2 pounds) of spongy bean curd", reports Perry.

Noticing this, researchers working with Indonesia's government found that this waste water could be turned into biogas if a certain type of bacteria is added to it.

It's really that simple. Every day, the waste water is collected from various shops in the village, taken to tanks called 'digesters', and treated with bacteria. Once transformed, the gas is pumped directly from the tanks to local homes.

Besides creating a green energy source for locals, using all that waste water has significantly helped the local environment. "Thousands of litres of waste water drained from raw tofu was once pumped daily from factories around the village into nearby rivers, befouling waterways and contaminating rice fields downstream," Perry reports.

Without all that wastewater lying around, farmers have seen an increased rice yield and the foul smell that comes with tofu production has left the area. Now, with so much success, locals are lining up to get in on the new energy source. In fact, there's a waiting list while the government installs new digesters to cope with the increased demand, even though a whopping 20,000 have already been installed.

The hope for Kalisari is to become the first full-blown green village in Indonesia - an area of the world that is notorious for its high levels of emissions. If they're successful, there's no reason why similar programs couldn't sweep across the region, dramatically changing the way people get the energy they need to live out their lives.