Author

Topic: Help me design a blockchain for p2p poker (Read 3504 times)

newbie
Activity: 38
Merit: 0
June 30, 2015, 01:46:01 PM
#19
I've made some progress to make free P2P poker a reality in opensource software using the new faster crypo currency engines of Stellar.org and Ripple.com see my github to view the wiki and the present state of my code at https://github.com/sacarlson/pokerth_accounting/wiki that adds a payment modules onto an already existing and popular pokerth software.

pokerth_accounting is ready for testing today not tomaro!! The Mental poker upgrade is mentioned in my wiki as in a future addition that would not be hard to add. The Mental poker c++ libs are already published and tested as seen on another github project that shows times to shuffle well within reason on todays computers. At this point my project is ready for testing. In it's present state we use Stellar.org testnet STR and  trust line generated coins we call CHP (for chips). CHP are a worthless crypto currency that we will us just to keep score at this point and for testing the concept.  The CHP coins  are distributed to member players of pokerth from poker.surething.biz site in a one time 100,000 to start money. As far as other matters that can be a concern like collusion, With the Stellar uncentralized money system were all transaction can be seen by the public. We can track who was playing with who and when on every game ever played to research the possibility of collusion. From this information you can decide weather you want to play on a table with possible colluders or not. I've also added a primitive website that displays all the active members account ballances so you can compare you skills with others at http://poker.surething.biz . This site also contains the database to share your Stellar.org account numbers with other pokerth players. The pokerth_accounting program that runs in the background on your local system does everything invisibly without any added effort from the player of pokerth. After or durring the game you can analize your accounting with an sqlitebrowser to view what you paid who and when. Sqlitebrowser is also used to make changes in the configuration of the system allowing you to change currency or network to real money on a different network like Ripple or other. The software for the most part is completed ready to run but I'm sure we will be finding bugs to fix soon. That's why I need testers. There is no way I can test every function without realtime play involved. So if your willing to help us move this along take a look at our present evolving code at https://github.com/sacarlson/pokerth_accounting/wiki and https://github.com/sacarlson/pokerth_accounting. If you have any question you can find me at #pokerth IRC or even on pokerth game chat as sacarlson or leave me a note on github. Oh and again on the mater of Mental poker algorithm, the present game uses servers that no one ( should say not many) people have access to. So until we start playing with big money I'm not going to wory about it. Remember with Stellar.org that even in real money we can play with very small pots of even less than 1 cent worth of crypto currency of say STR. Transaction costs are so small even in real money (non testnet) the costs would be less than $3 for about 100 years (more than a life time) of play. On testnet in it's present default settings it is completely free. I should note that the next upgrade we are pushing is implementing the built in uncentralized escrow system on Stellar.org. With that and Mental poker added it should be about done. So give it a try and find out for yourself just how close we really are.  
newbie
Activity: 14
Merit: 0
Dude
you are doing well and in the right path... check errors and bugs and go ahead, it looks really a great thing.

Thanks
sr. member
Activity: 378
Merit: 250
You're on the correct path but you're making this out to be a lot easier than it actually is, I suggest you do some trial and error of your own and then have it load tested/security tested.

Best way to learn IMO.
hero member
Activity: 588
Merit: 504
Peer to peer Poker is a really prefect solution to dishonest Poker house. Anyone working on it and hows you progress? I have been dreaming of a decentralized platform for so long and wan to invest in it!

Maybe you can bootstrap using counterparty platform

A p2p sportsbet site is already running:
http://testnet.xbet.io/start
W-M
full member
Activity: 210
Merit: 100
In Crypto we Trust.
The simplest way to restrict collusion is to have all previous games public, which is in essence what you do when you have a well-working blockchain.
Now, players should be able to decide if they want to join a certain game or not, depending on the other players that are already sitting at the table. As all stats are publicly available, it is possible to map the other players together and look at how many games they've played together, how much money they've bet in total, etc.

Basically, it creates a trust-based system, and you should not, for larger bets, trust other players who either have bet little money before, or played/won lots of games together with the other players at the table.

I've been thinking a little about this before. Also see my older, dusty topic here: https://bitcointalksearch.org/topic/m.3882568

newbie
Activity: 5
Merit: 0
I think you can take a look of Qixcoin. https://bitcointalksearch.org/topic/qixcoin-300160.

But not sure about their progress.
hero member
Activity: 530
Merit: 500
October 15, 2012, 08:56:11 AM
#13
just create a heads up poker on a blockchain,
there is no collusion,
since it will be an open source project
in time there will be some developers that will add multiseat tables and collusion will be addressed later

it should be started, and people will play
legendary
Activity: 1050
Merit: 1003
October 14, 2012, 08:42:02 AM
#12

cunicula, that's also an idea that has floated around that I really really like.  Even if I can't prevent cheating, as long as I can make it too costly to be worth the effort, that's good enough.  Ya, part of my implementation is going to have a small amount of rake fed
Just in case I didn't get the point across (not sure).

Rake taken from each hand does nothing to discourage collusion.

Collusion involves sitting at a table with a friend. To prevent collusion you need the following:

1) Have a large number of active tables available.
2) Randomly assign players to tables.
3) Charge a large fee to players for a table assignment.

Then players will not have control over who they are playing with (unless they pay the large fee repeatedly).

You do not want to collect rake from each hand at all. This is wasteful fee collection because it does noting to discourage cheating. Instead, you want to collect all the fees at the table assignment step. (like a buy-in)
legendary
Activity: 1526
Merit: 1134
October 14, 2012, 07:37:14 AM
#11
Avoiding collusion cheating is really hard, but I think you could do it in a fairly low tech way by requiring everyone in the game to join a multi-way video chat (like a Google+ hangout). That way you can see everyone and try and read their face to know if they're bluffing, etc, but it also means the same person can't join the same game multiple times, and it means if multiple people in the same game are collaborating, they can't easily use a mobile phone or second computer to do it, it has to be the same computer they're playing the game with. That opens the door to using trusted computing techniques to allow players to cryptographically prove that their system is running the poker software and nothing else (no way to have an IM client running alongside the poker client).
hero member
Activity: 793
Merit: 1026
October 13, 2012, 08:32:47 PM
#10
Thanks everybody for the replies thus far.

Markm, don't at all feel bad for being mean.  I appreciate any advice, and I understand how my post looks.  I am actually teaching myself c++ solely for the purpose of doing this, and if I can solve this ledger/blockchain problem, I am going to publish my "logical" non-programming-language protocol and attempt to start a kickstarter to hire somebody, since I will have shown how it can be done.

Mark H, I like the oracle idea!  That was along the lines of what I was thinking in terms of using random "trusted" nodes as arbitrators in the cases where the players had disagreements about published actions, or if there were disconnects or something similar.

I believe I have the complete play of a poker hand done-- that's not where my problem is.  Running a single game is fine.  What I need is a ledger with pgp wot ratings, current account balances that can't just be arbitrarily updated, who owns shares of a split private key on the network, and other misc information.

Even if I were to just want one game and a blockchain with only the account balance, in order to do that, I'd need to have a blockchain that's comprised of just signed hand histories over and over, which would still get to be too big if people started using it.  That's why I keep trying to find a way to get a ledger that can be updated, not added to like the bitcoin chain, because I beleive the bitcoin model does not scale for the type of thing I'm trying to do.

cunicula, that's also an idea that has floated around that I really really like.  Even if I can't prevent cheating, as long as I can make it too costly to be worth the effort, that's good enough.  Ya, part of my implementation is going to have a small amount of rake fed back into the network to pay for various things like security of that type, or rewarding trusted nodes when they arbitrate-- or if whatever type of blockchain I end up having does need to be "mined", then some rake can go to miners for block rewards.

Again, thanks for all the input guys.  I know I'm asking a lot by not knowing more than I do, but if I can get down a protocol that I think works, I'll learn to code myself damnit!
legendary
Activity: 1526
Merit: 1134
October 13, 2012, 06:06:20 AM
#9
I don't think you need a separate block chain, exactly. Block chains are a specific solution to a specific problem.

If you have a chain of messages that define "moves" (arbitrary state changes) in the game, for the number of people taking part in a typical poker match you could just require each party that isn't moving to sign each move to indicate their agreement.

Poker games have a few characteristics that make this kind of arrangement simpler:   there are a small number of players, and the game takes place entirely online. So simply having signature matrices works fine.

Who controls the pot? You could use a quorum of players again, but an oracle may be a better choice:

  https://en.bitcoin.it/wiki/Contracts#Example_4:_Using_external_state

To put money in the pot you broadcast a transaction that signs it over to a quorum of oracles. The program submitted to the oracle is a poker game interpreter - it knows how to read the log of moves and calculate the state of the game at each point, at the end it calculates the winner and signs a transaction spending the pot as appropriate.

Because it's an oracle, you can challenge it with fake poker games to ensure that it actually behaves as expected. The quorum is just a hedge against one of them going offline or having some kind of problem rather than a fundamental element of the trust.

Waiting for a block before you can start your poker game is a pain. You could use lock times/sequence numbers to be able to adjust the amount of money you put down into each game without any need to wait. You'd only need to wait for a block when entering a table for the first time. Repeated games at the same table (with the same set of players) would not require re-setup.
legendary
Activity: 1050
Merit: 1003
October 13, 2012, 04:50:45 AM
#8
the pool of players was large enough that you could not guess or brute force your way into the same game, that might be a solution.

Charging a fee to enter a randomly selected 'table' helps with collusion. This would make brute forcing a desired table expensive. Repeated play at the same table would not be subject to this fee. The fee can just be destroyed, maybe used to compensate whoever is running the necessary hardware, or otherwise divided equally among other players using the system.

legendary
Activity: 2940
Merit: 1090
October 13, 2012, 03:08:12 AM
#7
Well maybe a good start would to start learning programming/coding.

As basically this sounds like too many posts on game-development forums: "I have a great idea, someone please spend the thousands of bitcoins worth of programmer time free of charge to build it for me".

If learning to program is too time-consuming, or an inefficient use of your free time that put to other uses rakes in far more bitcoins than programmers would charge, by all means save up for some programming.

The use of bounties can sometimes get you more programmer-hours per coin ultimately spent than paying by the hour but programmers might also be aware of that thus cautions of bounties.

Sorry if this sounds harsh but as they say on game-development forums (and quite possibly elsewhere I would not be surprised), ideas are cheap and plentiful. (Often even over-abundant.)

If you can get exactly what needs doing really clear though maybe someone will decide to become a big name in open source p2p gaming circles by coding the thing for free.

Since collusion cannot be prevented anyway, many coders maybe have figured the whole p2p thing is a pointless waste of time since players can instead take turns being the one running the host/server, the others being the clients for that hand, or something like that.

-MarkM-
hero member
Activity: 793
Merit: 1026
October 12, 2012, 11:15:23 PM
#6
Yeah, obviously I can't use a blockchain in the bitcoin sense.  As I said in my original post, it does not scale well at all with the amount of data necessary for what I'm trying to accomplish.

As far as your concern about hashing power-- that would never be a problem, the hands would be signed by both parties or trusted nodes used for arbitration.  But no amount of brute force would matter in the type of thing I'm trying to make.

Again, as I said above, I'm trying to make a single ledger that is not added to, but merely changed as time goes on, and I'm trying to find a way to authenticate changes across a distributed network, so that an old node with an old ledger can see what the most recent ledger is, and he can be sure that it is the correct and most up to date ledger.

And the issue with the current open source models is that none of them is made for a peer to peer distributed protocol, and the mental poker protocols aren't implemented yet, and also I want to integrate that protocol with my additions, like the smart contracts and the ledger, and I also want to re-work it a bit to for example, allow arbitration when there are disputes about actions or other things like disconnects or whatever, and other things.
legendary
Activity: 2940
Merit: 1090
October 12, 2012, 08:40:43 PM
#5
Since of the two players playing the one with the higher hash power can pwn the blockchain, it does not seem very useful.

Or is it your intent to pay bitcoin miners to mine your chain using merged mining, ro are you going to actually use smart property or coloured coins on an existing, already secured by sufficient hash-power, chain?

What exactly is "wrong" with the existing free open source multi-player wager-using-bitcoins code?

-MarkM-
hero member
Activity: 793
Merit: 1026
October 12, 2012, 06:56:37 PM
#4
Yeah, I'm pretty sure I've got the play of hands down, but I need, among other things, a way to enforce transfer of money, store user data and wot info, etc.

As far as collusion, I'm not trying to stop things that just aren't possible to stop-- that being said, once the project gets off the ground, we can program in various automated flags that would also kick down the WOT rating, as well as allow for anonymous tables or something similar.  But nothing stops two people from calling each other one the phone and saying "hey which table are you at the one with this flop or that flop or that flop"

Like I said, at this point, I'm not concerned with stopping things that PoekrStars has trouble stopping.  I just want a distributed poker option available for the community.

And as you guys have pointed out, the play of hands is either solved or close to being solved, but I still need a way to integrate all the other things necessary for the client, like bitcoins without tons of micro transactions flooding the network, and pgp identities, and so forth.  And I just don't think an ever-increasing blockchain can handle that amount of data assuming it takes off, so I need to find an implementation that will scale.

What do you guys think of my smaller blockchain that records the hashes of each ledger update?
legendary
Activity: 1526
Merit: 1134
October 12, 2012, 06:44:32 AM
#3
There's a useful discussion here:

http://blog.cryptographyengineering.com/2012/04/poker-is-hard-especially-for.html

the correct term is "mental poker".

The biggest problem seems to be that even in the centralized case you can't prevent cheating via collusion. That seems like a fatal weakness for any kind of online poker to me, but obviously people do somehow play it anyway. Perhaps if games took place exclusively between randomly selected temporary nyms (so you could not know who you were playing against) and the pool of players was large enough that you could not guess or brute force your way into the same game, that might be a solution.
legendary
Activity: 2940
Merit: 1090
October 12, 2012, 05:10:18 AM
#2
Try googling liar's poker and such, all of the crypto for dealing hands and so on and so on is already worked out, there are even links to various libraries and such of code for dealing and so on already made.

So mostly you just need to hire some programmers and have it built.

Since programming languages and styles and so on differ, you probably should be working this stuff out with them as part of laying out the rodmarks for the contract, like maybe set finalising of actual implementation details as a major early roadmark before coding begins.

I think there are also already some existing multi player poker sofrwares what do not use a central "house" so you might be able to get your specification down to what precisely you want added to which of those if none of the already do exactly what it is that you want to do.

Certainly they would already have a user-interface and images of cards and so on so your look and feel from a user perspective will already be nailed down saving gosh knows how many bitcoins of artist / graphic-designer / user-interface work.

In short I think you will find design is already almost completely done, all that remains is to code.

-MarkM-
hero member
Activity: 793
Merit: 1026
October 12, 2012, 03:19:25 AM
#1
Ok, let me preface this by saying that I am not a programmer, nor do I know advanced math, but I know enough about computers and crypto that I have been in my head trying to logically design a protocol for a peer to peer poker network.

I think I have a good idea of how to do most of it-- there would be a poker pgp WOT, a bunch of secret-shared split poker network private keys, nodes that have high enough WOT trust to arbitrate disputed hands without even actually knowing any of the information (it would rely in part on fully homomorphic encryption), optional rake which goes towards miners and high-trust-level nodes, and many other features and ways to mix all of this together, but one of the main things necessary is a full public ledger which contains things like pgp identities, account balances, automated wot ratings, and other misc necessary info.

Most if not all of this could be automated and based on hand histories and the ledger (aka blockchain) could theoretically be just the clear-signed hand histories or something like that, however that does not at all scale.  If the thing ever got popular, the blockchain would grow to petabytes in order to have the necessary information.

So what I want to do is instead of having it be blockchain-like, instead use a fixed ledger (which can grow with more users) but where the data can actually be altered rather than simply added onto the previous data.  Now I know the ever-growing blockchain was the way satoshi could make bitcoin work, but I feel like it should be possible to do what I want, but I'm not positive of that.

So I'm hoping you guys might have ideas on how a fixed ledger could work.  One idea I have is in addition to the fixed ledger, a smaller blockchain that contains all the hand histories and other updates since the last ledger, as well as a hash or something of the ledger at that point, and then every so often all nodes with the full ledger and blochchain(s) attempt to update and use a logical clock to just let the first guy win, and there's no reward for being first (other than having to wait X time between updates), so the other nodes are happy to accept, and then just whenever the ledger is changed, and the rake from the new hands gets split up evenly among the nodes who have the full ledger.  Additionally, only people with X number of hands and no disputes and high trust ratings could be allowed to receive the reward and only their ledgers would be "official".  This would incentivise trying to avoid accusations of cheating and also running "full"clients (but still allow lite clients).  (And of course each person could still store their own hand histories forever.)

I'm just tossing things around in my head at this point, but I'd really like to try and figure this out.  I know I really don't know enough to be trying this on my own, but I figured it I could logically work out the entire protocol on paper, I might convince somebody to do it or more likely be able to start a kickstarter fund to hire somebody to do it.
Jump to: