Bitcoin Forum
May 08, 2024, 12:10:01 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin API "getbalance" for a spesific account is invalid.  (Read 1575 times)
MangoJ (OP)
Full Member
***
Offline Offline

Activity: 222
Merit: 100


BTCRaven.com Escrow & Advertising


View Profile WWW
July 22, 2013, 11:36:47 PM
 #1

Hello.

I am testing bitcoind on my server and I noticed some API calls are wrong.
For example "getaccountaddress" is listed to "Returns the current bitcoin address for receiving payments to this account. "
However it creates a NEW address in your wallet and gives it the same account name.  This cannot be right.
But I dont care about that one.

I do care about having multiple "accounts" and getting the current ~available~ balance.
Bitcoind API seems INCAPABLE of telling you the current available balance for an account.
"Getbalance" will only show the available balance for your entire wallet, OR All the coin you have EVER received for a specific account, but not the current balance for a specific account.

I have looked on google to see other people with the same problem and no solution.
Yet other websites can take my bitcoin address and tell me how much I have in my account currently.

How can I get the current balance for one of the many different "accounts"?

(Also the "move" API function does nothing at all.)

Automated Escrow  For instant BTC transactions without waiting for a 3rd party.  http://BTCRaven.com
It is a common myth that Bitcoin is ruled by a majority of miners. This is not true. Bitcoin miners "vote" on the ordering of transactions, but that's all they do. They can't vote to change the network rules.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
MangoJ (OP)
Full Member
***
Offline Offline

Activity: 222
Merit: 100


BTCRaven.com Escrow & Advertising


View Profile WWW
July 22, 2013, 11:56:53 PM
 #2

For example... the following API/PHP code:
Quote
$main='1CbXKAKwV1173nNoopT5dFbwin2us9kJo5';
print("Current Balance: ".$bitcoin->getbalance()."<br>");
$accountname="main";
print_r($bitcoin->getbalance($accountname,0)."<br>");
print_r($bitcoin->getbalance($accountname,1)."<br>");
print_r($bitcoin->getbalance($accountname,10)."<br>");
print_r($bitcoin->getbalance($accountname,100)."<br>");
print_r($bitcoin->getbalance($accountname,1000)."<br>");
print_r($bitcoin->getbalance($accountname,10000)."<br>");
print_r($bitcoin->getbalance($accountname,100000)."<br>");
print_r($bitcoin->getbalance($accountname,1000000)."<br>");
print_r($bitcoin->getbalance($accountname,10000000)."<br>");
print_r($bitcoin->getbalance($accountname,99999999999)."<br>");
print_r($bitcoin->getbalance($accountname,999999999999)."<br>");
print_r($bitcoin->getbalance($accountname,9999999999999)."<br>");

will result in a strange inconsistent:
Quote
Current Balance: 0.35959594
53.11832942
53.11832942
53.11832942
53.09431754
52.95047184
41.96723348
0.3664962
0.3664962
0.3664962
0.3664962
53.11832942
0.3664962

Why is it uneven?
Why does the number of verifications more or less return different account balances?
My TRUE current balance is 0.35959594

Automated Escrow  For instant BTC transactions without waiting for a 3rd party.  http://BTCRaven.com
MangoJ (OP)
Full Member
***
Offline Offline

Activity: 222
Merit: 100


BTCRaven.com Escrow & Advertising


View Profile WWW
July 23, 2013, 04:16:00 AM
 #3

Solved. Move function does work, I had odd numbers spread out all over, negative numbers etc.

Automated Escrow  For instant BTC transactions without waiting for a 3rd party.  http://BTCRaven.com
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
July 27, 2013, 04:41:30 AM
 #4

The basic problem is that accounts and addresses do not in any way work the way you think they work.

Bitcoin accounts have no concept of "available".  They aren't for that.  The wallet as a whole has "available", but accounts do not.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
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!