Coins can be duplicated by dying within a short window (~.1s) after collecting them. In theory, any method of death can be used, but in most cases the easiest method is with the Normtrooper's pistol blasts. When the player is on one life left, wait until you see the Normtrooper raise their pistol and then carefully time the coin grab to be just before the laser hits. You can tell if he duplication was successful in the split second where the game freezes before the "You Died!" screen pops up. If the golden "explosion" sprite is there, the dupe was successful. If the coin is still there, you moved too late and did not collect the coin. If there is no coin or explosion, you collected the coin too early and will need to attempt the dupe on a different coin.
Both golden and regular coins can be duped. It has been confirmed to be possible to dupe coins with collision damage from the Normtrooper, but it is not known if it is more reliable anywhere. Obstacle damage is harder to dupe with due to its unmoving nature, meaning that the player has to very quickly get from the coin to the obstacle. There is one location in level 2 where a golden coin can be duped with an obstacle. There may be other possible locations.