Title: Programming Newbie Looking For Some Answers Post by: DPony13 on December 26, 2012, 12:53:24 PM Hey guys, I'm new to programming/scripting
and I'd like to ask, How do other websites/services do this Customer on website: 0.00 balance Website > Generates/Shows Customer a bitcoin address Customer > Deposits 1.00 to bitcoin address Website > receives bitcoins and automatically changes customer's stats: Customer on website: 1.00 balance Is it possible to have an example and an explanation to it too? thanks. Title: Re: Programming Newbie Looking For Some Answers Post by: Xenland on December 26, 2012, 01:20:23 PM The balances are normally attributed to a user_id that the user can login with and check their balance. When a user would like to deposit an address the website code would query the Bitcoin client through JSON command that will generate an address. The newly generated address will be attributed to the user_id as a deposit address. The user then sends the Bitcoins to the address, and the website will ping the Bitcoin client every so often to see if any new bitcoins have been received, If there are new bitcoins the information can be extract to that particular transaction information like "+1 Bitcoin deposited" type of information. You take that information and increase the users current balance value.
I'm working on a Bitcoin Development Kit library for PHP that facilitates all these kind of convinces, checking new balances is a planned feature Update: This feature of updating balances has been added to the to-do list instead (https://github.com/Xenland/Bitcoin-Development-Kit/wiki/%28%29-To-Do-Features-%28Notes-to-contributing-developers%29) Title: Re: Programming Newbie Looking For Some Answers Post by: davout on December 26, 2012, 01:29:12 PM the website will ping the Bitcoin client every so often Use the monitortx patch instead, much better.Title: Re: Programming Newbie Looking For Some Answers Post by: Xenland on December 26, 2012, 02:00:27 PM the website will ping the Bitcoin client every so often Use the monitortx patch instead, much better.Thanks Davout! Title: Re: Programming Newbie Looking For Some Answers Post by: davout on December 26, 2012, 02:07:49 PM Thanks Davout! No worries!With this solution you can mix some websocket magic to instantly push all balance updates to the browser. That's what Instawallet uses. |