• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Negative balance on an account

wsmithston

New member
After playing around with the dash-cli for a while, I somehow ended up with an account that showed
a negative balance. Unfortunately, I didn't take note of all my steps and can't tell exactly what I did prior to getting the following output:

> cli listaccounts
{
"" : -0.20010000,
"first" : 0.00000000,
"zeroth" : 0.50000000
}
cli getaddressesbyaccount ""
[
"XtLnLbinnr8g39T7o2DkYWpHJRa8639wzA",
"XhbPC3g2HZ7Mgefd8NwZj2axkZjobrbZ3S"
]
> cli getaddressesbyaccount "zeroth"
[
"XsMp5xT3PxkREwScUVy7214TCQm3VgaSyQ",
"XmmM7FqJLT5MJK4VcKt3iCbEFNSWcHLnAn"
]

At this point the addresses in account "" had not yet been seen by the network, and XmmM7FqJLT5MJK4VcKt3iCbEFNSWcHLnAn had 0.5 DASH sitting in there. I decided to send 0.3 DASH to one of the addresses in "" to see what would happen to the balance and was rather surprised to see the following message:

> cli sendfrom "zeroth" "XtLnLbinnr8g39T7o2DkYWpHJRa8639wzA" 0.3
error: {"code":-4,"message":"Insufficient funds"}

I then decided to send less, 0.21 DASH to be exact.

> cli sendfrom "zeroth" "XtLnLbinnr8g39T7o2DkYWpHJRa8639wzA" 0.21
9cccefa2e5ad8b479fd0cc858a19c097d57b42891a8b30cfb450e69274659563

Somehow this worked, but the balance shown on account "" doesn't agree with the blockchain since
XtLnLbinnr8g39T7o2DkYWpHJRa8639wzA has 0.21 DASH in there and I'm seeing:
> cli listaccounts
{
"" : 0.00990000,
"first" : 0.00000000,
"zeroth" : 0.29000000
}

Would greatly appreciate it if someone could shed some light on what's happening here...
Am I wrong in my assumption that a balance should never show a negative value?
 
That explains a lot.

[...]
You should never rely on accounts and should always use your own DB if you build some service because "accounts" is a kind of very simplistic internal server DB that has almost nothing to do with blockchain. [...]
This sounds like good advice. Thanks.
 
Back
Top