I believe most of the coins found on Spanish and other treasure shipwrecks were transported in barrels.
Don't forget, there's not just the passage in the boat to consider. You need to transport the coins by some means that can easily be carried on and off the ship. A canvas bag full of gold or silver coins would tear easily; a barrel is much less likely to come apart during handling. A canvas bag also isn't very waterproof; bulk coins, being very dense, would likely be carried way down in the bowels of the ship, near the keel, where they doubled service as ballast but where salt water would be much more likely to seep to.
A trade ship or naval vessel that expected to need coinage to fund purchases or pay out sailors during the voyage, on the other hand, would likely have had a strongroom somewhere on board, likely in or near the captain's quarters, within which the ship's money would have been kept in a strongbox, not entirely unlike the stereotypical "pirate treasure chest" in both function and appearance.
Here's a British Navy strongbox from the 1790s.
As for how the coins might have been arranged within the chest, I don't think anything other than a loose pile would have been practical. There'd have been a mixture of sizes and denominations, and/or a mixture of shapes - especially for Spanish colonial "cob" coinage, which in appearance was little more than hacksilver and not easily stackable or sortable. Any kind of careful stacking or other delicate arranging would have been undone by the handling on and off the ship, and by the motion of the ship itself while at sea.
It is known that merchant ships tended to carry a bewildering array of different coin denominations and styles, of all the commonly encountered trade currencies in use at the time. For trade on board the ship and within the ship's home ports, there would be fixed exchange rates that foreign coins would be expected to exchange as. For trade in foreign ports, exchange rates would largely come down to haggling, though of course the actual silver content of the coins in question would be the primary source of an individual coin's perceived value. So there generally wasn't a tendency to sort the coinage within a treasure box out into the different countries as it usually didn't make too much difference what form of coinage the payments were made in. Remote seaports were used to having to deal with whatever coinage the trade ships happened to bring their way, especially for ports that were too small and poor to have their own coinage struck for them.
Don't say "infinitely" when you mean "very"; otherwise, you'll have no word left when you want to talk about something really infinite. - C. S. Lewis