Author

Topic: How to handle deposits on a turn based multiplayer game (Read 196 times)

BQ
member
Activity: 616
Merit: 53
CoinMetro - the future of exchanges
Either I am missing something or the solution is very obvious: You need a smart contract to handle all that. That is how most of the betting on the blockchain is being done and you can use Ethereum, NEO and many other "programable" chains.

Why don´t you take a look a the diagrams on this white paper and search open source projects with keywords "provably fair betting".

Hello, could you provide me a example on how a smart contract could help me?

The project is not about betting it's more like:

Game checkers:

Player A put's 10$ in the room
Player B put's 10$ in the room

If a wins he get's all what's in the room, if not B gets all.

It's not a betting site, so how could help me this?

A contract is just auto executing code based on input, but depending on how you do this I don't think you need a contract, while I'm not an expert, the idea is simple.
When a game starts, you tell Player A and Player B to deposit to the contract, maybe they input their adress on their site, the contract receives the money and ties the adress to the player(if no 'active adress', contract sends it back instantly).
If not both deposits are received within 10 minutes, cancel all deposits and refund any payments from the two active adresses(Player A and Player B, incase one of them didn't deposit, the other one gets his money back).
Otherwise, the game starts, and once your site determines who wins, you simply tell the contract to either send money to player A or to player B, since you now have their money in 'escrow' (the contract), and you have both their adresses saved in your website, so you can tell the contract that the winner was adress A and therefore he'll get $20 (amount could be tied to the adress in your database aswell).

I don't know, again not an expert but it definitely sounds like a case for a smartcontract  Roll Eyes
full member
Activity: 448
Merit: 110
Either I am missing something or the solution is very obvious: You need a smart contract to handle all that. That is how most of the betting on the blockchain is being done and you can use Ethereum, NEO and many other "programable" chains.

Why don´t you take a look a the diagrams on this white paper and search open source projects with keywords "provably fair betting".

Hello, could you provide me a example on how a smart contract could help me?

The project is not about betting it's more like:

Game checkers:

Player A put's 10$ in the room
Player B put's 10$ in the room

If a wins he get's all what's in the room, if not B gets all.

It's not a betting site, so how could help me this?
I understand it's a game but since the players will be playing with real money, why not take your commission for every turn. Following the example above, you can charge a dollar and the winner goes with $19 instead of $20.
member
Activity: 142
Merit: 13
So your saying that for each game I need to create a new "wallet" that contains a smart contract.

The problem 1: if I want accept Bitcoins also this won't work.

Problem 2: How can I interact with this smart contract? since my whole platform is written in php, nodejs ?
member
Activity: 142
Merit: 13
Either I am missing something or the solution is very obvious: You need a smart contract to handle all that. That is how most of the betting on the blockchain is being done and you can use Ethereum, NEO and many other "programable" chains.

Why don´t you take a look a the diagrams on this white paper and search open source projects with keywords "provably fair betting".

Hello, could you provide me a example on how a smart contract could help me?

The project is not about betting it's more like:

Game checkers:

Player A put's 10$ in the room
Player B put's 10$ in the room

If a wins he get's all what's in the room, if not B gets all.

It's not a betting site, so how could help me this?
legendary
Activity: 2366
Merit: 1624
Do not die for Putin
Either I am missing something or the solution is very obvious: You need a smart contract to handle all that. That is how most of the betting on the blockchain is being done and you can use Ethereum, NEO and many other "programable" chains.

Why don´t you take a look a the diagrams on this white paper and search open source projects with keywords "provably fair betting".
member
Activity: 142
Merit: 13
Thanks for the answer, I think the easiest solution is to remove the ability to download the private key atleast until I find a better solution to this. So I remove the need to create a escrow service and do internal transactions, so we avoid fees and slow tx.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
I just need a form to freeze the money used in a game,
Any advice?

There are gambling sites already doing no-deposit games. I don't like this sort of games because imho too much is lost in tx fees, but others do play it.

The solution is actually simple:
In any game the amount the user is betting has to be locked in the escrow account, which is 100% your wallet, only you have the private key.
At the game end the winner will automatically receive his money, meaning that your website will send the money automatically to the wallet where the winning bet was coming from.

Since the game is person vs person, you will have to also offer the choice to an user to cancel his bet as long as he has no opponents and his money will get back to his wallet.


Thanks for the answer, the problem:

That was my initial idea, a escrow wallet but the problem is speed and fees:

I mean moving the funds from user wallet to escrow for bitcoin will take a lot of time, and fees, and a game won't be longer than 1-2h I think.

What's the best solution to that?

With high enough fee the Bitcoin is transferred in about 20-30 minutes. You should be fine with one confirmation. (The more the better, but make sure you don't work with unconfirmed transactions.) You, your game and your players have to go with this or use a faster altcoin. Or LN.
The fees may rise accordingly, that's why I don't play such games - I better deposit. Maybe you should also offer the option to deposit.

As I wrote, one direction could be to use Lightning Network, since its primary use is micropayments, but LN is in its early days, you'll need to study the problem well and even then your players may not know how to use it.

Edit: all in all there's no best solution yet.
member
Activity: 142
Merit: 13
I just need a form to freeze the money used in a game,
Any advice?

There are gambling sites already doing no-deposit games. I don't like this sort of games because imho too much is lost in tx fees, but others do play it.

The solution is actually simple:
In any game the amount the user is betting has to be locked in the escrow account, which is 100% your wallet, only you have the private key.
At the game end the winner will automatically receive his money, meaning that your website will send the money automatically to the wallet where the winning bet was coming from.

Since the game is person vs person, you will have to also offer the choice to an user to cancel his bet as long as he has no opponents and his money will get back to his wallet.


Thanks for the answer, the problem:

That was my initial idea, a escrow wallet but the problem is speed and fees:

I mean moving the funds from user wallet to escrow for bitcoin will take a lot of time, and fees, and a game won't be longer than 1-2h I think.

What's the best solution to that?
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
I just need a form to freeze the money used in a game,
Any advice?

There are gambling sites already doing no-deposit games. I don't like this sort of games because imho too much is lost in tx fees, but others do play it.

The solution is actually simple:
In any game the amount the user is betting has to be locked in the escrow account, which is 100% your wallet, only you have the private key.
At the game end the winner will automatically receive his money, meaning that your website will send the money automatically to the wallet where the winning bet was coming from.

Since the game is person vs person, you will have to also offer the choice to an user to cancel his bet as long as he has no opponents and his money will get back to his wallet.



member
Activity: 142
Merit: 13
Hello, i'm developing a turn based game where you can bet against your opponent, if you win you earn back your money and opponents money, if you loose the opponent gets all. So, I want this project work only with cryptocurrencies, but i'm facing a lot of problems:

1. People need to deposit money to the site, and when the start a game they decide how much to bet and then start to pay:
Problem: People dont like to deposit money on sites.

My solution: Users would deposit money on site on an address, I would give him the ability to download the private key of the wallet, but that comes with another problem:

If a user starts a game and bet 10$, since he has access to the wallet before the game ends he could just send the money elsewhere and scam the system. My solution:

Send bet amount before he starts a game to a newly temporal created wallet only for that purpose, but that's comes with another problem:

Speed, bitcoin is slow, cryptos are not that fast.

So how could I solve this problem, giving the user the ability to download his private key but "freezing" the money for a bet.

The easiest solution is to not let the user download the private key, but i won't scam them and I want them to feel comfortable. I just need a form to freeze the money used in a game,

Any advice?

Jump to: