Security wise what stops me from canceling an unconfirmed transaction? I'm in a restaurant where they serve me my meal without waiting for the blockchain confirmation. Technically speaking I can cancel my transaction before the confirmation according to this

So what stops me from doing the same thing with bigger, riskier transactions?
So what stops me from doing the same thing with bigger, riskier transactions?


Because anyone accepting a bigger, riskier transaction should know enough to wait for at least a single confirmation.

Restaurants and stores all know that they will be subjected to a certain amount of theft and fraud, but since the amounts are so small, it's mitigated by their business volume.  Preventing easily-fraudable transactions from getting too high is the reason credit cards and debit cards have limits.

If you were to buy a house, however, you'll notice that the means of payment is a much slower and complex process than it is to buy a sandwich.  You don't just swipe a card at the realtor's office and walk out with the keys to a house.

Bitcoin isn't much different.  A zero-confirmation transaction is enough for a barista to hand you a cup of coffee, but not enough for someone to let you drive off with a new car.  For that, they would make you wait for at least one confirmation (about 10 minutes with a proper fee) or for 6 confirmations (60 minutes with a proper fee).  I should point out that this is still much faster than traditional financing in these situations.

Once even a single confirmation has occurred, it will now cost you a non-negligible amount of money in hashing power to reverse the transaction.  Every new confirmation compounds that amount.  In other words, unless the transaction is extremely large (think government budget sized), you would be losing money by attempting the fraud...and it wouldn't even be guaranteed to work.

In short, your own incentives prevent you from attempting fraud.