ListAccounts

Requires wallet support.

The listaccounts RPC lists accounts and their balances. listaccounts will be removed in a later version of Pai Core. Use the RPCs listed in the See Also subsection below instead.

Parameter #1—the minimum number of confirmations a transaction must have

Name Type Presence Description
Confirmations number (int) Optional
(0 or 1)
The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance. Transactions generated by this node are counted immediately. Typically, externally-generated transactions are payments to this wallet and transactions generated by this node are payments to other wallets. Use 0 to count unconfirmed transactions. Default is 1

Parameter #2—whether to include watch-only addresses in results

Name Type Presence Description
Include Watch Only bool Optional
(0 or 1)
If set to true, include watch-only addresses in details and calculations as if they were regular addresses belonging to the wallet. If set to false (the default), treat watch-only addresses as if they didn’t belong to this wallet

Result—a list of accounts and their balances

Name Type Presence Description
result object Required
(exactly 1)
A JSON array containing key/value pairs with account names and values. Must include, at the very least, the default account ("")

Account : Balance
string : number (pai’) Required
(1 or more)
The name of an account as a string paired with the balance of the account as a number of pai’s. The number of pai’s may be negative if the account has spent more pai’s than it received. Accounts with zero balances and zero transactions will be displayed

Example

Display account balances with one confirmation and watch-only addresses included.

pai-cli -testnet listaccounts 1 true

Result:

{
    "" : -2.73928803,
    "Refund from example.com" : 0.00000000,
    "doc test" : -498.45900000,
    "someone else's address" : 0.00000000,
    "someone else's address2" : 0.00050000,
    "test" : 499.97975293,
    "test account" : 0.00000000,
    "test label" : 0.48961280,
    "test1" : 1.99900000
}

See also

  • GetAccount: returns the name of the account associated with the given address.
  • GetAddressesByAccount: returns a list of every address assigned to a particular account.
  • ListReceivedByAccount: lists the total number of pai’s received by each account.