Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: ptahiliani on June 24, 2013, 10:43:31 AM



Title: How can get Bitcoin client API account(<account>) parameter value
Post by: ptahiliani on June 24, 2013, 10:43:31 AM
I have setup the BIK_php API of  http://bitcoindevkit.com/  in PHP.
Now, I am able to connect and generate new addresses, but when I am going to call some functions like getaddressesbyaccount, sendfrom etc as given in Bitcoin API call list at https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list , these functions requires "account" parameter as <account>, but I could not understand where from I can get the account value?
So, Please let me know what will be the value of <account>, and how can I get the <account>  value from?





Title: Re: How can get Bitcoin client API account(<account>) parameter value
Post by: kjj on June 24, 2013, 11:07:40 AM
You can usually use either "*" or an empty string in calls that need an account name.


Title: Re: How can get Bitcoin client API account(<account>) parameter value
Post by: ptahiliani on June 24, 2013, 11:45:48 AM
You can usually use either "*" or an empty string in calls that need an account name.
Thanks for your Reply!

But how can get account name? because in some functions its a mandatory parameter.
As well as how can create new account to assign Bitcoin addresses?
   


Title: Re: How can get Bitcoin client API account(<account>) parameter value
Post by: ptahiliani on June 24, 2013, 12:10:17 PM
You can usually use either "*" or an empty string in calls that need an account name.
I tried with "*" but get error, and when tried with empty string then its returns only no label addresses instead of all addresses.
So, here account name is the address Label?


Title: Re: How can get Bitcoin client API account(<account>) parameter value
Post by: kjj on June 25, 2013, 04:18:13 PM
Accounts get created automatically when you use them.

Code:
getnewaddress "account"
either adds an address (key) to "account", or it creates "account" with a new address.
Code:
setaccount "address" "account"
associates an existing address with either a new or old account.

The empty string is the default account.  When performing an action that operates on an account, but you don't want it for any specific account, use the empty string.  "*" is all accounts, you use it when fetching information.

The quotation marks are not part of the account name, but how to handle them depends on how you are making the RPC calls.


Title: Re: How can get Bitcoin client API account(<account>) parameter value
Post by: NielDLR on June 27, 2013, 03:29:48 PM
You can also use the 'listaccounts' command to show current accounts and their balances.