YoloDice — One Of The Only Fair Odds Of Winning Left

Drs
15 min readOct 16, 2019

--

What is YoloDice

YOLOdice is a game of chance built around Bitcoin and other crypto-currencies. Players play against a (pseudo) random number generator by placing bets. Think lottery. A result of a bet is either a loss (player loses the coins) or a win (player gets more coins than the initial cost of a bet).

Investors on the other hand provide funds (bankroll) for the game, hoping for a long-term return on their investment.

Main highlights of YOLOdice are:

  • It’s fast — players place bets and get responses within milliseconds.
  • 1% house edge — which is low enough for players, high enough for investors’ profit.
  • It’s provably fair — game outcomes can be independently verified.
  • It’s secure — 2FA, cold wallets, server-side security.
  • One can either play or invest in bankroll — test your luck immediately or invest long-term.
  • You can invest with leverage — manage investment risk — find balance between risk and expected profits.
  • Multiple cryptocurrencies for now there’s Bitcoin and Litecoin, we are working on adding more coins.

Playing

How to play?

  1. Set amount of your bet. It’s the amount of coins you put at stake for an individual bet. A bet is like a lottery ticket — “amount” is it’s price.
  2. Tip: you can practice with free bets. Just set amount to 0.
  3. Choose multiplier or chance. These are connected. The higher the multiplier, the lower the chance of winning. If you win your win will equal to multiplier × amount.
  4. Example: set the amount to 1 BTC. If you set multiplier to ×10, your winning chance will equal to 9.9%. The chance is low, but if you win, you win 10 BTC back. Profit from this bet would be 9 BTC.
  5. Example: set the amount to 1 BTC. If you set chance to 90%, the multiplier will set to ×1.1. That’s 9 to 1 chance to win, but the payout is small — you would only win 1.1 BTC back. Profit from winning this bet would only be 0.1 BTC.
  6. Hit Roll LO or Roll HI buttons. The game will roll a number between 0 and 999,999. If the rolled number fits into the range you choose, you win and your balance will increase.

What is the jackpot?

At YOLOdice we have separate jackpots for each cryptocurrency. The rules for hitting the jackpots however are the same.

Jackpot rules

Your bet result (rolled number) must end with “77777” and must be a winning bet. The share of jackpot you win is proportional to your bet amount:
percentage_of_jackpot_won = 100 * bet_amount * f

f is different for each currency and equals:

CoinfMin bet amount to win the whole jackpotBTCf = 1000.01 BTCLTCf = 11 LTCDOGEf = 0.000110,000 DOGEETHf = 100.1 ETH

Any bet that hits the jackpot with amount smaller than indicated above will win only a portion of the jackpot amount, as determined by the formula.

Most recent jackpot hits are listed on the Bonuses page. Player’s hits are listed in Account history.

How much does the faucet drop?

New players can claim faucet 10 times in 24h period. If you have at least one deposit with at least 0.01 BTC you can claim 50 times per 24h.

When checking how many times you claimed the faucet in 24h period is calculated per user and per IP.

The faucet amounts you can get depends on your level and usually range from 100 satoshis to 5000 satoshis. Every time you level-up the faucet amount increases.

If you connect from certain IP ranges (like VPNs) and your level is low, your faucet can be limited. We are sorry about it, but had to do this in order to prevent abuses. Good news is that once you level-up, this restriction does not apply to your account anymore.

Provably fair — how do the numbers roll?

All the roll results are generated using a deterministic, pseudo-random algorithm that:

  1. produce high-entropy results — which means the results are unpredictable without knowing the state of the generator,
  2. all the subsequent results are determined by the initial state of the generator (“seed”).

The provably fair paradigm comes directly from the above:

  1. For the player the results are indistinguishable from random numbers.
  2. At any time the player can “check” if the game hasn’t cheated. The game reveals the random number generator seed so that the player can verify if all the results are OK.
  3. Number generator is seeded not only by a random value generated on the server, but also by an input from the player. This way the game cannot use pre-generated seeds that would result in skewed results.

HMAC with SHA512 hash function is being used to generate roll results. It is proven to produce random-like results and is a perfect fit for the “Provably fair” paradigm.

In details — the algorithm.

Each player has one active seed at any given time. The seed determines all the results returned by the number generator. The seed consists of server-generated random block KK and user-provided phrase K_2. User-generated phrase K_2K2​ can only be entered on new seeds.

Each roll result is generated according to the following algorithm:

First, a result of HMACHMAC function is being calculated:

s = \textit{HMAC}_{\rm SHA512}(K, m)s=HMACSHA512​(K,m)

where KK is a random (per-seed) 1024-bit key generated by the server and mm is a message constructed as follows:

m = K_2 \Vert . \Vert nm=K2​∥.∥n

where K_2K2​ is a player-provided phrase and nn is a bet nonce, i.e. a sequential bet number generated using the given seed. n = 1,2,3\ldotsn=1,2,3…. If a user phrase is “foo bar” and 41 numbers have been generated with the seed so far, then nonce is 42 and the message to be signed is “foo bar.42”.

ss is a 512-bit size value. To map it to the [0,999\,999][0,999999] range it’s converted to hexadecimal format s_{16}s16​ and the first 5 digits are taken (20 bits). If these digits form an integer in the required range, it is returned. If the integer is larger than 999\,999999999, the next set of 5 digits (20 bits) is taken. Note that maximum value of 5-digit number written in hex is \mathrm{FFFFF}_{16} = 1048575_{10}FFFFF16​=104857510​. The procedure is repeated until a result is found.

s_{16}s16​ consists of 128 digits. In an unlikely event when no valid result is found in the 25 firsts sets, the last digit set is taken which consists of 3 hex digits (12 bits) only. The probability of such an event is \approx 1.447\mathrm{e}{-33}≈1.447e−33.

In the following example s_{16}s16​ is generated such that the first set of bits yields integer out of range. The second set of 5 digits (20 bits) must be used.

\underbrace{\mathrm{F564C}}_{1\,005\,132}\ \underbrace{\mathrm{D853D}}_{886\,077}\ \mathrm{01A8F} \ldots1005132F564C​​ 886077D853D​​ 01A8F…

The above algorithm describes the generator function that’s used at YOLOdice and maps:

G(K, K_2, n) \rightarrow r \in [0, 999\,999]G(K,K2​,n)→r∈[0,999999]

This Ruby code example contains the reference implementation.Toggle code

KK is always hidden for an active seed, but H_{\rm SHA256}(K)HSHA256​(K) is shown. Once the player generates a new active seed, KK is revealed and player can verify all bets generated using KK and K_2K2​.

How to verify bets?

Click on a seed you want to verify. If it’s still current, click “Reveal” on the server secret. Once you click “Verify bets” the game will prepare a downloadable file with the list of all bets generated using the seed. The file can be checked by a 3rd party tool.

All bets in the file can be verified with a tool available at github.com/ethan-nx/yolodice-validator.

The format used in the dump file (it’s a CSV file) is as follows:

First row:

SEED_ID - internal ID of a seed
HASHED_SECRET - SHA256 hexdigest of the secret
SECRET - hex-encoded secret key
CLIENT_PHRASE - user-provided hashing string
CREATED_AT - unix timestamp of seed creation time

The following rows:

BET_ID - internal ID of a bet
NONCE - nonce of a bet
ROLLED - result of a bet
TARGET - numerical target of a bet
RANGE - 'lo' or 'hi'
AMOUNT - amount of a bet
PROFIT - profit of a bet
JACKPOT_PROFIT - profit from the jackpot
COIN - coin symbol, lowercase

Third party verifiers

Note! YOLOdice takes no responsibility for 3rd party websites. Use at your own risk.

Amount, profit, chance, multiplier explained (with math)

YOLOdice is for cryptocoin geeks, so do not mind a few equations.Amount of a bet

Amount of a bet aa is considered a “price” of a bet. It’s the amount of coins you put at stake when you place a bet.

Multiplier and win amount

Multiplier (mm) denotes how much you can win (ww) on a single bet.

w = maw=ma

Imagine buying a lottery ticket. If you buy a ticket for a = 1\; {\rm BTC}a=1BTC with multiplier m = 2m=2, you could either lose and win nothing, or win w = ma = 2 \cdot 1\; {\rm BTC} = 2\; {\rm BTC}w=ma=2⋅1BTC=2BTC.

Profit

Bet profit is a difference in your balance as a result of placing a bet.

p = \begin{cases}p_{\rm w} = a\left(m-1\right) & \text{if the bet is a winning bet},\\p_{\rm l} = -a & \text{if the bet is a losing bet}.\end{cases}p={pw​=a(m−1)pl​=−a​if the bet is a winning bet,if the bet is a losing bet.​

If you place a bet with a = 1\;{\rm BTC}a=1BTC with m = 3m=3, the amount you can win is w = 3\;{\rm BTC}w=3BTC. Your bet profit can be either p_{\rm l} = -1\;{\rm BTC}pl​=−1BTC if you lose, or p_{\rm w} = 2\; {\rm BTC}pw​=2BTC if you win.

1% house edge and win probability

House edge (site advantage) is a mathematical advantage that describes the ratio of the average loss to the bet amount. It guarantees long-time profitability of the site and affects the relation between win probability P_{\rm w}Pw​ and multiplier mm:

m = \frac{1 — d}{P_{\rm w}}m=Pw​1−d

where dd is house edge. At YOLOdice d = 0.01 = 1\;\%d=0.01=1%.

If you place a bet with m = 2m=2 at a zero-profit game, the probability of winning would be 0.50.5. When d = 0.01d=0.01 and m = 2m=2, the probability of winning a bet is P_{\rm w} = \left(1–0.01\right) / m = 0.495Pw​=(1−0.01)/m=0.495, which is slightly less than 50% you would expect in zero-profit (d = 0d=0) game.

At non-complex games the house edge describes the average loss per bet, but also expected loss as a fraction of wagered amount. It becomes important for investors since they can expect site profit as a fraction of site wagered amount.

Roll ranges

The random number generator works on discrete numbers and produces results in range \left[0, 999\,999\right][0,999999] (1,000,000 possible outcome values). Once the parameters of the bet are set, namely aa, mm and P_{\rm w}Pw​, before the dice rolls, the game calculates “winning ranges”. Here’s how it’s done.

t = 1\,000\,000 P_{\rm w}t=1000000Pw​

The target tt is the number of possible outcomes that result in a win. It is used to define winning ranges as follows:

R =\begin{cases}R_{\rm lo} = \left[0, t-1\right] & \text{(“low” range)},\\R_{\rm hi} = \left[999\,999 — t, 999\,999\right] & \text{(“high” range)}\end{cases}R={Rlo​=[0,t−1]Rhi​=[999999−t,999999]​(“low” range),(“high” range)​

The game offers two ranges a player can choose from, named “high” and “low”. This adds extra randomness introduced by the player. Each of the ranges consists of tt discrete values that describe conditions for winning a bet.

If the rolled number falls into the chosen winning range, the player wins.

For a bet with 10% win chance (P_{\rm w} = 0.1)Pw​=0.1), t = 1\,000\,000 \cdot 0.1 = 100\,000t=1000000⋅0.1=100000, the ranges are: R_{\rm lo} = \left[0, 99\,999\right]Rlo​=[0,99999] and R_{\rm hi} = \left[900\,000, 999\,999\right]Rhi​=[900000,999999]. Each of the ranges contain 100\,000100000 elements, which is exactly 10% of the whole codomain.

Rounding issues and internal representation of bets.

Computers operate on discrete values, coins are discrete up to their smallest atomic unit (bitcoins are discrete up to 1 satoshi). YOLOdice solves the rounding issues by operating on 1/100,000,000th of the coin (equivalent to bitcoin satoshis) internally. Whenever we store coin amounts, we store integers. Never floats.

When calculating bet outputs however some rounding is unavoidable.

Each bet is represented by only a few fundamental values: amount aa, target tt, range type (“high” or “low”), rolled result rr. Values such as multiplier, chance or profit are derived from these values, i.e.:

\begin{gathered}P_{\rm w} = \frac{t}{1\,000\,000}\\p_{\rm w} = \left\lfloor a \left(\frac{1\,000\,000}{t}\left(1 — d\right) — 1 \right)\right\rfloor\end{gathered}Pw​=1000000tpw​=⌊a(t1000000​(1−d)−1)⌋​

What is the profit limit of a bet?

Limit on profit of a single bet is

p_{\rm max} = \min\left\{ 0.005 B_{\rm eff}, 0.025 B_{\rm d} \right\}pmax​=min{0.005Beff​,0.025Bd​}

where BB is the effective bankroll (aka leveraged bankroll, including leverage loans), B_{\rm d}Bd​ is deposited bankroll. The player cannot place a bet that would result in profit larger than p_{\rm max}pmax​.

This limit ensures optimal bankroll growth rate while minimizing the variation in the bankroll.

TL;DR; A single bet cannot win more than 0.5% of effective bankroll or 2.5% of bankroll, whichever is lower.

Why is there a delay for small bets?

It’s there to prevent flooding the server with too many bets that do little contribution to the game. The internal delays are:

Bet amountdelay0 BTC2 seconds0 … 0.00000010 BTC1 second0.00000010 BTC … 0.00000100 BTC0.5 second0.000001 … 0.0001 BTC0.2 secondall larger betsno delay

The delays are similar with other coins.

If you are level 10 or above, your delays are reduced so that you can play faster.

What is “luck”?

“Luck” is a measure of how well you play against random numbers. When displayed, luck is scaled to [-100%, 100%]. Your luck equals to -100% if you only have losing bets, while it equals to 100% if you only have winning bets. The longer you play the closer your luck gets to 0.

“Luck” does not take bet values into account. Your luck could be negative, while your profit positive and vice versa.

The detailed formula for luck (scaled to [-1, 1]) is:

l = \frac{L_{\rm w} — L_{\rm l}}{L_{\rm w} + L_{\rm l}}, \quad L_{\rm w} = \sum_{b \in S_{\rm w}}(1 — p_{{\rm w},b}), \quad L_{\rm l} = \sum_{b \in S_{\rm l}} p_{{\rm w},b}l=Lw​+Ll​Lw​−Ll​​,Lw​=bSw​∑​(1−pw,b​),Ll​=bSl​∑​pw,b

where p_{{\rm w},b}pw,b​ is the probability of winning for a single bet, S_{\rm w}Sw​ is a set containing all winning bets and S_{\rm l}Sl​ is a set containing all losing bets.

Investing

Investing has been disabled on 20th September. All bankrolls are private.

Withdrawals and deposits

How many confirmations do you require on deposits?

Depending on the coin and deposit amount we require from 1 to 4 confirmations for Bitcoin and Litecoin networks. In some cases, if the transaction has decent network fees, we might even credit the transaction to player’s balance before it’s confirmed in a block.

How are withdrawals processed?

There are two kinds of withdrawals: instant and batch.

Instant withdrawals are processed immediately. As a result of creating a withdrawal a transaction is returned. The user can then monitor the withdrawal either in YOLOdice account history tab or via any blockchain explorer.

The only exception when an instant withdrawal is not processed immediately is when there are not enough funds in game hot wallet. For security reasons we try to keep most of the funds in cold wallet, which is controlled by an air-gapped off-line storage. Transferring funds from cold wallet is a manual process which can take from a few minutes to few hours. In such a case the withdrawal will be marked as “pending” and will be submitted to network as soon as funds are moved. User can cancel a pending withdrawal at any time.

Batch withdrawals are grouped and sent in a single transaction. The fee is lower, but it can take up to a few hours.

All transactions we send have decent network fees and are targeted to be confirmed wihin next few blocks.

Privacy

Which of my data is public / private?

The following data associated with your account is private:

  • your login, password, master address, 2FA settings,
  • your coin balances,
  • your investments,
  • your email address,
  • your deposits and withdrawals.

The following data is public:

  • your bets (can be anonymized),
  • your seeds (can be anonymized),
  • your game profit (can be hidden),
  • your investments (only displayed as anonymized data),
  • your user name,
  • your level.

All bets and seeds are public so that people can independently verify the game mechanism.

A list of investments is public, although stripped of owner’s information — investments cannot be linked to individual accounts.

Players can fine-tune their privacy settings and e.g. hide their stats and anonymize their bets. The settings are available at Profile page.

Security

Master address — what and why?

YOLOdice users are asked to either set login and password, or provide a master Bitcoin address before they make their first deposit. Master address is used to:

  1. authenticate users — the default login method is based on signing messages. Signing messages is nothing new and most savvy users are familiar with the procedure. Most Bitcoin wallets support message signing,
  2. the default Bitcoin withdrawal address — we assume users are in control of the address, therefore this ensures the funds are not sent to a wrong address,
  3. emergency withdrawal address — in case something goes wrong with YOLOdice we might need to return all funds to the users. Master addresses would be used then.

How do I login with my master address?

Users that set up their master address can login to YOLOdice using this address. Here is how it works:

  1. on a login page select With master address,
  2. paste your master address,
  3. the page displays a random message (challenge) to be signed — copy it to your Bitcoin wallet, sign with your master address and copy back,
  4. the server checks if the signature is correct, i.e. if the challenge is signed with your address; if so, you are logged in.

Logging in with master address has some security benefits:

  • messages can be signed only with a private address key,
  • your secret key never leaves your wallet,
  • Bitcoin users are usually pretty good at keeping their keys secure.

Currently, only Bitcoin master addresses are supported.

How can I make my account more secure?

Here are a few tips:

  • keep your master address private key secure — if anyone gets access to your priv key, it’s bad,
  • use 2-factor authentication — some actions will require unique codes generated by your device (e.g. phone)
  • if you use “classical login” with password, make sure password is not trivial. Enabling 2FA for password login helps a lot.
  • protect critical actions with 2FA: logging in, withdrawals, managing investments and playing.

Are my funds at YOLOdice secure?

We do our best. First, we help you protect your account — hacking individual accounts are much more common than hacking whole services.

We offer secure logging in via message signing, 2-factor authentication, withdrawal address restrictions.

We keep servers secure by the multi-layered application stack design with strict permissions and strict access control. We’ve been running a pretty popular web services for years without any breaches.

Cold wallet funds are controlled using air-gapped, off-line, encrypted cold wallet devices. Cold wallet priv keys never leave the devices. Transactions to be signed are transmitted over air (audio setup).

Cold wallet is a 2-level design:

  1. first level consists of a single P2PKH address. Each device has a copy of the priv key.
  2. second level consists of a P2SH address with 4 keys. Transactions need to be signed by 2 keys. Each of the devices contains a single key, thus any transfer from deep cold wallet requires signatures from 2 devices and must be verified by 2 persons independently.

Our cold wallet addresses are:

  1. 16Etk8DeJvD4e9KP1Ke8DvZYjUPWAN6FK8
  2. 3BtzzBGmCAJh8JHKb5tMVkwFyN6pubQiDT

I lost access to my account. What can I do?

Email us at support@yolodice.com.

If the account has no master address set, no deposits, no login nor password — we cannot recover it.

We are really careful and conservative when recovering access to accounts. On one hand this might be painful for people that really lost access to their accounts, on the other hand it’s really necessary agains hacking.

A few tips for NOT losing access to your account permanently:

  1. Complete your account setup & set master address, login and password.
  2. Keep your master address (and it’s private key) secure so that you can sign messages with it.
  3. Use complex password, but do not lose them (use a password manager if you cannot remember it).
  4. Add your email address to your YD account.

Referrals

How does the referral program work?

Any YOLOdice user can join the referral program and earn coins for referring people to play the game. Here is how it works:

  1. Each user that creates an account after following your referral link counts as your referral.
  2. You earn 0.2% of the amount wagered by all your referrals.
  3. The payouts are released on-demand directly to your YOLOdice account.
  4. All supported coins are calculated separately.

Can I use my ref link to create new users by myself?

Referring yourself to take advantage of the system is unacceptable. Referring yourself will result in the permanent removal of your affiliate commission.

Am I earning only when my referrals are losing? What if they are winning?

No. Your share in weekly pool raises when your referrals play with non-zero amounts, either when win or lose. Even if your referrals win, you earn.

Why am I not earning?

In general the reasons you are not earning can be any of:

  1. you have no referrals,
  2. your referrals are not playing in the given week (zero-amount bets do not count),

In general the more referrals you have and the more they play, the larger is your payout.

How can I share my referral link?

Whatever works for you. Some people put it in forum signatures, share on Twitter, Facebook or give directly to their friends. Usually personal recommendation works best, but please be honest that you are sharing a referral link and you benefit from it — it works even better. Running campaigns and sharing your referral payout with your referrals is also accepted.

Please do not post misleading information when promoting your link and do not spam.

Note that creating referrals by yourself to take advantage of the system is generally disapproved.

Misc

How can I contact you?

Contact us via:

Is there a public roadmap? How do I submit my ideas for the site?

We have a public Trello board that collects (reasonable) ideas as well as bugs. You can also see what’s planned for the site and what we are currently working on.

--

--