Lucky Number - Lottery type game feedback

Hey!

Last few weekends, I’ve been dabbling into a very basic and simple Lottery type game for secret network.

It’s called Lucky Number and basically there are 3 Pools, each having a range of numbers that users can choose and different round time intervals.

So, users can go to a pool, choose a number and pay a fixed amount of sSCRT into the contract. After the predetermined time associated with that pool, there is a trigger to generate a random number on the pool. (The triggerer gets a fixed fee of the pooled sSCRT to pay for gas costs)
If there is enough participants on that pool, the pooled sSCRT is distributed to the winners that got the winning number right. if no one choose the winning number, the pooled sSCRT goes to the next round as a Jackpot!

Example pools:

  • Pool 3:
    • Entry fee: 1 sSCRT
    • Numbers: 1 - 5
    • Minimum Participants: 5
    • Round Time: 5 min
  • Pool 2:
    • Entry fee: 5 sSCRT
    • Numbers: 1 - 15
    • Minimum Participants: 15
    • Round Time: 1 hour
  • Pool 1:
    • Entry fee: 10 sSCRT
    • Numbers: 1 - 30
    • Minimum Participants: 30
    • Round Time: 12 hours

Here is the holodeck-2 testnet version of this working: https://thatrand0muser.github.io/
Preview:

This is only implemented in sSCRT for now but any SNIP20 can be integrated.
Probably will do SEFI too before deploying to mainnet.

Would really love some feedback on this!

Here on the forum or if you want to DM me:

Discord: :bust_in_silhouette:RandomUser#2785
Telegram: Telegram: Contact @ThatRand0mUser

8 Likes

The UI/UX is nice and easy to understand! Would have to check the code but this lottery sort of idea is such an ideal use case for Secret network.

2 Likes

Very nice idea :+1:. I have a few suggestions:

  1. Make it very, very clear from where and to where the funds are going/coming. New users might feel like this is just another scam where they lose money been greedy. I mean, maybe you would need some sort of “public viewing key” so everyone can see and, to some limit, track something (not all of course).

  2. I would call the pools something else. Pools reminds me of AMM and Liquidity Pools. Also 1 2 and 3 is confusing. Maybe Minute, Hourly and Daily “jackpot” :thinking:?

  3. Any chance of having a Random number bet ? Lets say I am too lazy to choose a number, just a button that chooses for me :sweat_smile:. lol.

  4. What about Multiple numbers at a time, is it possible? Like bet in 3 different numbers in the same run (only one fee).

  5. Display the current winning chance. It might looking deceiving but I think users will simply choose the “pool” with higher chance, instead of not placing any bet.

I tried to open the testnet but site was “empty”, only header loaded, maybe you’r tweaking right now hehe. Looking forward to testing, and hopefully winning.

1 Like

Thank you very much for the feedback.

  1. Yeah I was thinking of putting some help indications on some places indicating what is going on to help with that.
  2. I agree, will change some nomenclature on the next few days
  3. Sure, it’s easy to implement
  4. For this I would need to change somethings on the contract as 1 wallet is only able to bet on one number for now. Probably will implement this on the next iteration of this (already have a lot of ideias to expand this project on :smiley:)
  5. Yeah I can display this on the “pool” info

Humm, probably you did not have keplr installed/ready. Will also try to put a warning if keplr is not installer or ready.

I just found a possible exploit in the case of multiple-bets:

Lets say the Pool A has 5 SCRT jackpot.
User A bets on number 1, pays 1 SCRT.
User B bets on 1, 2, 3, 4, 5, pays 5 SCRT.
Drawn number 3, user B gets 11 SCRT.
Drawn number 1, user A and B get 5.5 SCRT.

See where I am going :exploding_head:? A user could potentially bet on all numbers all the time.
A way to circumvent this would be to make the second bet more expensive.
By how much :thinking:? I don’t know, I guess you’re the one into gambling hehehe :sweat_smile:.

When I first tried the link Keplr asked if I accepted experimental stuff, and I did. Maybe I should be using a different network? I don’t know.
Now I get this screen:

Yeah, I know where your going. That is one of the reasons 1 wallet can only bet on one number on a specific round.
There is no way to circumvent a user creating 5 different wallets and betting on all 5 numbers.

So imagine that I want to always win on the 5 minute rounds, I would create 5 different wallets and bet on all 5 numbers paying 1 sSCRT + Gas fees on each individual bet.
This only makes sense if there is a Jackpot that is worth it OR if there are more participants on this round.
If there are more participants on this round I’m essentially betting that the other participants will not get the lucky number and I will receive the full pot size, because if there are more that 1 winner the pot size is divided by the winners equally.

Example:
Pot size: 4.5 sSCRT Jackport
User A bets on 1,2,3,4,5 (5 sSCRT)
User B bets on 1 (1 sSCRT)
Pot size is 10.5 sSCRT

Drawn number is 1, distribution of rewards:
Triggerer fee: 0.5 sSCRT
User A reward: 5 sSCRT
User B reward: 5 sSCRT

Here the User B net profit is + 4 sSCRT but the net profit on User A is negative because he got the 5 sSCRT that he gambled back but the gas costs of the bets were lost.
This is amplified if there are more Users on the pot.

Regarding Keplr, when you enter the site you shoud have a popup to unlock/connect keplr then it will unlock the website :s
The secret network testnet is holodeck-2 but I think you should be able to access all without changing the network on keplr

So I believe the only way to avoid this issue would be to require a combination of numbers. Instead of 1 in 5 numbers to bet, be like 2 in 20 in the first pool, and only add more to the others.
:thinking:
I also think that having a certain percentage of the jackpot accumulate to the next run help guarantee a minimum pot and thus incentivize more users to bet. This would make so that some smart-pants trying to bet on every number would not get 100% of his money back.

The math:
:man_teacher:
The smart-pants would need to create a total of 190 wallets, to bet two numbers on each, spending a total of 190 sSCRT. While if we had 1 in 20, he would only spend 20 sSCRT.
And if we get a prize higher than that, lets say 200 sSCRT, I am sure (hope) other users would bet too, and thus he would need to share part of prize making it less attractive.
Even if he keeps winning, lets say someone with tons of money, the pool will eventually get smaller prize and wouldn’t be worth it.

Yes, doing a more “traditional” type of lottery where the bet is a sequence/combination of numbers will be much better for these kinds of lottery games and cant be easily exploited.

As I stated before, this is kind of a very basic and simple game and was mainly done to get a POC and some experience on this.

I’m envisioning the next iteration of this being something similar to pancake swap lottery (PancakeSwap), totally run on-chain, with the inherent private characteristics of secret network. On top of that, instead of doing burns, the Jackpot will be staked on SEFI staking pool, increasing the Jackpot size progressively and then increasing interest on the rewards.
Also have some ideas for scratch cards using secretNFTs with some similar reward structure.

Lots of stuff to build :smiley:

1 Like