Why are gambling dApps so popular and how do they actually work?
This post is meant as an educational resource to understand how gambling dApps work and to give an overview of the category — it is not intended to promote gambling.
Overview
According to State of the DApps, 33% of all dApp ETH volume from May 2019 was attributed to gambling dApps. This includes coin flip games, dice, poker, roulette, baccarat — you name it.
Yet, for all the usage they’re the less talked about sibling to games, DeFi, and exchange-related dApps.
So, let’s dive into why gambling dApps are so popular, take a look at how a gambling dApp works in practice, and current limitations.
Why are Gambling dApps so popular?
Accessible
Playing a gambling dApp is as easy as going to State of the DApps, finding one that looks fun, having some ETH, and having MetaMask installed.
Most gambling dApps are open and do not require a sign in.
Transparent & Theoretically Provably Fair
Oh, the power of blockchains! For all their shortcomings, transparency is one attribute that can instill trust into end users.
All activity for gambling dApps is on chain. Meaning, you could theoretically look at all transactions for a given gambling contract on Etherscan.
Additionally, most gambling dApp contracts are open sourced and viewable on Github. (ex. here’s the open sourced contract for a popular gambling dApp, dice2win).
This level of transparency for the contract interactions and the ability to independently verify that a game is provably fair (the game logic does what it says it does), makes users feel more comfortable using the dApp.
Instant Payouts
If you win, the payouts are immediately sent to your wallet. No “withdrawing” or cashing in a physical ticket like in the real world.
FOMO Inducing
Just like casinos, gambling dApps deploy a variety of techniques to get you to stay longer and play more. Here are a few ways gambling dApps cultivate the FOMO (fear of missing out):
- Big winner notifications
2. Free spins and bonuses
3. Jackpots
Okay, so how do gambling dApps actually work?
Generally, each gambling dApp’s smart contract will use a random number generator (RNG) to, you guessed it, generate a random number.
Then, the user bets and another random number is generated.
The two numbers are compared and the payout process is initiated (if you win).
Different types of games obviously require differently structured logic to create the game — but they all use random number generators as the main input.
A coin flip game, for example, may require simple number comparing logic compared to a game of roulette or dice.
More Technical Description
Here’s a more technical description of exactly how gambling dApps work from dice2win:
dice2.win picks a secret random number and provides you with its hash.
You send your bet in Ethereum transaction to our smart contract along with the hash from previous step.
At this point dice2.win has already commited to a number, prior to you chosing an outcome.
Once your transaction is confirmed by the network, the contract stores the hash and bet details.
Our croupier bot “reveals” the number by sending a bet settling transaction.
The contract accepts the transaction if and only if the hash of provided number is the same as the stored one.The contract mixes the number and block hash of the bet transaction to get a random number.
The contract decides whether you won or lost and sends you the winning amount of Ether.
Live Gambling dApp Example
To see it in action, let’s walk through the top gambling dApp built on Ethereum, FCK.com, as an example.
FCK.com offers a variety of games but let’s use a fan favorite, roulette, as an example.
You place your desired bet just like you would in a real game of roulette. To test it out, I placed 0.01 ETH on red.
You confirm the transaction (you pay for gas) within MetaMask.
Here’s what the transaction looks like (contract):
The wheel within the interface starts spinning and after about twenty seconds the ball lands on red 7. I won!
Behind the scenes the contract transfers 0.02 ETH back to my address.
Since all the transactions are on chain, you can look at the same contract’s internal transactions to see roulette activity (and winnings or losings) for other participants.
The process is transparent and instantaneous.
Limitations
1.Paying for gas — most gambling dApps require you to pay for gas. My gas fees were $0.78 to wager only $2.50. For larger wagers it may not matter, but for smaller wagers it skews the expected reward.
2. Transparency is a double edged sword. It allows us to independently verify the fairness of these gambling dApps. But, it also allows anyone to see your gambling activity if they know your address.
3. Auditing the smart contract if you’re not technical. Sure, it’s all “on chain” and we can verify the source code but that’s a lot of work to actually prove it is truly fair.