Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: TAiS46 on June 19, 2012, 07:48:44 AM



Title: bitcoind getbalance with minconf = 0
Post by: TAiS46 on June 19, 2012, 07:48:44 AM
Hello,

is there a way, to list the total balance (bitcoind getbalance) with minconf = 0 instead of 1?

Have try something like:
bitcoind getbalance * 0

But then it will show me the balance of the account *!

Is there a way?

Greetings
Simon


Title: Re: bitcoind getbalance with minconf = 0
Post by: Red Emerald on June 19, 2012, 07:00:10 PM
Hello,

is there a way, to list the total balance (bitcoind getbalance) with minconf = 0 instead of 1?

Have try something like:
bitcoind getbalance * 0

But then it will show me the balance of the account *!

Is there a way?

Greetings
Simon
I believe Luke-jr's next-test branch shows an "unconfirmed balance" with getinfo.

github.com/luke-jr/bitcoin

Hopefully that will be pulled into the official repo soon.  I can't see how it would introduce any bugs.


Title: Re: bitcoind getbalance with minconf = 0
Post by: mb300sd on June 21, 2012, 05:45:56 AM
Hello,

is there a way, to list the total balance (bitcoind getbalance) with minconf = 0 instead of 1?

Have try something like:
bitcoind getbalance * 0

But then it will show me the balance of the account *!

Is there a way?

Greetings
Simon

If you are not using the accounts feature, all your bitcoins are in the account ""

try

bitcoind getbalance "" 0


Title: Re: bitcoind getbalance with minconf = 0
Post by: geebus on June 21, 2012, 08:07:27 AM
Also, if not using the command line (i.e. using Python or PHP) you can use "*" as the account name and it actually will wildcard all accounts.

Python: (requires python-jsonrpc package)
Code:
#!/bin/python

from jsonrpc import ServiceProxy
from jsonrpc.proxy import JSONRPCException
from jsonrpc.json import JSONDecodeException

RPC = ServiceProxy("http://%s:%s@%s:%s" % ('yourusername', 'yourpassword', '127.0.0.1', 8332))
try:
print "%s" % RPC.getbalance("*", 0)
except JSONRPCException, e:
print e.error['message']
except:
        pass

PHP: (requires jsonRPCClient Class)
Code:
<?php
         
require_once("jsonRPCClient.php");
         
$RPC = new jsonRPCClient("http://yourusername:yourpassword@127.0.0.1:8332");
         echo 
$RPC->getbalance("*"0);
?>



Title: Re: bitcoind getbalance with minconf = 0
Post by: TAiS46 on June 21, 2012, 08:31:47 AM
YES, thank you :)

You can also use the command line with

Code:
bitcoind getbalance "*" 0