Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: beijing2008 on June 25, 2014, 04:34:22 PM



Title: What's the mean of "Account has insufficient funds"
Post by: beijing2008 on June 25, 2014, 04:34:22 PM
When I withdraw from the PHP exchange website, An error happened.
I get the notice “Account has insufficient funds” from the error data  by wireshark.

And then I check the Bitcoin sourcecode and find these:


     // Check funds
      int64 nBalance = GetAccountBalance(strAccount, nMinDepth);
      if (nAmount > nBalance)
 -        throw JSONRPCError(-6, "Account has insufficient funds");
 +        throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");
  '

The wallet in the server do has enough funds, so what reason it might be?


Title: Re: What's the mean of "Account has insufficient funds"
Post by: GoldenWings91 on June 25, 2014, 04:53:39 PM
The account that you are trying to withdraw from doesn't have enough funds assigned to it.


Title: Re: What's the mean of "Account has insufficient funds"
Post by: beijing2008 on June 25, 2014, 05:17:41 PM
The account that you are trying to withdraw from doesn't have enough funds assigned to it.

There is actually enough funds in the Wallet Client.

Do you mean there is not enough from the account?

For example, there is 100000000 coins in the wallet but there is only 20 from the address XXXXXXXXXXX in the wallet.

So  I can't withdraw more than 20 ?


Title: Re: What's the mean of "Account has insufficient funds"
Post by: grue on June 25, 2014, 05:24:52 PM
no, accounts are independent of addresses.


Title: Re: What's the mean of "Account has insufficient funds"
Post by: Dare on June 25, 2014, 07:29:56 PM
If you're using an account with insufficient funds allocated to it, then you won't be able to withdraw from it, even if other accounts in the wallet collectively have enough. You'll need to either rearrange the addresses behind your accounts, send more funds to the one you're attempting to withdraw from, or withdraw from either a different account or multiple accounts.


Title: Re: What's the mean of "Account has insufficient funds"
Post by: kuji kiri on June 25, 2014, 10:08:15 PM
I would advise you to use a separate database for bookkeeping.


Title: Re: What's the mean of "Account has insufficient funds"
Post by: Sydboy on June 26, 2014, 05:52:06 PM
Are you in the process of setting up an exchange ?


Title: Re: What's the mean of "Account has insufficient funds"
Post by: Sydboy on June 26, 2014, 05:53:30 PM
and perhaps the tx fee, if applicable was not taken into account ? when the account balance was looked up.


Title: Re: What's the mean of "Account has insufficient funds"
Post by: beijing2008 on June 27, 2014, 06:17:43 AM
May I understan your mean like this:

If a wallet of XXXCoin has two address 123xxxxxxxxxxx and 456xxxxxxxxxxxxx and 

1000 coins with the address  123xxxxxxxxxxxxx
0 coin with the address 456xxxxxxxxxxxxxx

then I can't withdraw from the address 456xxxxxxxxxx even  1 coin ?


Title: Re: What's the mean of "Account has insufficient funds"
Post by: beijing2008 on June 27, 2014, 06:23:31 AM
Are you in the process of setting up an exchange ?

Yes I am
can you help?


Title: Re: What's the mean of "Account has insufficient funds"
Post by: Dare on June 27, 2014, 06:40:42 AM
May I understan your mean like this:

If a wallet of XXXCoin has two address 123xxxxxxxxxxx and 456xxxxxxxxxxxxx and 

1000 coins with the address  123xxxxxxxxxxxxx
0 coin with the address 456xxxxxxxxxxxxxx

then I can't withdraw from the address 456xxxxxxxxxx even  1 coin ?

If 123xxxxxxxxxxxxx and 456xxxxxxxxxxxxx are ACCOUNTS, then you are correct. Addresses are independent to accounts, and there isn't a 1:1 correlation between them; you can assign multiple addresses to a single account.

Are you in the process of setting up an exchange ?

Yes I am
can you help?

A word of advice for setting up an exchange; accounts in bitcoind don't scale up that well, and it will be both faster and more secure if you use a database to keep track of balances and just use bitcoind for transferring coins into or out of your exchange.


Title: Re: What's the mean of "Account has insufficient funds"
Post by: beijing2008 on July 04, 2014, 08:08:29 AM
how can I keep the relationships between Bitcoind and Database of the website ?


Title: Re: What's the mean of "Account has insufficient funds"
Post by: DeathAndTaxes on July 06, 2014, 03:59:18 PM
how can I keep the relationships between Bitcoind and Database of the website ?

That is a very open ended question.  It depends on what you are trying to accomplish.