Elon Musk is no shrinking violet. In the midst of a heated debate on the best way to recharge South Australia’s power grid, the provocative Tesla CEO threw down a daring wager. In a 9 March 2017 tweet, he promised that his company would help solve the state’s chronic energy woes by building the world’s largest lithium-ion battery in just 100 days—or it would be free.

Tesla delivered, completing the Hornsdale Power Reserve approximately 40 days ahead of schedule. As the energy storage companion to Hornsdale Wind Farm, it provides a 100-megawatt emergency electricity backup for as many as 30,000 homes. That’s a critical contribution to a state that generates more than 40 percent of its electricity from wind but previously lacked the ability to store and integrate that energy. What’s more, the super-battery stands as a symbol of the potential of renewable energy—and how ambitious optimism, tethered to disciplined execution, can achieve the unexpected.

Musk’s audacious gamble reflected genuine urgency. The price of electricity in Australia had been soaring, increasing 20 percent from 2012 to 2016. The state had been rocked by a series of blackouts.

Here’s how Musk and Tesla got drawn in to help.

September 2016

One of the worst storms to strike South Australia in half a century—with 80,000 lightning strikes and at least two tornadoes—knocks down dozens of high-voltage transmission towers. It leaves the entire state, about 1.7 million people, without power. Some were in the dark for days.

December 2016

More storms in South Australia cause blackouts for 115,000 homes and businesses.

February 2017

Heat waves in South Australia trigger further blackouts.

9 March 2017

A Twitter exchange links Tesla executive Lyndon Rive and Mike Cannon-Brookes, co-CEO of the Australian software company Atlassian—which finally leads to the all-in bet by Musk.

13 March 2017

South Australia unveils an AU$500 million energy plan to solve the crisis, including a project to build the nation’s largest grid-connected storage battery.

July 2017

Tesla and French renewable energy company Neoen reach a deal with the government to install the US$50 million backup power system. Tesla beats out 91 other bids. Tesla’s plan: build a facility that would bottle up excess energy generated by the nearby wind turbines in Neoen’s 325-megawatt Hornsdale Wind Farm in Jamestown, Australia. The banked energy could then be used during demand peaks

29 September 2017

The clock starts ticking on Musk’s challenge as Tesla signs the contract with the South Australian government. But the company had already been hard at work behind the scenes. Before the ink could dry, the project was already half completed.

24 November 2017

Tesla completes the project more than a month ahead of schedule. South Australia Premier Jay Weatherill calls it “history in the making,” and global energy experts hail it as one of the first great engineering feats of the 21st century.

1 December 2017

Operations begin. South Australia turns on a battery that incorporates hundreds of powerpacks covering the size of a football pitch.

December 2017

Hornsdale passes its first two tests in the blink of an eye after one of Australia’s biggest power plants suffers sudden drops in output. The battery responded to the first failure in 4 seconds—and to the second one in just 0.14 seconds. State officials report the response time is record-setting, beating out the coal-fired emergency backups.

December 2018

Hornsdale Power Reserve nearly pays for itself within the first year. By eliminating the reliance on costly backup electricity provided by gas generators, Neoen says the facility has already saved consumers US$40 million—or 80 percent of the project cost. The ROI of the project could extend far beyond Australia’s borders, though. Hornsdale just may be the answer to renewable energy’s biggest riddle: how to tap energy even when there’s no wind or sunshine.