Quest documentation: wheel and lottery

Quest is Incognito’s first pApp, and happily, it has received a great deal of attention. As it’s a game of skill and luck, we thought it’d be helpful to share some details pertaining to how Quest defines ‘luck’.

Briefly, there are 2 rounds to Quest. The 1st round invites players to seek out hidden QR codes in order to unlock the token QUEST, which allows them to spin a lucky wheel and win prizes. One of those prizes is a Bitcoin LOTTO token, which gives the holder access to the 2nd round – a draw to win 1 BTC.

Here’s how winners are selected, how likely they are to be selected, and how it all works.

I. Verifiable random function (VRF):

A verifiable random function (VRF) is used to generate a pseudo-random value on the server-side from the input of users. Based on the property of VRF, a non-interactive verifiable proof is also provided to verify the correctness of the computation. The VRF consists of the following algorithms:

  • KeyGen: Server generates key pairs (private_key, public_key). Server will keep private_key secret and publish public_key.

  • Comp: Players submit their input. Server computes and returns

            (rand, proof) ← Comp(private_key, player_input).
    

To guarantee the uniqueness and unpredictability of player_input, we require players to spend QUEST to the server address each time they spin the lucky wheel. The transaction ID is player_input.

  • Verify: Anyone can verify the correctness of (rand, proof) by checking that

         Yes/No ← Verify(public_key, player_input, rand, proof).
    

We will make public the source code and provide a verification feature that allows players to check correctness.

We implement the VRF algorithms described in this paper.

II. Rules (1st round – lucky wheel):

After generating the pseudo-random value rand as the lottery ticket, the next task is to determine the winning prize.

Due to the uniform distribution property of pseudo-random value rand, we define prize ranges based on the total numbers of distributed QUEST tokens and the total prizes. The following figure shows how the winning prize is determined after the ticket is received.

For this example, let’s assume that the total of 404,500 QUEST tokens distributed to players are spent on the wheel. The prize ranges are defined as follows:

Prize type No. of prizes Percentage Range Li
0.01 PRV 379,835.00 93.9023% [L10:L)
1 BTC LOTTO 21,000.00 5.1916% [L9:L10)
1 PRV 2,000.00 0.4944% [L8:L9)
2 PRV 500.00 0.1236% [L7:L8)
3 PRV 300.00 0.0742% [L6:L7)
0.01 XMR 500.00 0.1236% [L5:L6)
0.1 XMR 100.00 0.0247% [L4:L5)
10 PRV 100.00 0.0247% [L3:L4)
0.001 BTC 100.00 0.0247% [L2:L3)
1 PNODE 40.00 0.0099% [L1:L2)
1VPN 25.00 0.0062% [0:L1)

The domain of rand from [0; L-1] with

L = 7237005577332262213973186563042994240857116359379907606001950938285454250989

The list of range prize Li is computed as follows:

L1 = 447280938030424117056439218976699273229735250888745834734360379374873563

L2 = 1162930438879102704346741969339418110397311652310739170309336986374671264

L3 = 2952054191000799172572498845246215203316252655865722509246778503874165516

L4 = 4741177943122495640798255721153012296235193659420705848184220021373659768

L5 = 8319425447365888577249769472966606482073075666530672526059103056372648273

L6 = 17265044207974370918378553852500591946667780684305589220746310643870119535

L7 = 35156281729191335600636122611568562875857190719855422610120725818865062059

L8 = 70938756771625264965151260129704504734236010790955089388869556168854947107

L9 = 124612469335276159011923966406908417521804240897604589556992801693839774680

L10 = 500328457280832417339332910347335807034781851644151090733855520368733567685

Each rand value that is returned to the player each time they spin the wheel is mapped to one of the ranges above to definitively determine the prize.

III. Process (1st round – lucky wheel):

  1. The server runs VRF_KeyGen to generate key pairs (private_key, public_key) and make public the public_key.

  2. Finalize the prizes and the total number of QUEST tokens to be sent out. Define the prize ranges. Publish all source code and params.

  3. Assume that some QUEST tokens have been distributed during the prelaunch, prior to this implementation. Each time a player spends a QUEST token to the server’s address, the server will verify the correctness of the transaction and call VRF_Comp to compute a random value and proof (rand, proof). Finally, use the prize ranges to map the prize for rand value.

The player must submit their payment address or public key in each transaction (memo) to receive the prize.

  1. Anyone can use the proof value, VRF_Verify function, and the prize ranges to verify the correctness of the result.

IV. Process (2nd round – BTC lottery)

This is conducted similarly to the first round. The only difference is that the prize ranges are not used to determine the winner and the prize.

Each LOTTO transaction spent will receive the pair (rand, proof). At the end of the game, we are able to choose a solution to determine the winner. For example, by using the block hash of the bitcoin chain at height xxx as the input to VRF_Comp to get (rand_b, proof_b). The player that has the random value nearest to rand_b is the winner.

V. Test result

Prize type No. of prizes Percentage Range Li Test result
0.01 PRV 379,835.00 93.9023% [L10:L) 379924
1 BTC LOTTO 21,000.00 5.1916% [L9:L10) 20855
1 PRV 2,000.00 0.4944% [L8:L9) 2070
2 PRV 500.00 0.1236% [L7:L8) 523
3 PRV 300.00 0.0742% [L6:L7) 280
0.01 XMR 500.00 0.1236% [L5:L6) 496
0.1 XMR 100.00 0.0247% [L4:L5) 91
10 PRV 100.00 0.0247% [L3:L4) 95
0.001 BTC 100.00 0.0247% [L2:L3) 103
1 PNODE 40.00 0.0099% [L1:L2) 37
1VPN 25.00 0.0062% [0:L1) 26

May the odds fall in your favor :slight_smile: Happy Questing!

22 Likes

Is this saying there are 404,500 QUEST tokens distributed that will equal 404,500 spins of the wheel? @Chucky

The example assumes that if 404,500 Quest tokens are distributed, they will all be used to spin the wheel, so yes - that would make it 404,500 spins.

Actually only 40 000 tokens are distributed (ans not 400 000 as showed in the example) so you can divide prizes by 10?
It means 4 pnodes to win?

1 Like

How about the tokens are traded by members, so it will base on the last member’s key who holds the token right?

2 Likes

Why I feel like the prizes are smaller and the 1 BTC is out of my hand with this explanation :sweat_smile:

1 Like

hi @Glky, actually we base on the transaction ID sent by who. In addition, to receive the prize, the app will automatically add the owner’s public key into the memo field. Then you will receive the prize :slight_smile:

1 Like

I think we should find more QUESTs to have a higher chance to win prizes :slight_smile:

1 Like

So it’s past 6PM PDT and I am sure that most eastern countries (and south east Asia) has entered the 27th of November. Is the wheel spin actually starting on the 26th? Or is this tied to one more quest still waiting to be completed (551/600 users claimed the QUEST tokens so far)?

3 Likes

Just post the last QR code here and let’s get this show on the road. :grinning:

Other than showing the chance of drawing a prize relative to another, this hypothetical is meaningless.

Two simple questions:

  1. How many QUEST tokens will be distributed?

  2. How many actual prizes are there?

Give those numbers and we can do the math, based on your hypothetical.

@17Strife -

  1. 404,500 distributed (if all chests are open by the end).

  2. check the table in the quote below for prizes if all those tokens are spent on the wheel.

2 Likes

What happens if for example 100 000 QUESTS are not used (A very real possibility because of the 0.08 PRV fee)?

Will the same number of prices be distributed, or will Incognito get to keep the prizes that would have been won by those unused QUESTS?

There is currently no expiry date for this game. It is part of an ongoing educational effort to highlight privacy problems and solutions.

People who don’t want their QUEST tokens can sell them or donate them.

2 Likes

Greetings from Kazan! I want to ask developers to make it possible to exchange QUEST tokens for PRV tokens in the wallet… I have, for example, many of them, but no others… everything has a price!

I’m quite sure there is a liquidity pool for quest tokens. You should be able to trade for PRV.

3 Likes

Yes @vafin you can trade QUEST <-> PRV (and LOTTO too!) by using the pDEX feature in the app under “Trade” on the main screen. If you are new to this feature here is some useful info on pDEX/Trade.

1 Like

My two boys, who are avid gamers, have prompted a controversial conversation at home about the graphic representation of the spin wheel which does not visually represent the odds listed in the chart (above in this thread). They argued that the graphic representation of the spin wheel for people who aren’t in the forum here to see the odds chart is “deliberately misleading”. I pointed out that they can in the app scroll down below the wheel to see total number of spins and how many people have won so far to defend incognito’s efforts to be very transparent about it. But, they point out for many it requires too much effort to calculate the odds from that info below the spin wheel and the image of the wheel implies 1/12 chance for a spin win (which is their main point about deliberately misleading on the odds in the image of the wheel). They think the wheel can and should try to represent the high probability of not winning anything to align with the actual odds of the algorithm and prevent unrealistic expectations when someone looks at the wheel image without being in the forum. I pointed out to them that the point is to draw people into the forum to find out more about Incognito. I continue to defend to them the honest efforts at transparency both in the app and on the forum, but they (25 year olds) were bothered by that spin wheel image in the app and suggested instead a simple “lotto button” (that implies no odds graphically) or even a Magic 8 Ball type button (where no odds are implied in the image itself) or a slot machine spin window where win items fly by and stop on the one that wins. They are simply worried about people’s initial expectations when looking at that wheel which implies higher winning odds than the reality of the algorithm. We all understand that developers are building these tools incredibly fast (and because I had seen the odds chart above earlier, the wheel never bothered me), but the younger generations like them, may have similar responses to the spin wheel image. Something to think about for later iterations of Quest, perhaps.

7 Likes

Please guys, can we see this hunt as a game and move on? Let the devs focus on something that is more essential to the project than this gadget?

I feel the more transparent the team is the more the information is doubted and attacked.

I already know in case the parts of the wheel were to be adjusted to reflect the odds mentioned below it, someone is going to argue about how one part still seems slightly off.

If I were the team I might decide to take down the wheel altogether just to avoid these endless conversations on details that don’t really matter. The hunt was for fun, to play and enjoy, not to spend your life savings on just because your (in general) greedy mind didn’t read passed chances of winning 1 BTC.

Let’s focus on what is really important, providing privacy to crypto transactions.

4 Likes

Great points that your kids bring up @Northhill. It seems like for further iterations, an easy fix would be to change the graphic to something you describe. It’s good to get outside opinions sometimes to see what is overlooked when you are so familiar with things.

Having something like this will allow for less distraction with the game and more exposure to the main point (as @Jamie mentions) of Incognito and privacy.

3 Likes