Table of Content 9
Key points
-
Code
A smart contract is a program at an address on a blockchain, with its own code and data (ethereum.org).
-
Final
Interactions with a contract are irreversible, and contracts cannot be deleted by default.
-
$50m
Drained from The DAO through a code flaw in June 2016, which led to the Ethereum hard fork.
-
On-chain proof
Chainlink VRF publishes a proof with each random number, verified on-chain before a game can use it.
What a smart contract does in a casino
ethereum.org defines a smart contract as a program that runs on the blockchain: code and data at a specific address. In gambling, a contract can hold the bankroll, accept a bet, ask for a random number, and pay the result to your wallet in the same flow. The rules are public, and the contract follows them the same way for every player.
Contracts cannot read the outside world on their own. Anything from off-chain, including a random number generated by a service, arrives through an oracle, which becomes one more part you rely on.
Three ways a crypto game can prove it is fair
| Model | Who runs the game | What you can check | What you still trust |
|---|---|---|---|
| Certified RNG | The casino or game studio | A testing lab's certificate | The lab and the operator |
| Provably fair seeds | The casino's server | Each result, from the server seed hash, your client seed and the nonce | That the casino pays out what the result says |
| Smart contract with verifiable randomness | A contract on a blockchain | The contract code, the random proof and the payout transaction | The code, its auditors and the oracle |
ethereum.org: smart contracts; Chainlink docs: VRF. Read 6 Oct 2026.
Provably fair is the common middle ground at crypto casinos: the casino commits to a hashed server seed before you bet, and you can recompute each result afterwards. Our provably fair casinos page lists casinos with this, and crypto dice walks through a verification.
Random numbers on a public chain
Everything on a blockchain is public, so a contract cannot simply pick a secret random number. Services such as Chainlink VRF generate the number off-chain together with a cryptographic proof, and the proof is verified on-chain before the game can use the number. Chainlink states that the result cannot be manipulated by the oracle operator, the developer, the player or the block builder.
What can go wrong
- Bugs. In June 2016 an attacker used a flaw in The DAO's contract and drained about $50 million in ether. Code that holds a bankroll is a target.
- Upgradeable contracts. Some contracts can be changed through upgrade patterns. Then you trust whoever holds the upgrade keys.
- Token approvals. To bet with a token you often approve the contract to spend it. An unlimited approval lets the contract move all of that token from your wallet, even later. ethereum.org recommends approving only what you need and revoking access you no longer use.
- No chargeback. A transaction that runs is final. A mistake, a phishing site or a bad contract cannot be reversed.
Where smart contracts show up in crypto gambling
At a custodial crypto casino you deposit to an address the casino controls and play from a casino balance; the only contract involved is the token you send. You meet contracts directly when you connect a wallet to a dApp casino or sign in with MetaMask. For the pooled-bankroll model, see DeFi in crypto casinos; for keeping control of your coins, non-custodial casinos.
Terms
- Smart contract
- A program stored at an address on a blockchain. So what: Its rules are public; its mistakes are permanent.
- Oracle
- A service that brings off-chain data, such as random numbers or prices, to a contract. So what: A game is only as fair as its oracle.
- VRF
- Verifiable random function: a random number with a proof anyone can check. So what: Lets you confirm the casino did not pick the result.
- Token approval
- Permission for a contract to spend a token from your wallet, up to a limit. So what: Revoke approvals you no longer need.
Smart contract FAQ
What is a smart contract in gambling?
A program on a blockchain that holds funds, takes bets and pays out by its code. ethereum.org describes it as code and data at a specific address.
Are smart contract casinos safe?
They remove the need to trust a cashier, but add code risk. A bug can be exploited, as The DAO hack in 2016 showed, and transactions cannot be reversed. Look for published, audited contracts and limit what you connect.
Do smart contracts make payouts instant?
A contract can pay in the same transaction as the bet, so the wait is the chain's block time. You still pay network fees for each bet you place on-chain.
How is randomness made fair on a blockchain?
Through a verifiable random function such as Chainlink VRF, which delivers a random value with a proof that is checked on-chain before the game uses it.
What is a token approval and why revoke it?
Permission for a contract to spend a token in your wallet. An unlimited approval lets it move that token later. Revoke approvals you no longer use with a tool such as Revoke or a block explorer.