There are two main types of gunpowder, black powder and ballistite, or poudre B.

Black powder is a mixture of carbon, sulfur and potassium nitrate (KNO<sub>3</sub>). That's the stuff that's used in fireworks.

Ballistite and poudre B produce no smoke, and are used in artillery. It contains mixtures of 50% C<sub>6</sub>H<sub>8</sub>(NO<sub>2</sub>)2O<sub>5</sub> (nitrocellulose) and about 50% C<sub>3</sub>H<sub>5</sub>N<sub>3</sub>O<sub>9</sub> (nitroglycerine) or CH<sub>4</sub>N<sub>4</sub>O<sub>2</sub> (nitroguanidine).

Hope that helps.