Gunpowder was invented in China and spread to the Middle East, eventually arriving in Europe around 1300, nearly 400 years after its invention. Its impact in warfare was substantial and almost immediately felt on the battlefield through infantry weapons, having a devastating effect on the knightly class. Although this was a setback for the nobility they still had their walled castles.
Artillery weapons powered by gunpowder, initially unreliable but once perfected, made once impenetrable castles vulnerable. Sieging a castle in the Middle Ages was a long and arduous process. Techniques involved tunneling under walls, ramming down walls, starving out the inhabitants, all of which could take weeks or even months. However with the invention of cannons a castle could be taken within a single day.
Gunpowder consists of a mixture of saltpeter (potassium nitrate), charcoal, and sulfur. The sulfur and charcoal act as the fuel, with saltpeter acting as an additional oxidizer creating a stable chemical reaction with the rapidly expanding gases resulting in the propelling motion.