quantadex / quanta-core

QUANTA core blockchain based on Graphene, PoS, 1 sec onchain orderbook & settlement https://quanta.gitbook.io/documentation/
https://quantadex.com
MIT License
0 stars 0 forks source link

QPI-04 - Rolling dice #4

Open quocble opened 5 years ago

quocble commented 5 years ago

Motivation

The cryptomarket is full of risk taker which really blurs the line between traders/gamblers. Even for derivatives, the CEO of Bitmex has repeatedly say that it caters to gamblers and retail traders. We dived into the gambling scene to discover tons of gambling talks to bitcointalk. It ranges from dice, sports, to full on casino. We find that the dice game is simple, addictive, and target the right demographic for our traders. The dice is discrete game that the user can control their own risk vs reward. So if the user chooses a dice (from 1-100) for a number under 5, then his chance of winning is 1 / 0.05 = 20. The house take say 1% of that. In this proposal, we propose a "roll_dice" operation on the blockchain.

Scope

This would be created as standalone blockchain operation without any coin.

Design

We're going to design a roll_dice with the following parameters.

roll_dice <user> <coin> <risk> <bet>

Parameters: user: The user rolling coin: The coin user is taking risk: The amount of coin the user is risking bet: a string that an OR of traditional | numbers | odd_or_even traditional - can be less than or greater than "<5" or ">95" numbers - can be a series of numbers, say "5,8,9,10" odd_even - can be "odd" or "even"

Only one type of bet can be placed. The reward is calculated for each case.

Calculate fees

System

The fees are calculated then sent to a special pool (TBD) and the loss are also sent to a special pool (TBD). Winnings are taken out from the loss pool.

Randomness function / fairness

We want to produce an unpredictable randomness that is tamper proof even for block producer. Leveraging from (1), we can provide a randomness function

n = sha3(prev, seed=current_bet)

References

  1. https://cryptogambling.org/whitepapers/provably-fair-algorithms.pdf
  2. https://bitcointalk.org/index.php?board=56.0
  3. primedice.com
  4. https://github.com/yahoo/coname/blob/master/vrf/vrf.go
  5. https://gist.github.com/alexvandesande/259b4ffb581493ec0a1c
Ken0sis commented 5 years ago

Calculate Fees

risk_per_roll := {type: integer ,meaning: This is how much players can choose to pay per dice roll } num_faces := {type: integer greater than 0 ,meaning: Number of faces on the dice and the number of dices, which is directly equal to the number of possible outcomes. } prob_event := {type: float valued between 0 and 1 ,meaning: The probability of the event that the player is betting on. The event can be defined as "When dice is rolled 4 and under" or "When the face value is odd".
,calculated_value: This is defined as a function of num_faces } fee_rate_per_win:= {type: float valued larger than 0 ,meaning: How much fee the house will take when the player's event comes true ,calculated_value: 1% } fee_per_win:= {type: float valued larger than 0 ,meaning: How much fee the house will take when the player's event comes true ,calculated_value: (1/prob_event)*(fee_rate_per_win)*risk_per_roll } payout_per_win:= {type: float valued larger than 0 ,meaning: How much the player will get back after a winning event. ,calculated_value: risk_per_roll*[(1/prob_event)*(1-fee_rate_per_win)-1] }