<p>An account can have multiple associated addresses. Presumably you had another address associated with <code>""</code> beforehand, and received money using that address.</p>

<p>The <code>getaccountaddress</code> RPC call gives a fresh address. If money had been received already on the previous account address, a new one is created and associated with the account.</p>

CC BY-SA 3.0
2017-11-22T09:24:08.223Z
Thank you! However I still get problem. I call RPC **getaddressesbyaccount** and get 3 addresses. Then I call RPC **getreceivedbyaddress** for each 3 address, but the result are all 0.00000000.
Anderson
CC BY-SA 3.0
2017-11-22T09:24:28.830Z
Did you send money to any of those 3 addresses?
Pieter Wuille
CC BY-SA 3.0
2017-11-23T06:04:58.153Z
No. However, I expect one of the addresses should have money because the result of RPC "listaccounts" shows there is money in the account.
Anderson
CC BY-SA 3.0
2017-11-23T06:11:40.783Z
getreceivedbyaddress shows (surprise!) how much was received by the address. If you literally tell me you never sent money to any of them, then by definition the response should be 0. There are plenty of other ways through which the account may have been credited before.
Pieter Wuille
CC BY-SA 3.0
2017-11-24T02:49:29.153Z
Like what kind of ways? Does it related to regtest mode?(because I am using regtest mode)
Anderson
CC BY-SA 3.0
2017-11-24T03:57:21.653Z
You could have received money using a `getnewaddress` call before any of those 3, or using the `move` command you can move money from other accounts (even if that makes those others negative).
Pieter Wuille
CC BY-SA 3.0
2017-11-22T08:38:18.650Z
2017-11-22T08:38:18.650Z
Pieter Wuille
<pre><code>bitcoin &gt; bitcoin-cli listaccounts
{
  "": 5648.99996160
}

bitcoin &gt; bitcoin-cli getaccountaddress ""
mui4xgNgZBr3XhdL4dDDHkRFEvSXZmSi7t

bitcoin &gt; bitcoin-cli getreceivedbyaddress mui4xgNgZBr3XhdL4dDDHkRFEvSXZmSi7t
0.00000000
</code></pre>

<p>I expect it will return 5648.99996160 after calling 'getreceivedbyaddress'.</p>

<bitcoind><json-rpc>
Unexpected result after calling RPC 'listaccounts', 'getaccountaddress', 'getreceivedbyaddress' sequentially
Anderson
# Unexpected result after calling RPC 'listaccounts', 'getaccountaddress', 'getreceivedbyaddress' sequentially

(Asked by: username_0 on 2017-11-22)

```
bitcoin > bitcoin-cli listaccounts
{
  "": 5648.99996160
}

bitcoin > bitcoin-cli getaccountaddress ""
mui4xgNgZBr3XhdL4dDDHkRFEvSXZmSi7t

bitcoin > bitcoin-cli getreceivedbyaddress mui4xgNgZBr3XhdL4dDDHkRFEvSXZmSi7t
0.00000000

```

I expect it will return 5648.99996160 after calling 'getreceivedbyaddress'.

**Tags:** bitcoind, json-rpc


---

## 1 answers

### Answer by username_1 on 2017-11-22. Score: 1 | Accepted answer

An account can have multiple associated addresses. Presumably you had another address associated with `""` beforehand, and received money using that address.

The `getaccountaddress` RPC call gives a fresh address. If money had been received already on the previous account address, a new one is created and associated with the account.

> **Comments:**
> **username_0**: Thank you! However I still get problem. I call RPC **getaddressesbyaccount** and get 3 addresses. Then I call RPC **getreceivedbyaddress** for each 3 address, but the result are all 0.00000000.  
> **username_1**: Did you send money to any of those 3 addresses?  
> **username_0**: No. However, I expect one of the addresses should have money because the result of RPC "listaccounts" shows there is money in the account.  
> **username_1**: getreceivedbyaddress shows (surprise!) how much was received by the address. If you literally tell me you never sent money to any of them, then by definition the response should be 0. There are plenty of other ways through which the account may have been credited before.  
> **username_0**: Like what kind of ways? Does it related to regtest mode?(because I am using regtest mode)  
> **username_1**: You could have received money using a `getnewaddress` call before any of those 3, or using the `move` command you can move money from other accounts (even if that makes those others negative).  

---

