> For the complete documentation index, see [llms.txt](https://docs.desuicoinflip.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.desuicoinflip.io/mechanics.md).

# Mechanics

How does it work?

<figure><img src="https://3555643063-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhHDpCdmrFTRkw7ggFgXw%2Fuploads%2FMkCsHpG7AsKwH5li3gUG%2FSUI%20FRENS%20FLIP%20HOME.png?alt=media&amp;token=45da0595-2da6-4fa4-be3e-2f2a0df2326e" alt="" width="563"><figcaption><p>SuiFrens x DeSuiLabs Coin Flip</p></figcaption></figure>

&#x20;is a smart contract with 50/50 odds of heads or tails.

A user bets on heads or tails. If they guess correctly, they win and the smart contract loses. A loss triggers the smart contract to send the user double their initial wager:

```jsx
User: bets 0.5 SUI on HEADS.
Smart contract: HEADS ✅

Smart Contract sends 1 SUI to user wallet
```

If a user guesses incorrectly, the smart contract sends the players wager into the house wallet:

```jsx
User: bets 0.5 SUI on TAILS.
Smart contract: HEADS ❌

Smart Contract sends 0.5 SUI to house wallet

```
