This is a quote from the book "On Zero Confirmation Transactions" by Chris Pacia
... which spend the same Bitcoins. The first transaction sends the coins to the merchant, while the second sends the coins back to yourself. The trick here is you need to make sure the merchant see s the legitimate transaction first and the double spend second (or preferably not at all), while ensuring the mining pools see the double spend first and the legitimate transaction second. Given how fast transactions propagate around the network, it’s tricky to get the timing correct, but assuming you do, the merchant will think he received a valid payment, while the miners will incl...
read full book block explorer