J
J
Joe Anno2022-04-02 15:03:04
JavaScript
Joe Anno, 2022-04-02 15:03:04

How is it possible to resolve such a complex transaction mechanic?

A question about the mechanics of the transaction: how is the interaction with the payment API done?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2022-04-02
@firedragon

all casinos that operate convert the currency into their game currency.
Why don't you do that?
Plus, get rich on conversions when withdrawing

V
Vladimir, 2022-04-02
@AstraVlad

Either I'm stupid or one of the two...
How I would see this process:
1. The player presses the "I want to play" button - at this moment the bet + commission is deducted from him in favor of the casino and the status "Ready to play" is assigned.
2. If the money has not come from the second player within a reasonable time, the game is canceled and the player who paid is offered to find another partner or return the money (optional).
3. When both players have the status "Ready to play" (the money is already at the casino), the actual game takes place.
4. The loser is given a message about the loss, the winner is transferred the winnings minus the commission.
I can't see where the difficulty could be. Although of course the domestic currency is better. Some "K-bucks" with a rate of 10 for 1 dollar. Withdrawal in crypto at the rate at the time of withdrawal.

A
Alex Step, 2022-04-04
@kellas

First, the players deposit money for the contract, one by one, each depositing $21 as in your example.
For an honest random, you need to make each player generate a random string, and then these 2 strings would be sent to a hash function (which all parties have a code) from which numbers are already issued, so that everyone participates in the creation of the random.
The transaction to receive the prize is sent by the winner, as he is interested in this. But in order to take the prize from the contract, you need a third party (your server/casino) to give their approval in the form of a signature.
You either need to implement the logic of getting a winner from 2 random lines on the contract (which can be expensive in terms of gas, although for normal cubes) or you need some contract operator / admin whose private key is on your server and his signature is needed to withdraw money from the contract .
The server receives all the same 2 random strings from the players, drives them into a hash function to get the random, and sends the signed date to the winner, which the winner passes in the contract method call.
The contract verifies signatures and distributes players' money.
In general, it is not much different from the usual multisig. In Solana, it is simpler with offchain transactions and several signatures for one transaction, if the binance / etherum blockchain is not critical, take a closer look at it. + small commissions for sending trans.
An example of getting any number of numbers from one line on js and solidity - https://replit.com/@AlexStep2/RNG - in principle, you can check who won directly on the contract

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question