The Gunpowder Barrel is an Item in Sea of Thieves that can be used as a weapon or to create a trap. It is found in random locations and can be picked up and carried away. The barrel will explode if shot or impacted by a ship's hull. The barrel will float, so they can be placed in the water to be run over by unsuspecting ships. Ideally players can toss these overboard in the path of a pursuing pirate. The barrel takes five seconds to explode when ignited.
Cannon shots and lighting strikes near the barrel can also cause it to explode. If taken to a player's Ship, place the barrel in the Crow's Nest or near the center of the boat to lessen a chance of it exploding during combat or impact.
You can also sell this item to the Merchant trading company.
The Mega Keg is an upgraded version of the Gunpowder Barrel. It has the same effect, only three times more explosive with three times the radius. This item was added in the Shrouded Spoils update in November 2018. Unlike the Gunpowder Barrel, this keg cannot be safely stored anywhere, not even in the crow's nest. It rather volatile, and packs quite a punch, leaving a ship severely damaged if exploded while on-board. Leaving one in the path of an oncoming ship however, could be quite entertaining.
The merchants understand the danger of transporting the Mega Keg on the open sea and will pay a pirate well for one that arrives intact.