Bitcoin Forum
May 04, 2024, 03:57:19 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 4 5 6 7 »  All
  Print  
Author Topic: In which language top gambling sites are coded ?  (Read 12752 times)
BitCoinDream
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
September 25, 2014, 03:24:29 PM
 #21

Committing 10k rolls at a time may go against the atomic consistency of the DB resulting in unexpected effect to the bankroll (+ve/-ve).

The bulk insert is applied atomically, but each inserted row still has to respect its constraints.

One big reason you'd want to accumulate rolls in-memory and then commit them to the DB in bulk is if each roll needs to be applied sequentially to the DB and you don't want sequential roll insertion to be the bottleneck.

For example, imagine if each roll needs to calculate the total house bankroll to adjust the edge of the roll. The bankroll changes each roll. If each roll has to hit the DB server, then you're going to be dealing with a lot of insert contention.

Instead, let's say you only make one DB insertion at the turn of each second. As rolls come in, you buffer the results in memory (assured that the DB cannot change during this time) and then commit all the rolls at once.

Here's an idea: imagine if you write a function `roll(prevDB, params)` that returns `newDB` where prevDB and newDB are just associative datastructures that represent the state of the DB in memory.

That means you can `reduce(roll, prevDB, [params, ...])` where `[params, ...]` is a sequence of user roll parameters coming down, say, a websocket.

At the turn of each second, you stop the reduction, take the latest newDB value (the result of all the buffered rolls), and commit it to the DB. The post-commit value of the DB is now your `prevDB` that you feed back into the reduction and resume processing rolls.



I was thinking about what u said. Instead of storing in the memory pool, how about storing it in a text file and insert the data of that text file after a certain time interval, say one minute and remove the old data from there. Real time display can be done from the text file itself.

"I'm sure that in 20 years there will either be very large transaction volume or no volume." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714795039
Hero Member
*
Offline Offline

Posts: 1714795039

View Profile Personal Message (Offline)

Ignore
1714795039
Reply with quote  #2

1714795039
Report to moderator
NLNico
Legendary
*
hacker
Offline Offline

Activity: 1876
Merit: 1289


DiceSites.com owner


View Profile WWW
September 26, 2014, 03:42:44 AM
Last edit: September 26, 2014, 04:46:15 AM by NLNico
 #22

I like the idea of knowing this, so let's make an overview (grouped by backend language, not really sorted)



SiteServerBackendSocket libDB/StorageFrontend
Just-Dice.com                    Node.js               socket.io             redis+MySQL      
PrimeDice.comCowboyNode.jssocket.ioPostgreSQLEmberJS
DiceBitco.innginxNode.js+ExpressPrimusAngularJS
Dicenow.comnginxNode.js+Expresssocket.ioAngularJS
Satoshibet.comnginxNode.jssocket.io
MoneyPot.comCowboyNode.jssocket.ioPostgreSQL
PRCDice.euMS-IIS.NETSignalR
Win88.meMS-IIS.NETServiceStackAngularJS
Peerbet.orgMS-IIS.NET---
Dice.ninjacyclonePythonsockjs-cycloneMySQL
luckyb.itPython+Flask---
Rollin.ioApachePHP+laravelsocket.io
BitDice.menginxRoR+RabbitMQRedis+MySQL


More / corrections? Let us know Smiley

a1choi
Sr. Member
****
Offline Offline

Activity: 323
Merit: 254


View Profile
September 26, 2014, 07:51:16 AM
 #23

thanks for sorting this out to a table format!  way easier on the eyes
BitCoinDream
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
September 26, 2014, 01:42:39 PM
 #24

I like the idea of knowing this, so let's make an overview (grouped by backend language, not really sorted)



SiteServerBackendSocket libDB/StorageFrontend
Just-Dice.com                    Node.js               socket.io             redis+MySQL      
PrimeDice.comCowboyNode.jssocket.ioPostgreSQLEmberJS
DiceBitco.innginxNode.js+ExpressPrimusAngularJS
Dicenow.comnginxNode.js+Expresssocket.ioAngularJS
Satoshibet.comnginxNode.jssocket.io
MoneyPot.comCowboyNode.jssocket.ioPostgreSQL
PRCDice.euMS-IIS.NETSignalR
Win88.meMS-IIS.NETServiceStackAngularJS
Peerbet.orgMS-IIS.NET---
Dice.ninjacyclonePythonsockjs-cycloneMySQL
luckyb.itPython+Flask---
Rollin.ioApachePHP+laravelsocket.io
BitDice.menginxRoR+RabbitMQRedis+MySQL


More / corrections? Let us know Smiley

That's a wonderful job done. Does anyone know what PocketDice.io is using ? Its also interesting to see that almost none of the players are using PHP.

NLNico
Legendary
*
hacker
Offline Offline

Activity: 1876
Merit: 1289


DiceSites.com owner


View Profile WWW
September 26, 2014, 02:34:47 PM
Last edit: September 26, 2014, 02:46:13 PM by NLNico
 #25

PocketDice.io = nginx, PHP, socket.io, AngularJS



About that lack of PHP sites:

IMO every developer has to look per project what language and frameworks to use.

Node.js is single threaded by design and is perfect for realtime communication between the browser and server. It just makes sense to use it for chatrooms, games, etc. aka dice/gambling sites Smiley

It doesn't mean that PHP is necessarily bad, it's just bad for this type of website. Better yet: the 2 websites with PHP still use socket.io (node.js) for the socket. On the other hand, suggesting a MEAN (MongoDB, Express, AngularJS, and Node.js) stack for a normal informative company CMS wouldn't make much sense either (IMO.) I would prefer PHP and/or an open-source CMS for that specific goal.

BitCoinDream
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
September 26, 2014, 03:09:05 PM
 #26

PocketDice.io = nginx, PHP, socket.io, AngularJS



About that lack of PHP sites:

IMO every developer has to look per project what language and frameworks to use.

Node.js is single threaded by design and is perfect for realtime communication between the browser and server. It just makes sense to use it for chatrooms, games, etc. aka dice/gambling sites Smiley

It doesn't mean that PHP is necessarily bad, it's just bad for this type of website. Better yet: the 2 websites with PHP still use socket.io (node.js) for the socket. On the other hand, suggesting a MEAN (MongoDB, Express, AngularJS, and Node.js) stack for a normal informative company CMS wouldn't make much sense either (IMO.) I would prefer PHP and/or an open-source CMS for that specific goal.

How do u get to know what is being used in the backend ? Moreover, as I understand, the use of socket.io is to auto-update the latest data in the front end. So, what would be the drawback if we store the data temporarily in a flat file and auto-refresh the flat file using JS ?

NLNico
Legendary
*
hacker
Offline Offline

Activity: 1876
Merit: 1289


DiceSites.com owner


View Profile WWW
September 26, 2014, 03:44:05 PM
 #27

Well, for example pocketdice.io sends a PHPSESSID cookie, so it's safe to say they use PHP ( https://pocketdice.io/index.php works too Wink). Besides that, you can easily see the socket.io socket.


A socket is an open connection between the client (browser) and server with bidirectional communication. If you make a bet, you send the info through the socket (and you get the result) and if others bet you get the bets from there. So it's all real-time, you only connect once. There are different libraries/servers for this, Socket.io is a popular one made in node.js. Perfect for a dice site.

An alternative is indeed getting new data with AJAX requests. With that, the browser would make a connection/request every x seconds to see if there are new bets. Obviously for a dice site this would be pretty terrible and give big lag and other problems. However AJAX is useful for other purposes.

addi
Hero Member
*****
Offline Offline

Activity: 626
Merit: 500


https://satoshibet.com


View Profile WWW
September 26, 2014, 07:05:33 PM
 #28

We use mySQL & mongo for db (satoshibet)

newIndia
Legendary
*
Offline Offline

Activity: 2198
Merit: 1049


View Profile
September 26, 2014, 08:51:14 PM
 #29

Well, for example pocketdice.io sends a PHPSESSID cookie, so it's safe to say they use PHP ( https://pocketdice.io/index.php works too Wink). Besides that, you can easily see the socket.io socket.


A socket is an open connection between the client (browser) and server with bidirectional communication. If you make a bet, you send the info through the socket (and you get the result) and if others bet you get the bets from there. So it's all real-time, you only connect once. There are different libraries/servers for this, Socket.io is a popular one made in node.js. Perfect for a dice site.

An alternative is indeed getting new data with AJAX requests. With that, the browser would make a connection/request every x seconds to see if there are new bets. Obviously for a dice site this would be pretty terrible and give big lag and other problems. However AJAX is useful for other purposes.

Is there any special server setup required to run Node.js & socket.io ? Can I try it on a PHP-MySQL shared hosting ?

NLNico
Legendary
*
hacker
Offline Offline

Activity: 1876
Merit: 1289


DiceSites.com owner


View Profile WWW
September 26, 2014, 11:39:59 PM
 #30

Yes, you need to run Node.js so you will need an own server (perhaps there are very few shared hosting packages that do support it.)

However you can always try it locally Smiley (and/or in a VM)

grux
Member
**
Offline Offline

Activity: 67
Merit: 10


View Profile
September 27, 2014, 02:37:56 AM
 #31

We use mySQL & mongo for db (satoshibet)

That's an odd combo, are you using mongo to cache numbers? (if you don't mind me asking)
newIndia
Legendary
*
Offline Offline

Activity: 2198
Merit: 1049


View Profile
September 27, 2014, 09:47:05 AM
 #32

We use mySQL & mongo for db (satoshibet)

Is not MongoDB a NoSQL database ? Can it go hand in hand with a RDBMS like MySQL ?

m19
Full Member
***
Offline Offline

Activity: 186
Merit: 100


View Profile
September 27, 2014, 11:25:17 AM
 #33

We use mySQL & mongo for db (satoshibet)

Is not MongoDB a NoSQL database ? Can it go hand in hand with a RDBMS like MySQL ?

It could be they use MongoDB for session storage. Although I personally prefer Redis for that.

Using a good ORM you can query both MySQL and MongoDB with the same syntax. For example Waterline ORM can do this.
newIndia
Legendary
*
Offline Offline

Activity: 2198
Merit: 1049


View Profile
September 28, 2014, 11:09:03 AM
 #34

Yes, you need to run Node.js so you will need an own server (perhaps there are very few shared hosting packages that do support it.)

However you can always try it locally Smiley (and/or in a VM)

Thank U for the clarification...

Does anyone know how many concurrent connection a gambling site experience at most ? Here I'm talking about the Web Server connection... NOT DB connection.

Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
September 28, 2014, 02:56:03 PM
 #35

Hmmm..... you know, I recently heard about this guy in my country (Philippines) that runs an online casino. I don't know which one, but he has an office somewhere in Makati and he's got a staff of 100 people (probably customer support.)

I'm pretty sure it's not a bitcoin casino.

I'll try to get in touch, but it would seem I would have a difficult time getting an appointment; unless I point out to him that "Hey, if you accept bitcoin deposits, you save 3% from all those real-bank transaction fees."

Do you guys have a suggestion what I should use if I wanted to run my own dice site? Are all these sites using VPS or Amazon or something? Seems like Node.js is a good start.

I'd almost have to be some Massively Multiplayer Dice Playing Game, ... World of Dicecraft or something - I wouldn't use that particular name... (there's Dragon's Tale, too.)

And I'm left wondering if I just use IRC for the chat part, but then I'd have to worry about ops and channel maintenance.

newIndia
Legendary
*
Offline Offline

Activity: 2198
Merit: 1049


View Profile
September 28, 2014, 07:00:37 PM
 #36

Hmmm..... you know, I recently heard about this guy in my country (Philippines) that runs an online casino. I don't know which one, but he has an office somewhere in Makati and he's got a staff of 100 people (probably customer support.)

I'm pretty sure it's not a bitcoin casino.

I'll try to get in touch, but it would seem I would have a difficult time getting an appointment; unless I point out to him that "Hey, if you accept bitcoin deposits, you save 3% from all those real-bank transaction fees."

Do you guys have a suggestion what I should use if I wanted to run my own dice site? Are all these sites using VPS or Amazon or something? Seems like Node.js is a good start.

I'd almost have to be some Massively Multiplayer Dice Playing Game, ... World of Dicecraft or something - I wouldn't use that particular name... (there's Dragon's Tale, too.)

And I'm left wondering if I just use IRC for the chat part, but then I'd have to worry about ops and channel maintenance.

Please ask him how is he currently accepting payment from customers ? AFAIK PayPal does not allow to do gambling payment. Moreover, does he have a license ?

Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
September 29, 2014, 12:52:26 AM
 #37

Please ask him how is he currently accepting payment from customers ? AFAIK PayPal does not allow to do gambling payment. Moreover, does he have a license ?

I'll ask. I don't know anything yet and can't make any assumptions, I was just guessing based on the story. (Also, supposedly a friend of a friend, so that's going to be a bit more difficult to track down.)

Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
September 29, 2014, 01:21:38 AM
 #38

Speaking of which, almost everyone is using HMAC-SHA-512.

Since HMAC is not broken, why not use HMAC-SHA-1 (which is what Google Authenticator 2FA uses) for the dice rolls? Or if that's questionable, why not HMAC-SHA-256?

In fact, HMAC-MD5 would probably work fine. (MD5 is broken, but not HMAC.)

You'll have a few gamblers trying to figure out the secrets.

Also, I thought I might ask here since all these sites are here, how do you get an unbiased roll of a 6 sided dice based on binary input (such as the hash result). The only thing I can think of is using the discard method. If I don't discard, there is a bias. On one hex digit, that's .25, on two, that's 0.015625.

Some sites use 5 digits, then discard if too high, for their million sided dice. I could use, maybe 12 hex digits for a trillion sided dice without discarding, while the bias may exist, it's too small at the point. (Who the hell is going to do a trillion rolls on one set of seeds to find out ... well, there's me ...)

So, as an alternative, I thought of inventing a new game using 8 sided dice instead. Much easier to map out to a hex digit, no bias. (Oh, I know I could just use a thousand sided dice, or a million sided dice like any of the top 5 dice sites, but I'm trying to do something different.)

NLNico
Legendary
*
hacker
Offline Offline

Activity: 1876
Merit: 1289


DiceSites.com owner


View Profile WWW
September 29, 2014, 01:49:02 AM
 #39

What is the problem with HMAC-SHA512? If there is no problem with it, why use a weaker alternative?

Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
September 29, 2014, 02:24:54 AM
 #40

What is the problem with HMAC-SHA512? If there is no problem with it, why use a weaker alternative?

Speed? (No seriously.) You know what, maybe it was just a dumb question, who is going to notice the speed difference even when you have a few thousand players online at the same time on one server. But I had to ask it anyway. I did some quick research, and I think I won't go with MD5 or SHA1 at least.

Someone else made this speed test on the hash functions:

Code:
MD5     10.275190830230713, 10.155328989028931, 10.250311136245728
SHA1    11.985718965530396, 11.976419925689697, 11.86873197555542
SHA256  16.662450075149536, 21.551337003707886, 17.016510963439941
SHA512  18.339390993118286, 18.11187481880188,  18.085782051086426

atodorov.org/blog/2013/02/05/performance-test-md5-sha1-sha256-sha512/

And there's an older one here: http://www.cryptopp.com/benchmarks.html

The HMAC, if I understand it correctly, does two hashing calculations. So if MD5 = 20, and SHA512 = 36 ... (Okay okay, maybe it's a really dumb question.)

Pages: « 1 [2] 3 4 5 6 7 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!