Transaction

193b7ea17580408c6e7d4e8ec621e71801ac74ef41138cf30d01973870b7c6d2
Timestamp (utc)
2024-03-22 16:47:57
Fee Paid
0.00000032 BSV
(
0.00411200 BSV
-
0.00411168 BSV
)
Fee Rate
10.29 sat/KB
Version
1
Confirmations
94,197
Size Stats
3,108 B

2 Outputs

Total Output:
0.00411168 BSV
  • j"1LAnZuoQdcKCkpDBKQMCgziGMoPC4VQUckM' <div class="post">I added label related functions to help with managing multiple addresses per user. &nbsp;New or renamed functions are:<br/>&nbsp;getreceivedbyaddress -- amount received on a single address<br/>&nbsp;getreceivedbylabel -- amount received by all addresses with this label<br/>&nbsp;listreceivedbyaddress -- list addresses and amounts they've received<br/>&nbsp;listreceivedbylabel -- list labels and amounts they've received<br/>&nbsp;setlabel -- misc label functions for completeness<br/>&nbsp;getlabel<br/>&nbsp;getaddressesbylabel<br/><br/>For consistency I renamed getamountreceived-&gt;getreceivedbyaddress and getallreceived-&gt;listreceivedbyaddress. &nbsp;The old names are still there so as not to break existing code, but they're deprecated.<br/><br/>The idea is that if you give the username whenever you call getnewaddress, you can get the user's total received across all their addresses using the "bylabel" functions. &nbsp;You can freely change their address without worrying about tracking all their old addresses.<br/><br/>A good way to automate changing the user's receiving address: just before displaying their current address, check if it has been used to receive anything, if it has then replace it with a new one:<br/><br/>// Get a new address whenever the current one has received anything<br/>if (strAddr == "" || getreceivedbyaddress(strAddr) &gt; 0)<br/>&nbsp;&nbsp; strAddr = getnewaddress(strUsername); // Label the address with username<br/>Display(strAddr); // Display their current receiving address<br/><br/>// Get total received by all the user's addresses<br/>getreceivedbylabel(strUsername, 0) // unconfirmed<br/>getreceivedbylabel(strUsername, 1) // available balance<br/><br/>If you're just getting one particular user's balance, such as in response to a page request by that user, use getreceivedbylabel, but if you're scanning over all users, it's better to use listreceivedbylabel to get the complete list and scan against the result. &nbsp;Scanning users with getreceivedbylabel would be n-squared, using listreceivedbylabel is n-log-n (or n linear).<br/><br/>You should only really need to scan all users if you're polling in order to spontaneously take action in response to money received, rather than the user going to a webpage, seeing their balance and telling you what to do with it. &nbsp;It's not necessary to poll very frequently. &nbsp;If you require 1 confirmation, that'll take an average of 10 minutes anyway, so there's no point in polling more often than every few minutes.<br/><br/>If you're selling digital goods and services, where you don't lose much if someone gets a free access, and it can't be resold for profit, I think you're fine to accept 0 confirmations.<br/><br/>It's mostly only if you were selling gold or currency that you'd need multiple confirmations.<br/></div> text/html
    https://whatsonchain.com/tx/193b7ea17580408c6e7d4e8ec621e71801ac74ef41138cf30d01973870b7c6d2