From "A Treasury of Railroad Folklore" by B.A. Botkin and Alvin F. Harlow
(NOTE: A "track torpedo," in railroad terminology, is an explosive attached to the rail by straps. When the train passes over it, it explodes and alerts the engineer that there's a problem up ahead. They were in use decades after the Civil War.)
"'Do you know where those things originated,' he asked."
I replied that I didnít.
"Well," he said, "one stormy night back in the war a soldier, who was working as a brakeman, had to go back to flag a following train. His lantern failed him, and knowing the following eagle-eye would never see it stuck on the rail by plastering it with a handful of mud. Sure enough, the eagle-eye didn't see him but the box of musket caps busted with a loud bang and flash. The engineer thought that something had broken or exploded in his engine and stopped to see what was wrong. That's the origin of these torpedoes. I guess they found boxes of caps too expensive and some fellow thought up these to take their place."