Author

Topic: getreceivedbyaddress JSON (Read 10055 times)

staff
Activity: 4284
Merit: 8808
September 01, 2013, 01:18:14 AM
#16
You can do this sort of thing with accounts, but its highly inadvisable:  there is no live replication for the database, so it's possible for you to fail and lose all the moves since your last backup.

Normally the advice is that for anything serious you should be doing the accounting in your own system and just letting bitcoind notice when payments come in.
newbie
Activity: 27
Merit: 0
September 01, 2013, 12:10:14 AM
#15
What about getreceivedbyaccount? The reason I ask is that I'm looking for a way to track users balances, and be able to manually alter them. For example a user deposits 100 BTC, then wins 10 BTC from another player in the system, heis now able to withdraw 110 BTC. Will he get a negative balance on the client then? If so that's okay.

But now what if the player buys an item from the house, his balance will decrease. Now how does the house spend those coins without making it look like a player withdrew bitcoins (not touching anyone's account balance)

You can use getbalance and specify an account. It is possible for accounts to have negative balances.
newbie
Activity: 28
Merit: 0
August 31, 2013, 11:26:08 PM
#14
What about getreceivedbyaccount? The reason I ask is that I'm looking for a way to track users balances, and be able to manually alter them. For example a user deposits 100 BTC, then wins 10 BTC from another player in the system, heis now able to withdraw 110 BTC. Will he get a negative balance on the client then? If so that's okay.

But now what if the player buys an item from the house, his balance will decrease. Now how does the house spend those coins without making it look like a player withdrew bitcoins (not touching anyone's account balance)
hero member
Activity: 812
Merit: 1000
August 27, 2013, 04:39:08 PM
#13
Does getreceivedaddress count the change received from outgoing transactions?

yes, if the change is going back to the same address. change amounts are no different to other inputs in that respect. normally though, change will go to a newly generated 'change' address each time.

newbie
Activity: 28
Merit: 0
August 27, 2013, 11:07:03 AM
#12
Does getreceivedaddress count the change received from outgoing transactions?

If I send 0.001 BTC and it uses a 1 BTC input, does the 0.999 count in getreceivedbyaddress next time?
hero member
Activity: 812
Merit: 1000
April 21, 2012, 07:55:52 AM
#11
i was just re-visiting this problem today and found out that blockexplorer won't work after all... putting 0 for the minconf results in:

Quote
ERROR: you must use an integer above 0 for minconf
legendary
Activity: 1072
Merit: 1181
March 20, 2012, 10:08:55 AM
#10
Calculating how much was received by addresses that are not your own (i.e. transactions that are not in your wallet) would require either a full blockchain rescan, or an index with the balances of all addresses to be kept. Since this information is not needed in normal operation, such an index is not implemented.

Short answer: currently not possible with the reference client.

so i'm guessing then, merchants who generate a pool of addresses offline using bitaddress.org and then import them into a db to give out to customers (instead of generating addresses on-the-fly), just use the blockexplorer api to check for incoming payments.

One other possibility is using a wallet with a large pool of pregenerated keys, encrypting it, and put the encrypted wallet but not the password on the webserver. This way the bitcoind on the webserver can observe incoming (and outgoing) payments, but not spend it by itself.

Type-2 determinstic wallets would bring a cleaner solution here. They're not yet supported in bitcoind, but I'm working on it.
hero member
Activity: 812
Merit: 1000
March 20, 2012, 09:51:41 AM
#9
Calculating how much was received by addresses that are not your own (i.e. transactions that are not in your wallet) would require either a full blockchain rescan, or an index with the balances of all addresses to be kept. Since this information is not needed in normal operation, such an index is not implemented.

Short answer: currently not possible with the reference client.

so i'm guessing then, merchants who generate a pool of addresses offline using bitaddress.org and then import them into a db to give out to customers (instead of generating addresses on-the-fly), just use the blockexplorer api to check for incoming payments.
legendary
Activity: 1072
Merit: 1181
March 20, 2012, 09:32:01 AM
#8
Calculating how much was received by addresses that are not your own (i.e. transactions that are not in your wallet) would require either a full blockchain rescan, or an index with the balances of all addresses to be kept. Since this information is not needed in normal operation, such an index is not implemented.

Short answer: currently not possible with the reference client.
hero member
Activity: 812
Merit: 1000
March 20, 2012, 07:20:19 AM
#7
sorry couldn't find this answer anywhere...

how does one get the 'minconf=0' balance of addresses that aren't in their wallet?

it's easy to get the 'confirmed' balance using something like blockexplorer's api.

but as far as i know, getreceivedbyaddress($address,0) only works on addresses that are in your own wallet.

so, for eg. how does this page work? http://bitcoincharts.com/bitcoin/txlist/

thanks.


edit: okay so i found out blockexplorer's api allows you to add 'minconf' to the url, so one could theoretically use that, HOWEVER, i'm still interested in finding out how to do it more directly if possible, rather than rely on blockexplorer (or other 3rd party) which may not be always online.
hero member
Activity: 546
Merit: 500
August 27, 2010, 08:06:08 AM
#6
Oh. Thank you!

For some reason it didn't worked for me first time i tried and I thought that since it's not on wiki it's not supported =)

Now everything works as intendend. Looking forward for inclusion of listtransactions patch into main branch =)
administrator
Activity: 5222
Merit: 13032
August 27, 2010, 02:36:56 AM
#5
I added it to the wiki. getreceivedbyaddress has been around since 0.2.9.
legendary
Activity: 1596
Merit: 1100
August 27, 2010, 01:21:05 AM
#4
It's there, not sure why you're not seeing it...  Type 'help' to list all JSON RPC calls:

Code:
getaddressesbylabel 
hero member
Activity: 546
Merit: 500
August 27, 2010, 12:56:48 AM
#3
This is nice feature to show list of transactions for user, thanks!

But right now I just need getreceivedbyaddress RPC call. This thread mentions that this is already implemented, but there is nothing about it in wiki - http://www.bitcoin.org/wiki/doku.php?id=api

is getreceivedbyaddress also somewhere in svn? I want to avoid compiling client, since I had some problems with it and I need to do it on several machines with different hardware. So I'd better download binaries =))

ps: right now, since app and bitcoind runs on the same machine, just execute 'bitcoind getreceivedbyaddress [address]' =)
legendary
Activity: 1596
Merit: 1100
August 26, 2010, 11:56:37 PM
#2

This patch (not in official SVN repo or official bitcoin client) will list transactions in your wallet:
https://bitcointalksearch.org/topic/patch-implement-xlisttransactions-611

hero member
Activity: 546
Merit: 500
August 26, 2010, 09:44:50 PM
#1
I need to get received amounts for specific address, but it looks like there is not such JSON RPC call yet. Is this something implemented and just not mentioned in Documentation, or it's not implemented at all for some reason?
Jump to: