{ "subject": "Sample account system using JSON-RPC needed", "content": { "format": "html", "body": "<div class=\"post\">We need someone to write sample code, preferably Python or Java, showing the recommended way to use the JSON-RPC interface to create an account system.&nbsp; Most sites that sell things will need something like this.&nbsp; Someone who's kept up on the JSON-RPC threads here should have some idea how it should work.<br/><br/>When a user is logged in to their account, you show the bitcoin address they can send to to add funds.&nbsp; Before showing it, you check if it's been used, if it has then you replace it with a new one (getnewaddress &lt;username&gt;).&nbsp; You only need to keep the latest bitcoin address for the account in your database.&nbsp; (I posted a sample code fragment for this in an earlier thread somewhere, search on getnewaddress)<br/><br/>You use getreceivedbylabel &lt;username&gt; with the username as the label to get the \"credit\" amount of the account.&nbsp; You need to keep a \"debit\" amount in your database.&nbsp; The current balance of the account is (credit - debit).&nbsp; When the user spends money, you increase debit.<br/><br/>If you're requiring more than 0 confirmations, it's nice if you show the current balance (0 confirmations) and the available balance (1 or more confirmations), so they can immediately see that their payment is acknowledged.&nbsp; Not all sites need to wait for confirmations, so the dual current &amp; available should be optional.&nbsp; Most sites selling digital goods are fine to accept 0 confirmations. <br/><br/>A nice sample app for this would be a simple bank site, which would have the above, plus the option to send a payment to a bitcoin address.&nbsp; The sample code should be the simplest possible with the minimum extra stuff to make it a working site.<br/><br/>vekja.net is an example of a site like this.<br/></div>" }, "source": { "name": "Bitcoin Forum", "url": "https://bitcointalk.org/index.php?topic=417.msg3579#msg3579" }, "date": "2010-07-16T19:45:10Z" }
Inscription number 18,210,097
Genesis block 799,367
File type json
File size 2.2 KB
Creation date Nov 21,2023 2:22 pm