Nud getreceivedbyaddress always returning 0

Hello,

I am working on using the Nud method calls but every time I make a call to check the balance of an address it always returns 0.

For example if I do the call
./nud -unit=B getreceivedbyaddress BL3vYTwJmWKMAqPXaSNbiYtZdQaegTM9uA
It returns 0. Even tho at the time of this posting the address has funds in it. I have also tried adding a 0 or 1 at the end to say 0 or 1 confirmation but still get 0 returned.

Would appreciate any help

FYI: I have confirmed my Nud is up to date

This command works only for addresses you own. It furthermore doesn’t return what you want. getreceivedbyaddress returns the total amount of coins that were ever received by the address. Furthermore it is unsafe to trace the balance of an address because of change addresses.

What you would need are watch-only addresses. Then you can call "setaccount " and afterwards retrieve the balance through getbalance. However, I don’t know if watch-only addresses are on the development roadmap right now.

So currently the only way I see is to make a blocknotify that checks if the address is involved in one of the transactions of the block and updates the balance accordingly.

Interesting seems like a huge problem that there is no easy way to simple get the current balance of an address that you do not own

Basically you have all you need (to ge the balance of an address) on a machine with a fully synchronized block chain.
But if you don’t want to store information about transactions in a database where you can comfortably look for balances per address, you need to scan the whole block chain for a balance of an address.
While one could argue that it’d be nice to have that included in the wallet, there are other convenient ways to do that.
Here you are: https://blockexplorer.nu/address/BL3vYTwJmWKMAqPXaSNbiYtZdQaegTM9uA/1/newest

Yea seems my best option is to simply pull the info from blockexplorer.nu. Just wish they had a clean api or json to pull

https://blockexplorer.nu/api/v1/addressInfo/BL3vYTwJmWKMAqPXaSNbiYtZdQaegTM9uA

1 Like

Sweet. Can you point me to the documentation of the API? I cannot find it …

Oh, no wonder why, its written in black on black background, next to “Testnet” in main menu. Here ->

http://blockexplorer.nu/apidocs

Thanks. It could need some rebranding :slight_smile: Is it planned to extend this PPC based implementation to allow the query of Nu related stuff like votes, liquidity etc?

1 Like