Gunpowder is the first explosive to have been created in the world. Popularly listed as one of the "Four Great Inventions" of China, it was invented during the late Tang dynasty (9th century) while the earliest recorded chemical formula for gunpowder dates to the Song dynasty (11th century). Knowledge of gunpowder spread rapidly throughout Eurasia, possibly as a result of the Mongol conquests during the 13th century, with written formulas for it appearing in the Middle East between 1240 and 1280 in a treatise by Hasan al-Rammah, and in Europe by 1267 in the by Roger Bacon. It was employed in warfare to some effect from at least the 10th century in weapons such as fire arrows, bombs, and the fire lance before the appearance of the gun in the 13th century. While the fire lance was eventually supplanted by the gun, other gunpowder weapons such as rockets and fire arrows continued to see use in China, Korea, India, and eventually to its use in the Middle East, Europe, and Africa. Bombs never ceased to develop and continued to progress into the modern day as grenades, mines, and other explosive devices. Gunpowder has also been used for non-military purposes such as fireworks for entertainment, or in explosives for mining and tunneling.
The evolution of guns led to the development of large artillery pieces, popularly known as bombards, during the 15th century, pioneered by states such as the Duchy of Burgundy. Firearms came to dominate early modern warfare in Europe by the 17th century. The gradual improvement of cannons firing heavier rounds for a greater impact against fortifications led to the invention of the star fort and the bastion in the Western world, where traditional city walls and castles were no longer suitable for defense. The use of gunpowder technology also spread throughout the Islamic world and to India, Korea, and Japan. The so-called Gunpowder Empires of the early modern period consisted of the Mughal Empire, Safavid Empire, and Ottoman Empire.
The use of gunpowder in warfare during the course of the 19th century diminished due to the invention of smokeless powder. Gunpowder is often referred to today as "black powder" to distinguish it from the propellant used in contemporary firearms.
Chinese beginnings
Gunpowder formula
Gunpowder was invented in China sometime during the first millennium AD. The earliest possible reference to gunpowder appeared in 142 AD during the Eastern Han dynasty when the alchemist Wei Boyang, also known as the "father of alchemy", wrote about a substance with gunpowder-like properties. He described a mixture of three powders that would "fly and dance" violently in his Cantong qi, otherwise known as the Book of the Kinship of Three, a Taoist text on the subject of alchemy. At this time, saltpeter was produced in Hanzhong, but would shift to Gansu and Sichuan later on. Wei Boyang is considered to be a semi-legendary figure meant to represent a "collective unity", and the Cantong qi was probably written in stages from the Han dynasty to 450 AD.
While it was almost certainly not their intention to create a weapon of war, Taoist alchemists continued to play a major role in gunpowder development due to their experiments with sulfur and saltpeter involved in searching for eternal life and ways to transmute one material into another. Historian Peter Lorge notes that despite the early association of gunpowder with Taoism, this may be a quirk of historiography and a result of the better preservation of texts associated with Taoism, rather than being a subject limited to only Taoists. The Taoist quest for the elixir of life attracted many powerful patrons, one of whom was Emperor Wu of Han. One of the resulting alchemical experiments involved heating 10% sulfur and 75% saltpeter to transform them.
The next reference to gunpowder occurred in the year 300 during the Jin dynasty (266–420). A Taoist philosopher by the name of Ge Hong wrote down the ingredients of gunpowder in his surviving works, collectively known as the Baopuzi ("The Master Who Embraces Simplicity"). The "Inner Chapters" (neipian) on Taoism contains records of his experiments to create gold with heated saltpeter, pine resin, and charcoal among other carbon materials, resulting in a purple powder and arsenic vapours. In 492, Taoist alchemists noted that saltpeter, one of the most important ingredients in gunpowder, burns with a purple flame, allowing for practical efforts at purifying the substance. During the Tang dynasty, alchemists used saltpeter in processing the "four yellow drugs" (sulfur, realgar, orpiment, arsenic trisulfide).
The first confirmed references to what can be considered gunpowder in China occurred more than three hundred years later during the Tang dynasty in two Taoist texts. The first in a formula contained in the Taishang Shengzu Jindan Mijue (太上聖祖金丹秘訣) in 808, and then about 50 years later in a text known as the Zhenyuan miaodao yaolüe (真元妙道要略). The first formula was a combination of six parts sulfur to six parts saltpeter to one part birthwort herb. The second text warned against an assortment of dangerous formulas, one of which corresponds with gunpowder: "Some have heated together sulfur, realgar (arsenic disulfide), and saltpeter with honey; smoke [and flames] result, so that their hands and faces have been burnt, and even the whole house burned down." Alchemists called this discovery fire medicine ("huoyao" 火藥), and the term has continued to refer to gunpowder in China into the present day, a reminder of its heritage as a side result in the search for longevity increasing drugs. A book published in 1185 called Gui Dong (The Control of Spirits) also contains a story about a Tang dynasty alchemist whose furnace exploded, but it is not known if this was caused by gunpowder.
The earliest surviving chemical formula of gunpowder dates to 1044 in the form of the military manual Wujing Zongyao, also known in English as the Complete Essentials for the Military Classics, which contains a collection of entries on Chinese weaponry. However the 1044 edition has since been lost and the only currently extant copy is dated to 1510 during the Ming dynasty. The Wujing Zongyao served as a repository of antiquated or fanciful weaponry, and this applied to gunpowder as well, suggesting that it had already been weaponized long before the invention of what would today be considered conventional firearms. These types of gunpowder weapons had an assortment of odd names such as "flying incendiary club for subjugating demons", "caltrop fire ball", "ten-thousand fire flying sand magic bomb", "big bees nest", "burning heaven fierce fire unstoppable bomb", and "fire bricks" which released "flying swallows", "flying rats", "fire birds", and "fire oxen". Eventually they gave way and coalesced into a smaller number of dominant weapon types, notably gunpowder arrows, bombs, and early guns. This was most likely because some weapons were deemed too onerous or ineffective to deploy.
Fire arrows
The early gunpowder formula contained too little saltpeter (about 50%) to be explosive, but the mixture was highly flammable, and contemporary weapons reflected this in their deployment as mainly shock and incendiary weapons. One of the first, if not the first of these weapons was the fire arrow. The first possible reference to the use of fire arrows was by the Southern Wu in 904 during the siege of Yuzhang. An officer under Yang Xingmi by the name of Zheng Fan (鄭璠) ordered his troops to "shoot off a machine to let fire and burn the Longsha Gate", after which he and his troops dashed over the fire into the city and captured it, and he was promoted to Prime Minister Inspectorate for his efforts and the burns his body endured.天佑初,王茂章征安仁义于润州,洎城陷,中十余创,以功迁左先锋都尉。从攻豫章,(郑)璠以所部发机「飞火」,烧龙沙门,率壮士突火先登入城,焦灼被体,以功授检校司徒。(Rough Translation: During the beginning of Tianyou Era (904–907), Zheng Fan followed Wang Maozhang under a campaign of Runzhou, which was guarded by rebel An Renyi, he was severely injured by the time it was captured, as the result he was promoted as the Junior General of Left Vanguard. At the campaign of Yuchang, he ordered his troops to propel the "flying fire" on the besieged city, after the city-gate of Longsha was burnt, he led his troops dashed over the fire and entered the city, his body was scorched, as the result he was promoted as the Prime Minister of Inspectorate.) Records of Nine Kingdoms ch. 2 A later account of this event corroborated with the report and explained that "by let fire (飛火) is meant things like firebombs and fire arrows." Arrows carrying gunpowder were possibly the most applicable form of gunpowder weaponry at the time. Early gunpowder may have only produced an effective flame when exposed to oxygen, thus the rush of air around the arrow in flight would have provided a suitably ample supply of reactants for the reaction.
Rockets
The first fire arrows were arrows strapped with gunpowder incendiaries, but they eventually became gunpowder propelled projectiles (rockets). It's not certain when this happened. According to the History of Song, in 969 two Song generals, Yue Yifang and Feng Jisheng (馮繼升), invented a variant fire arrow which used gunpowder tubes as propellants. These fire arrows were shown to the emperor in 970 when the head of a weapons manufacturing bureau sent Feng Jisheng to demonstrate the gunpowder arrow design, for which he was heavily rewarded. However Joseph Needham argues that rockets could not have existed before the 12th century, since the gunpowder formulas listed in the Wujing Zongyao are not suitable as rocket propellant. According to Stephen G. Haw, there is only slight evidence that rockets existed prior to 1200 and it is more likely they were not produced or used for warfare until the latter half of the 13th century. Rockets are recorded to have been used by the Song navy in a military exercise dated to 1245. Internal-combustion rocket propulsion is mentioned in a reference to 1264, recording that the 'ground-rat,' a type of firework, had frightened the Empress-Mother Gongsheng at a feast held in her honor by her son the Emperor Lizong.
In 975, the state of Wuyue sent to the Song dynasty a unit of soldiers skilled in the handling of fire arrows and in the same year, the Song used fire arrows to destroy the fleet of Southern Tang. In 994, the Liao dynasty attacked the Song and laid siege to Zitong with 100,000 troops. They were repelled with the aid of fire arrows. In 1000 a soldier by the name of Tang Fu (唐福) also demonstrated his own designs of gunpowder arrows, gunpowder pots (a proto-bomb which spews fire), and gunpowder caltrops, for which he was richly rewarded as well.
The imperial court took great interest in the progress of gunpowder developments and actively encouraged as well as disseminated military technology. For example, in 1002 a local militia man named Shi Pu (石普) showed his own versions of fireballs and gunpowder arrows to imperial officials. They were so astounded that the emperor and court decreed that a team would be assembled to print the plans and instructions for the new designs to promulgate throughout the realm. The Song court's policy of rewarding military innovators was reported to have "brought about a great number of cases of people presenting technology and techniques" (器械法式) according to the official History of Song. Production of gunpowder and fire arrows heavily increased in the 11th century as the court centralized the production process, constructing large gunpowder production facilities, hiring artisans, carpenters, and tanners for the military production complex in the capital of Kaifeng. One surviving source circa 1023 lists all the artisans working in Kaifeng while another notes that in 1083 the imperial court sent 100,000 gunpowder arrows to one garrison and 250,000 to another.