Bitcoin Forum
April 28, 2024, 11:56:08 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: working with balance management in a game  (Read 202 times)
jammy99 (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
March 19, 2018, 11:06:06 AM
 #1

I'm working in a online game project, Where users will deposit ETH into their account for playing game.

My problem is, Once a user deposit some ETH into his wallet. Example 0.10 ETH

So how we can track this balance and update user balance into our database, And allow user to play game. So while playing game user's balance will deduct or increase from our database balance not from directly their ETH wallet built into our website.

So how is it possible to track users deposit only once, So same deposit amount can not be grabbed by our code?

How peoples do this kind of stuff?
1714305368
Hero Member
*
Offline Offline

Posts: 1714305368

View Profile Personal Message (Offline)

Ignore
1714305368
Reply with quote  #2

1714305368
Report to moderator
"Bitcoin: mining our own business since 2009" -- Pieter Wuille
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714305368
Hero Member
*
Offline Offline

Posts: 1714305368

View Profile Personal Message (Offline)

Ignore
1714305368
Reply with quote  #2

1714305368
Report to moderator
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
March 19, 2018, 01:06:39 PM
Merited by achow101 (3), Foxpup (1), ABCbits (1), o_e_l_e_o (1), RGBKey (1)
 #2

I'm working in a online game project, Where users will deposit ETH into their account for playing game.

You seem to ask a lot questions regarding deposits/withdrawals for your website.
Please be concerned that if you are not a very skilled programmer (which you obviously aren't) and you don't hire one to code it for you,
someone will find a vulnerability and either 1) crash your system or 2) withdraw everything. Just a matter of time.



So how is it possible to track users deposit only once, So same deposit amount can not be grabbed by our code?

Well, you credit the deposit after X confirmation. What do you exactly mean by 'grabbed by our code' ?
You have to build the whole backend with security in mind. There isn't just one call to make it secured and working flawlessly



How peoples do this kind of stuff?

They learn how to code or hire someone who knows how to.

jammy99 (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
March 20, 2018, 09:08:42 AM
 #3

looks like you dont want to help, what you have written i already know all that about me.

Looks like you have no idea how does gaming websites works with crypto currencies and you don't know balance management as well and how to generate child addresses under a parent address.

You totally misunderstood the question. Or may be your are willing to get hired. BTW please if you don't have answer of anyone's question do not just make any reply or comment.


Hiring peoples is not a big deal, but i just came here to learn how things go on.

BTW i will wait for someone to answer my questions
TheQuin
Hero Member
*****
Offline Offline

Activity: 2576
Merit: 882


Freebitco.in Support https://bit.ly/2I9BVS2


View Profile WWW
March 20, 2018, 10:46:00 AM
 #4

So while playing game user's balance will deduct or increase from our database balance not from directly their ETH wallet built into our website.

Normally they would not have a wallet. Once a deposit is made it is in the site's wallet and credited to their account in the database.

freebitcoin.TO WIN A  LAMBORGHINI!..

.
                                ▄▄▄▄▄▄▄▄▄▄███████████▄▄▄▄▄
                    ▄▄▄▄▄██████████████████████████████████▄▄▄▄
                    ▀██████████████████████████████████████████████▄▄▄
                    ▄▄████▄█████▄████████████████████████████▄█████▄████▄▄
                    ▀████████▀▀▀████████████████████████████████▀▀▀██████████▄
                      ▀▀▀████▄▄▄███████████████████████████████▄▄▄██████████
                           ▀█████▀  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  ▀█████▀▀▀▀▀▀▀▀▀▀
                   ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Xynerise
Sr. Member
****
Offline Offline

Activity: 322
Merit: 363

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
March 20, 2018, 01:32:27 PM
 #5

You can do it in different ways:

    1 Create a new smart contract for every user, which requires gas to create. Could be expensive if you have a lot of users.

    2 Create an external account (normal ETH address) for each user.
    You'll need gas to consolidate the funds to your cold wallet (if any)

    3. Use a single smart contract for all customers.

    Either way, you still need to employ someone to do it for you since you have no idea how any of this works.

    Good luck.
BitifyStartup
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
March 20, 2018, 03:02:57 PM
 #6

1)You should write a php script that can check the wallets balance from a database you have written, and run a cronjob every 5 minutes.
2)Your database should include the users ID and the Address used for depositing funds.
3)Your code should read this value and display it to your user.
4)Your game should deduct the "gamecost" from the user balance and update it.



// get user balance

            if (empty($user_balances[$user_id])) {
               $bal_info = User::getBalance($user_id,$wallet['eth']);
               $user_balances[$user_id] = $bal_info['balance'];
            }

I am available for hire you can visit www.bitify.co.za for more information. My entire platform works with user balances, and assuming by your question you should not be dealing with other users funds if you don't know the basics about crypto-currencies / programming.
Pages: [1]
  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!