Without Trusting a Third Party using Bit Commitment
Alice and Bob decide to flip a coin, but they have no physical coin or they want to do it over the Internet. They can achieve fair coin tossing by following protocol on Bitcoin.
- Alice and Bob each locks X bitcoins in a smart contract shown below.
- They both reveal their secret number, which are XOR’d to determine if the coins lands on head or tail. Alice wins if it is head, otherwise Bob wins. Whoever wins takes all 2X bitcoins.
Additional measures have to be taken in case one party decides to abort when he/she finds out he/she loses, by refusing to reveal their secret number. For example, instead of letting winner taking all, we could have the loser take 0.5X bitcoins and thus incentivise him to proceed even though he will lose.