# Let Eth Roll

Sep 25 · 4 min read

In November 2017 I asked “one of the most influential crypto bloggers” if he used crypto for anything other than speculation/HODLing. His response… I was in the weeds…

In the meantime, I have looked for ways to use cryptocurrency, and get more into the weeds.

• Buying the Bitcoin Money book was my first direct purchase with BTC.
• Using Uniswap as a place to exchange ERC-20 tokens instead of a centralized exchange.
• Compound and Dharma for Defi to lend out Dai I got from the uniswap exchange, after “cashing out” a profitable LINK trade.

One aspect of the blockchain that drew me in was the ability to audit all transactions. As a data guy having access to this giant ledger was exciting

## Etheroll

When seeing Etheroll I found a dapp (decentralized application) I wanted to analyze. One places a bet of ETH and selects the chance of winning, with the potential profit based on the expected value of winning.

I showed the dapp to a few friends that all had the same reaction. “How do I know it’s legit?” While one can read the code being executed here Etheroll Smart Contract, reading 2,241 lines of solidity was too much. So I did what any data guy does and started writing some python.

Using Etherscan.io API I was able to gather roll information on 3,159 rolls

I wanted to know if there was any correlation between the roll and roll under amount and if there were any anomalies with roll outcomes.

I got that the average `result` — a binary 1 for winning 0 for losing was 48% which is incomplete without the `roll under` which is the bar for winning and in turn probability.

The mean and median for `roll under` was ~50, so that the change of winning was ~49%. which falls in line with the result above.

## Roll outcomes

We expect each roll to show up 3159/100 or 31.59 times, 50 and 51 had been rolled 24, and 21 times respectively or .76% and .66% when we expect 1%.

Interesting that I found 6 cases of a 0 being rolled, with 3 of them being done within a small time window on September 20th. This bug happens 0.19% of the time so I would not count on it for your edge.

EDIT: From etheroll the 0 is error handled by the smart-contract.

It derives from an error in regards to the random.org or Oraclize API, in which case a 0 results in the bet being void and the original wager is refunded to the player via the following code:

`if(playerDieResult[myid] == 0 || bytes(result).length == 0 || bytes(proof).length == 0){//refund...}`

The contract above that rolled 0 three times is one of the top 5 rollers for Etheroll and has a mean roll under of 8.5. And we can learn a strategy from him.

## How people bet

While most players “flip a coin” with a near 50/50 probability of winning. There are some (including 2 of the whales) that have a much lower `roll under` amount; with an average of ~8.

With a roll under of 8, a wager of 1 ETH would have a profit of 13.14 ETH, and if you feel lucky that would win before 13 rolls you would be profitable.

It is comforting to see that `roll under` and `roll` has no correlation.

# Conclusion

Studying for the coming holiday I came across a relevant passage.

“And these are they which are not qualified [to be witnesses or judges]: A dice player, a usurer, pigeon racers, or traffickers in Seventh Year produce, and slaves.” — Mishnah Rosh Hashanah 1:8

Who would have thought in 2019 dice rolling would still be popular. The disqualification comes when one’s livelihood is dependant on gambling and not a 1 ETH wager.

Etheroll is provably fair and easier to get to than Las Vegas, and Etherscan’s APIs is a great tool auditing the performance of a smart contract.

Try doing this at a casino…

Jupyter Notebook

Written by

## Matt Sedaghatfar

#### Data Consultant at Tevunah

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just \$5/month. Upgrade