Gunpowder 火药Handgun from the Yuan dynasty, circa 1300s.Main article: History of gunpowderThe prevailing academic consensus is that gunpowder was discovered in the 9th century by Chinese alchemists searching for an elixir of immortality. By the time the Song Dynasty treatise, Wujing Zongyao (武经总要), was written by Zeng Gongliang and Yang Weide in AD 1044, the various Chinese formulas for gunpowder held levels of nitrate in the range of 27% to 50%. By the end of the 12th century, Chinese formulas of gunpowder had a level of nitrate capable of bursting through cast iron metal containers, in the form of the earliest hollow, gunpowder-filled grenade bombs.In AD 1280, the bomb store of the large gunpowder arsenal at Weiyang accidentally caught fire, which produced such a massive explosion that a team of Chinese inspectors at the site a week later deduced that some 100 guards had been killed instantly, with wooden beams and pillars blown sky high and landing at a distance of over 10 li (~2 mi. or ~3.2 km) away from the explosion.By the time of Jiao Yu and his Huolongjing in the mid 14th century, the explosive potential of gunpowder was perfected, as the level of nitrate in gunpowder formulas had risen to a range of 12% to 91%, with at least 6 different formulas in use that are considered to have maximum explosive potential for gunpowder. By that time, the Chinese had discovered how to create explosive cannonballs by packing their hollow shells with this nitrate-enhanced gunpowder.