hippich (OP)
|
|
August 27, 2010, 02:44:50 AM |
|
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?
|
|
|
|
jgarzik
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
August 27, 2010, 04:56:37 AM |
|
This patch (not in official SVN repo or official bitcoin client) will list transactions in your wallet: http://bitcointalk.org/index.php?topic=611.0
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
hippich (OP)
|
|
August 27, 2010, 05:56:48 AM |
|
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=apiis 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]' =)
|
|
|
|
jgarzik
Legendary
Offline
Activity: 1596
Merit: 1100
|
|
August 27, 2010, 06:21:05 AM |
|
It's there, not sure why you're not seeing it... Type 'help' to list all JSON RPC calls: getaddressesbylabel <label> getbalance getblock height getblockcount getblocknumber getconnectioncount getdifficulty getgenerate gethashespersec getinfo getlabel <bitcoinaddress> getnewaddress [label] getreceivedbyaddress <bitcoinaddress> [minconf=1] getreceivedbylabel <label> [minconf=1] help [command] listreceivedbyaddress [minconf=1] [includeempty=false] listreceivedbylabel [minconf=1] [includeempty=false] listtransactions [count=10] [minconf=1] [includegenerated=true] sendtoaddress <bitcoinaddress> <amount> [comment] [comment-to] setgenerate <generate> [genproclimit] setlabel <bitcoinaddress> <label> stop
|
Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own. Visit bloq.com / metronome.io Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
|
|
|
theymos
Administrator
Legendary
Offline
Activity: 5376
Merit: 13407
|
|
August 27, 2010, 07:36:56 AM |
|
I added it to the wiki. getreceivedbyaddress has been around since 0.2.9.
|
1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
|
|
|
hippich (OP)
|
|
August 27, 2010, 01:06:08 PM |
|
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 =)
|
|
|
|
payb.tc
|
|
March 20, 2012, 12:20:19 PM Last edit: March 20, 2012, 12:35:06 PM by payb.tc |
|
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.
|
|
|
|
Pieter Wuille
Legendary
Offline
Activity: 1072
Merit: 1181
|
|
March 20, 2012, 02:32:01 PM |
|
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.
|
I do Bitcoin stuff.
|
|
|
payb.tc
|
|
March 20, 2012, 02:51:41 PM |
|
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.
|
|
|
|
Pieter Wuille
Legendary
Offline
Activity: 1072
Merit: 1181
|
|
March 20, 2012, 03:08:55 PM |
|
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.
|
I do Bitcoin stuff.
|
|
|
payb.tc
|
|
April 21, 2012, 12:55:52 PM |
|
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: ERROR: you must use an integer above 0 for minconf
|
|
|
|
romsa9
Newbie
Offline
Activity: 28
Merit: 0
|
|
August 27, 2013, 04:07:03 PM |
|
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?
|
|
|
|
payb.tc
|
|
August 27, 2013, 09:39:08 PM |
|
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.
|
|
|
|
romsa9
Newbie
Offline
Activity: 28
Merit: 0
|
|
September 01, 2013, 04:26:08 AM |
|
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)
|
|
|
|
dragonfruit
Newbie
Offline
Activity: 27
Merit: 0
|
|
September 01, 2013, 05:10:14 AM |
|
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.
|
|
|
|
gmaxwell
Staff
Legendary
Offline
Activity: 4270
Merit: 8805
|
|
September 01, 2013, 06:18:14 AM |
|
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.
|
|
|
|
|