Bitcoin Forum
April 19, 2024, 08:43:34 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: getreceivedbyaddress JSON  (Read 10027 times)
hippich (OP)
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500


View Profile
August 27, 2010, 02:44:50 AM
 #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?

1713559414
Hero Member
*
Offline Offline

Posts: 1713559414

View Profile Personal Message (Offline)

Ignore
1713559414
Reply with quote  #2

1713559414
Report to moderator
1713559414
Hero Member
*
Offline Offline

Posts: 1713559414

View Profile Personal Message (Offline)

Ignore
1713559414
Reply with quote  #2

1713559414
Report to moderator
1713559414
Hero Member
*
Offline Offline

Posts: 1713559414

View Profile Personal Message (Offline)

Ignore
1713559414
Reply with quote  #2

1713559414
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
jgarzik
Legendary
*
Offline Offline

Activity: 1596
Merit: 1091


View Profile
August 27, 2010, 04:56:37 AM
 #2


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)
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500


View Profile
August 27, 2010, 05: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]' =)

jgarzik
Legendary
*
Offline Offline

Activity: 1596
Merit: 1091


View Profile
August 27, 2010, 06: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 <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 Offline

Activity: 5166
Merit: 12865


View Profile
August 27, 2010, 07:36:56 AM
 #5

I added it to the wiki. getreceivedbyaddress has been around since 0.2.9.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
hippich (OP)
Hero Member
*****
Offline Offline

Activity: 546
Merit: 500


View Profile
August 27, 2010, 01:06:08 PM
 #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 =)

payb.tc
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
March 20, 2012, 12:20:19 PM
Last edit: March 20, 2012, 12:35:06 PM by payb.tc
 #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.
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
March 20, 2012, 02:32:01 PM
 #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.

I do Bitcoin stuff.
payb.tc
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
March 20, 2012, 02:51:41 PM
 #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.
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
March 20, 2012, 03:08:55 PM
 #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.

I do Bitcoin stuff.
payb.tc
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
April 21, 2012, 12:55:52 PM
 #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
romsa9
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
August 27, 2013, 04:07:03 PM
 #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?
payb.tc
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
August 27, 2013, 09: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.

romsa9
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
September 01, 2013, 04:26:08 AM
 #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)
dragonfruit
Newbie
*
Offline Offline

Activity: 27
Merit: 0



View Profile
September 01, 2013, 05: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.
gmaxwell
Staff
Legendary
*
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
September 01, 2013, 06: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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!