\[ALPHA\] FTC dice / coinflip game
-
[quote name=“Kevlar” post=“45954” timestamp=“1387401548”]
[quote author=UKMark link=topic=5931.msg45949#msg45949 date=1387401190]
[quote author=Kevlar link=topic=5931.msg45248#msg45248 date=1387237854]
[quote author=slavco link=topic=5931.msg45243#msg45243 date=1387236020]
They reveal server seed not secret. As i understand secret is revealed after the play
[/quote]They reveal the hash of the server secret. Afterwords, they reveal the secret. I can take the secret, and hash it myself, and compare it to the hash they showed.
[/quote]Exactly what ftcgames does, TXID of the placed bet + the secret - whether the secret shows immediately after or 24 hours or a week or even a year later is irrelevant because there isn’t a cat in hells chance of reproducing [i]exactly[/i] the same hashes for [i]every[/i] given hashed result using a different secret and the same given formula.
…And we also offer less than 2% house edge. :)
Now on a similar note I have a question for Kevlar that has bugged me for ages even though I have implemented this system myself because other sites do this -
But, is the reason to show the secret after the bet because the TXID could be altered by the punter to generate the result they required if it was shown before? < Is this really possible? And if so how could it be pulled off? Or is it because no-one really knows if it’s possible? :)
[/quote]Yes, it’s entirely possible. Here’s how I would do it.
If I knew the secret ahead of time, I’d generate a transaction that I wanted to win. I’d then sha256(sha256(tx)) to get it’s ID. If it was a losing ID, I’d add another output spend to an address I owned for 1 satoshi to the tx, and get the new ID. If this ID lost, i’d increment the amount to 2 satoshi’s, check the id, increment to 3 satoshis, check the id… and keep repeating that until I got a winning transaction. I would then broadcast that transaction to the network.
[/quote]Brilliant thanks for that. 8)
Hmmm now to find those sporadic sites that show before you play or worse still just sha256 the txid :o, if they haven’t gone bust by now that is. :D
-
Yup on small amount of bets I can easy find the secret ( with given formula ) that will satisfy the games outcomes e.g. prove that system is fair. For x number of bets probability for me to generate secret key that will prove that game is fair is 0.5^x. For example if we have 10 bets and I want to generate secret that will satisfy the outcomes probability for me to find that secret is 0.000976562 ;)
The only fair situation is the following: to reveal before the bet hash of the secret and after the bet to reveal the secret.
Do you want to make an experiment:
- I’ll reveal the formula
- I’ll create special address for you
- You place 5 bets x 10 FTC ( you will loose them all )
- I’ll give you secret that will satisfy the formula and the outcome
What do you think? :)
-
thx for 1 ftc , I have played 2 dayys ago , i sent 0.1 on the head , and received back shortly after a small amount like 0.001 ftc , after that I sen another 0.2 to the head adress and again I received 0.001 and I sent again 0.1 to the head adress and another 0.001 was received . That means I lost all the bets ? is this what the system should work ?
-
[quote name=“slavco” post=“43762” timestamp=“1386935546”]
6headp1fo8AmDoFvuJndGT3b4VTEiwVU7E ( number between 50-99 ) odd 1.85 ([url=http://explorer.feathercoin.com/address/6headp1fo8AmDoFvuJndGT3b4VTEiwVU7E]http://explorer.feathercoin.com/address/6headp1fo8AmDoFvuJndGT3b4VTEiwVU7E[/url])6taiLoiPTGPuQXFRLPyreYTaQyyTBQbxbM ( number between 0-49 ) odd 1.85 ([url=http://explorer.feathercoin.com/address/6taiLoiPTGPuQXFRLPyreYTaQyyTBQbxbM]http://explorer.feathercoin.com/address/6taiLoiPTGPuQXFRLPyreYTaQyyTBQbxbM[/url])
Min bet: 0.1
Max bet 0.5
( Lower or bigger amounts will be captured by the addresses and not included in the game )Fair play ( There will be fairness calculator script ) :
- Your transaction id
- Game key
- number = last 4 bytes of md5(txid+key) to integer module 100
* Play with official client not via shared wallet!
* Bonus: First 3 players who hit 0 ( you can calculate your number when i publish the Game key ) no matter if you play head or tail will be revarded 5 FTC each if they find their winnings.
* First 10 players that don’t have FTC to test just drop me a note and I’ll send you amount for testing
* Will be online until 19:00 ( CET/GMT+1 ) *Scripts are up and running until enough transactions are performed*
* If problems appear please use this tread to curse and look for the justice
* Test stage and players could have their winnings
Let’s play!
[/quote]Bad luck :)
It’s 50% probability… try real coin flip also you can always see the transactions in the blockchain via the links in the first post ;)
To get 3 heads in the row probability is 0.5*0.5*0.5 = 0.125 and yes it’s quite big probability.Plus you have already 1 FTC so if you try playing with it def. you will got a win ;)
-
[quote name=“slavco” post=“46324” timestamp=“1387493536”]
[quote author=slavco link=topic=5931.msg43762#msg43762 date=1386935546]
6headp1fo8AmDoFvuJndGT3b4VTEiwVU7E ( number between 50-99 ) odd 1.85 ([url=http://explorer.feathercoin.com/address/6headp1fo8AmDoFvuJndGT3b4VTEiwVU7E]http://explorer.feathercoin.com/address/6headp1fo8AmDoFvuJndGT3b4VTEiwVU7E[/url])6taiLoiPTGPuQXFRLPyreYTaQyyTBQbxbM ( number between 0-49 ) odd 1.85 ([url=http://explorer.feathercoin.com/address/6taiLoiPTGPuQXFRLPyreYTaQyyTBQbxbM]http://explorer.feathercoin.com/address/6taiLoiPTGPuQXFRLPyreYTaQyyTBQbxbM[/url])
Min bet: 0.1
Max bet 0.5
( Lower or bigger amounts will be captured by the addresses and not included in the game )Fair play ( There will be fairness calculator script ) :
- Your transaction id
- Game key
- number = last 4 bytes of md5(txid+key) to integer module 100
* Play with official client not via shared wallet!
* Bonus: First 3 players who hit 0 ( you can calculate your number when i publish the Game key ) no matter if you play head or tail will be revarded 5 FTC each if they find their winnings.
* First 10 players that don’t have FTC to test just drop me a note and I’ll send you amount for testing
* Will be online until 19:00 ( CET/GMT+1 ) *Scripts are up and running until enough transactions are performed*
* If problems appear please use this tread to curse and look for the justice
* Test stage and players could have their winnings
Let’s play!
[/quote]Bad luck :)
It’s 50% probability… try real coin flip also you can always see the transactions in the blockchain via the links in the first post ;)
To get 3 heads in the row probability is 0.5*0.5*0.5 = 0.125 and yes it’s quite big probability.Plus you have already 1 FTC so if you try playing with it def. you will got a win ;)
[/quote]Let’s put that in perspective.
The expected number of rolls without consecutive losses = 1 in 2^n, where n is the number of losses in a row. That means that if you’re rolling 8 times, the expected number of losses in a row is 3. If you roll 16 times, you could expect to see 4 losses in a row, and at 32 rolls, you could expect to see 5 losses in a row somewhere in that sequence.
That means that if 8 people repeated this experiment, one of them, on average, will lose all 3 rolls.
In short, this is completely expected. But it’s also a great example of why provable fairness is important.
-
[quote name=“slavco” post=“46025” timestamp=“1387416717”]
Yup on small amount of bets I can easy find the secret ( with given formula ) that will satisfy the games outcomes e.g. prove that system is fair. For x number of bets probability for me to generate secret key that will prove that game is fair is 0.5^x. For example if we have 10 bets and I want to generate secret that will satisfy the outcomes probability for me to find that secret is 0.000976562 ;)The only fair situation is the following: to reveal before the bet hash of the secret and after the bet to reveal the secret.
Do you want to make an experiment:
- I’ll reveal the formula
- I’ll create special address for you
- You place 5 bets x 10 FTC ( you will loose them all )
- I’ll give you secret that will satisfy the formula and the outcome
What do you think? :)
[/quote]
Yes I don’t dispute this is a viable scam if you only have a very small amount of bets eg: 5 bets and produce the secret for a formula to coincide with the given result of only 32 possibilities (ie: Heads/Tails ^ 5), but start introducing more bets (Also more possibilities) and this will become exponentially more difficult and require some serious computational power and time, time that would/could exceed the given time frame of releasing the secret. To put this in perspective @ only 30 bets (2 ^ 30) the possibilities would increase to 1073741824.
I suppose the operator of such a scam would be taking the biggest gamble of anyone and betting (hoping) they have no more than x amount of bets before this scam would be totally exposed.
-
[quote name=“UKMark” post=“46410” timestamp=“1387534335”]
[quote author=slavco link=topic=5931.msg46025#msg46025 date=1387416717]
Yup on small amount of bets I can easy find the secret ( with given formula ) that will satisfy the games outcomes e.g. prove that system is fair. For x number of bets probability for me to generate secret key that will prove that game is fair is 0.5^x. For example if we have 10 bets and I want to generate secret that will satisfy the outcomes probability for me to find that secret is 0.000976562 ;)The only fair situation is the following: to reveal before the bet hash of the secret and after the bet to reveal the secret.
Do you want to make an experiment:
- I’ll reveal the formula
- I’ll create special address for you
- You place 5 bets x 10 FTC ( you will loose them all )
- I’ll give you secret that will satisfy the formula and the outcome
What do you think? :)
[/quote]
Yes I don’t dispute this is a viable scam if you only have a very small amount of bets eg: 5 bets and produce the secret for a formula to coincide with the given result of only 32 possibilities (ie: Heads/Tails ^ 5), but start introducing more bets (Also more possibilities) and this will become exponentially more difficult and require some serious computational power and time, time that would/could exceed the given time frame of releasing the secret. To put this in perspective @ only 30 bets (2 ^ 30) the possibilities would increase to 1073741824.
I suppose the operator of such a scam would be taking the biggest gamble of anyone and betting (hoping) they have no more than x amount of bets before this scam would be totally exposed.
[/quote]Hmm but there are strategies to calculate the “scam” all the time plus not all bets are wins => if operator calculates 30% chances and promote 50% chances he will have very small amount for processing. Extra with sha256 ASIC chips this is quite easy. I’m still waiting to see server secret hash created with scrypt, bmw or some another function :)
Also another approach is to fake first X bets and after that ( enough profit ) to continue to be fair.
As Kevlar note for this reasons to be fair you must reveal the hash of the secret before bet and after bets to reveal the secret. In this way users would know that secret wasn’t changed and can check fairness via published formula for bet calculation.
-
[quote name=“slavco” post=“46419” timestamp=“1387536944”]
As Kevlar note for this reasons to be fair you must reveal the hash of the secret before bet and after bets to reveal the secret. In this way users would know that secret wasn’t changed and can check fairness via published formula for bet calculation.
[/quote]Now I understand, revealing the secret is not enough to fully show provability…Because of this I have since updated both Heads/Tails & Lucky7 games so that the [i]sha256 hash[/i] of the SecretSalt currently in use is displayed clearly, obviously the un-hashed SecretSalt (the one used to calculate the bets) will be revealed at the end of each day as usual.
[url=http://www.ftcgames.eu/]http://www.ftcgames.eu/[/url]
-
[quote name=“UKMark” post=“46725” timestamp=“1387660070”]
[quote author=slavco link=topic=5931.msg46419#msg46419 date=1387536944]
As Kevlar note for this reasons to be fair you must reveal the hash of the secret before bet and after bets to reveal the secret. In this way users would know that secret wasn’t changed and can check fairness via published formula for bet calculation.
[/quote]Now I understand, revealing the secret is not enough to fully show provability…Because of this I have since updated both Heads/Tails & Lucky7 games so that the [i]sha256 hash[/i] of the SecretSalt currently in use is displayed clearly, obviously the un-hashed SecretSalt (the one used to calculate the bets) will be revealed at the end of each day as usual.
[url=http://www.ftcgames.eu/]http://www.ftcgames.eu/[/url]
[/quote]+1 dude. Nicely done.
-
[quote name=“Kevlar” post=“46756” timestamp=“1387669654”]
[quote author=UKMark link=topic=5931.msg46725#msg46725 date=1387660070]
[quote author=slavco link=topic=5931.msg46419#msg46419 date=1387536944]
As Kevlar note for this reasons to be fair you must reveal the hash of the secret before bet and after bets to reveal the secret. In this way users would know that secret wasn’t changed and can check fairness via published formula for bet calculation.
[/quote]Now I understand, revealing the secret is not enough to fully show provability…Because of this I have since updated both Heads/Tails & Lucky7 games so that the [i]sha256 hash[/i] of the SecretSalt currently in use is displayed clearly, obviously the un-hashed SecretSalt (the one used to calculate the bets) will be revealed at the end of each day as usual.
[url=http://www.ftcgames.eu/]http://www.ftcgames.eu/[/url]
[/quote]+1 dude. Nicely done.
[/quote]Its the only way Kevlar, had I realised sooner I would of implemented sooner, it was literally a 10min job (if that) to make the additions so no excuse not to offer this, it has certainly made me look at a large percentage of Crypto gambling sites currently out there in a totally different light. :-\
-
[quote name=“Kevlar” post=“46756” timestamp=“1387669654”]
[quote author=UKMark link=topic=5931.msg46725#msg46725 date=1387660070]
[quote author=slavco link=topic=5931.msg46419#msg46419 date=1387536944]
As Kevlar note for this reasons to be fair you must reveal the hash of the secret before bet and after bets to reveal the secret. In this way users would know that secret wasn’t changed and can check fairness via published formula for bet calculation.
[/quote]Now I understand, revealing the secret is not enough to fully show provability…Because of this I have since updated both Heads/Tails & Lucky7 games so that the [i]sha256 hash[/i] of the SecretSalt currently in use is displayed clearly, obviously the un-hashed SecretSalt (the one used to calculate the bets) will be revealed at the end of each day as usual.
[url=http://www.ftcgames.eu/]http://www.ftcgames.eu/[/url]
[/quote]+1 dude. Nicely done.
[/quote]+1 It was easy because you was honest all the time.
-
[quote name=“iawgoM” post=“43766” timestamp=“1386936729”]
Btw. there is already something similar here: [url=http://www.ftcgames.eu/]http://www.ftcgames.eu/[/url]Pozdrav! :)
[/quote]Thanks for that! Ive made a tonne in winnings on the lucky 7 :D
-
So I noticed the page is kinda refreshing constantly. That can’t be good for server load.
Have you considered using WebSockets for the updates, so the server can push when there’s a change? socket.io makes this really trivial to do.
-
[quote name=“FTClover” post=“47166” timestamp=“1387832960”]
[quote author=iawgoM link=topic=5931.msg43766#msg43766 date=1386936729]
Btw. there is already something similar here: [url=http://www.ftcgames.eu/]http://www.ftcgames.eu/[/url]Pozdrav! :)
[/quote]Thanks for that! Ive made a tonne in winnings on the lucky 7 :D
[/quote]:o But I still need to buy a turkey. :‘( :’( :'(
[quote author=Kevlar link=topic=5931.msg47176#msg47176 date=1387834036]
So I noticed the page is kinda refreshing constantly. That can’t be good for server load.Have you considered using WebSockets for the updates, so the server can push when there’s a change? socket.io makes this really trivial to do.
[/quote]As you can see this was my ‘roll your own’ approach :D
I looked at (and even started) something called comet? (I think that was the name) but I got lost as it seemed overly complex for what I wanted to achieve (quickly) and had other things I wanted to prioritize.If you recommend sockets.io I will certainly take a look in the new year and yes CPU is @ 102% most of the time :o
Thanks!
-
It’s good start to implement:
- some sleep in your while true php code
- split the game handlers into different processes
- execute async tasks in the background via exec
Refreshing the site on ~5 sec. it’s annoying only for the user for server is nothing on small load :)
-
[quote name=“UKMark” post=“47196” timestamp=“1387837794”]
[quote author=FTClover link=topic=5931.msg47166#msg47166 date=1387832960]
[quote author=iawgoM link=topic=5931.msg43766#msg43766 date=1386936729]
Btw. there is already something similar here: [url=http://www.ftcgames.eu/]http://www.ftcgames.eu/[/url]Pozdrav! :)
[/quote]Thanks for that! Ive made a tonne in winnings on the lucky 7 :D
[/quote]:o But I still need to buy a turkey. :‘( :’( :'(
[quote author=Kevlar link=topic=5931.msg47176#msg47176 date=1387834036]
So I noticed the page is kinda refreshing constantly. That can’t be good for server load.Have you considered using WebSockets for the updates, so the server can push when there’s a change? socket.io makes this really trivial to do.
[/quote]As you can see this was my ‘roll your own’ approach :D
I looked at (and even started) something called comet? (I think that was the name) but I got lost as it seemed overly complex for what I wanted to achieve (quickly) and had other things I wanted to prioritize.If you recommend sockets.io I will certainly take a look in the new year and yes CPU is @ 102% most of the time :o
Thanks!
[/quote]Comet is an umbrella term for HTTP Streaming technologies. I’m not sure which framework you were looking into, but sockets.io couldn’t be simpler:
Server side:
io.sockets.emit(“newBet”, “{betData:…}”);Client side:
io.on(“connect”, function(socket){
socket.on(“newBet”, function(newBet){
//insert page rendering code here.
};
});
io.connect(“http://serverUrl.com”) -
[quote name=“slavco” post=“47199” timestamp=“1387838347”]
It’s good start to implement:- some sleep in your while true php code
- split the game handlers into different processes
- execute async tasks in the background via exec
Refreshing the site on ~5 sec. it’s annoying only for the user for server is nothing on small load :)
[/quote]Yes sleep works well to stop the constant polling BUT when testing we found it would fail on multiple bets in a single TX. :( (system can currently handle 3 at the minute, 5 if spread accross both games)
I already run separate processes for each game, maybe I will split for each address also.
Will look into exec.I have thought about redesigning the whole game engines to use a DB and then maybe just poll once every 10 seconds, verify tx in db add/remove it - run game or quit etc…Not sure whether users would appreciate that sort of delay with a dice game though. Plus it would probably cause other issues too. :-\
-
[quote name=“Kevlar” post=“47200” timestamp=“1387838612”]
[quote author=UKMark link=topic=5931.msg47196#msg47196 date=1387837794]
[quote author=Kevlar link=topic=5931.msg47176#msg47176 date=1387834036]
So I noticed the page is kinda refreshing constantly. That can’t be good for server load.
Have you considered using WebSockets for the updates, so the server can push when there’s a change? socket.io makes this really trivial to do.
[/quote]As you can see this was my ‘roll your own’ approach :D
I looked at (and even started) something called comet? (I think that was the name) but I got lost as it seemed overly complex for what I wanted to achieve (quickly) and had other things I wanted to prioritize.If you recommend sockets.io I will certainly take a look in the new year and yes CPU is @ 102% most of the time :o
Thanks!
[/quote]Comet is an umbrella term for HTTP Streaming technologies. I’m not sure which framework you were looking into, but sockets.io couldn’t be simpler:
Server side:
io.sockets.emit(“newBet”, “{betData:…}”);Client side:
io.on(“connect”, function(socket){
socket.on(“newBet”, function(newBet){
//insert page rendering code here.
};
});
io.connect(“http://serverUrl.com”)
[/quote]Seems very simple, will look into it cheers.
-
There you go gringo :) https://github.com/Slavco/dicestart you can use it on raspberry pi as game calculator and have separate site for the play addresses anouncement ( shared hosting is too much for it ;) )
-
[quote name=“slavco” post=“47322” timestamp=“1387898026”]
There you go gringo :) https://github.com/Slavco/dicestart you can use it on raspberry pi as game calculator and have separate site for the play addresses anouncement ( shared hosting is too much for it ;) )
[/quote]Nice work gringo! 8)