Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: ironfeast on October 24, 2018, 06:52:37 AM



Title: Negative Balance in RPC Accounts
Post by: ironfeast on October 24, 2018, 06:52:37 AM
 Hi There,

I am using bitcoin core with RPC and have linked few accounts to it. When I run "listaccounts" command via bitcoin-cli, it gives following output:

{
  "": 0.00000000,
  "5ab4aafee94ff2258d2237a5": 0.01493139,
  "LABELPREFIX5ae21dd9bb5c583ec41732ae": 0.00000000,
  "LABELPREFIX5ae21de2bb5c583ec41732af": 0.00000000,
"LABELPREFIX5ae457e0bb5c583ec41732cd": -0.00588460,
  "LABELPREFIX5ae45999bb5c583ec41732d1": -0.00107414,

  "LABELPREFIX5ae6b2fcbb5c583ec41732e3": 0.00000000,
 "LABELPREFIX5ae86a453c74bc56539edbcd": -0.00144921,
  "LABELPREFIX5ae95e845e4db63ceb8b72e0": 0.00000000,
  "LABELPREFIX5aefffce0f96522e2658640a": 0.00000000,
  "LABELPREFIX5af000590f96522e2658640b": 0.00000000,
  "LABELPREFIX5af004350f96522e2658641b": 0.00000000,
  "LABELPREFIX5af004a70f96522e2658641f": 0.00000000,
  "LABELPREFIX5af0054e0f96522e26586422": 0.00000000,
  "LABELPREFIX5af008f00f96522e26586429": 0.00000000,
  "LABELPREFIX5af012010f96522e2658642e": 0.00000000,
  "LABELPREFIX5af013df0f96522e2658642f": 0.00000000,
  "LABELPREFIX5af025f60f96522e2658643c": 0.00000000,
  "LABELPREFIX5af0267d0f96522e2658643f": 0.00000000,
  "LABELPREFIX5af0295e0f96522e26586443": 0.00000000,
  "LABELPREFIX5af02a220f96522e26586447": 0.00000000,
  "LABELPREFIX5afd9be466270076e8aab970": 0.00000000,
  "LABELPREFIX5b05806e66270076e8aab9e8": 0.00000000,
  "LABELPREFIX5b05a9d666270076e8aaba18": 0.00000000,
  "LABELPREFIX5b0a43830153e23d9ee80064": 0.00000000,
  "LABELPREFIX5b0bcdd109b9224736c9b36f": 0.00000000,
 "LABELPREFIX5b17865709b9224736c9b3e5": -0.00652344,
  "LABELPREFIX5b1f714509b9224736c9b426": 0.00000000,
  "LABELPREFIX5b58638830db55306b567116": 0.00000000,
  "test": 0.00000000
}

I can't understand why these four accounts have negative balance. And when I add all these negative balances, outcome is this  "5ab4aafee94ff2258d2237a5": 0.01493139, balance.

Help in all ways is highly appreciated. God Bless You


Title: Re: Negative Balance in RPC Accounts
Post by: bob123 on October 24, 2018, 07:02:44 AM
Using 'Accounts' inside of core is deprecated. Check https://bitcoin.org/en/developer-reference#rpc-quick-reference (https://bitcoin.org/en/developer-reference#rpc-quick-reference).

If you need to handle different type of user, you'll need to create an external database and link them to addresses generated by core.
The 'account functionality' inside of core does not work properly and is deprecated.

Do not use and/or rely on it.


Title: Re: Negative Balance in RPC Accounts
Post by: achow101 on October 24, 2018, 01:35:08 PM
This is expected behavior with accounts. This is also one reason why you shouldn't use it.


Title: Re: Negative Balance in RPC Accounts
Post by: seoincorporation on October 25, 2018, 04:01:41 PM
You should try with :

Code:
bitcoin-cli getreceivedbyaddress 1BitcoinAddyFull...

And you can make a script with the list of addys to get the real balance from each one.
Code:
for a in $(cat addys.txt)
do
echo "$a-"$(bitcoin-cli getreceivedbyaddress $a)
done