<p>You are using <code>getbalance</code> incorrectly. You have specified an account name of the address that you want the balance for. However this is not how <code>getbalance</code> works. Bitcoin does not use accounts and addresses are not accounts. An account here means an account in Bitcoin Core's internal accounts system which has since been removed.</p>

<p>So your command <code>getbalance mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr</code> is asking for the balance of the account named <code>mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr</code>, but no such account exists. The account that has the address <code>mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr</code> is named <code>From Electrum Wallet</code>. Thus the command you should be using is</p>

<pre><code>getbalance "From Electrum Wallet"
</code></pre>

CC BY-SA 4.0
2019-03-22T16:21:22.403Z
2019-03-22T16:21:22.403Z
Ava Chow
<p>I imported a private key from my electrum wallet (testnet) to bitcoincore (testnet) as follow:</p>

<ol>
<li>In my electrum wallet, I copy the private key associated to the address <a href="https://www.blockchain.com/en/btctest/address/mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr" rel="nofollow noreferrer">mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr</a> (balance of 0.06 BTC)</li>
<li>Then I import it into bitcoincore:</li>
</ol>

<p><code>~# bitcoin-cli importprivkey "the 52 characters private key here" "From Electrum Wallet"</code></p>

<ol start="3">
<li>Rescan should be automatic but I ask for a reindex and rescan:</li>
</ol>

<p><code>~# bitcoind -rescan -reindex</code></p>

<p>After a while, I can issue:</p>

<p><code>~# bitcoin-cli listaddressgroupings</code></p>

<p>And I successfully get:</p>



<pre><code>[
 [
   [
     "mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr",
     0.06000000,
     "From Electrum Wallet"
   ]
 ],
 [
   [
     "2MwBERpNv7JJaW4nVUbQncXjFjG1nFKLYEp",
     0.05000000,
     "test"
   ],
   [
     "2N4AMdXitdYhNdjafzHG61uUdrErExSdhKs",
     0.00498305
   ]
 ],
 [
   [
     "2N6xTkaeuKsQSHCortgxiNvsVXj2Gv1Qy85",
     0.05000000,
     "test2"
   ]
 ]
]
</code></pre>

<p>But when I ask for the balance, it returns 0:</p>

<p><code>~# bitcoin-cli getbalance mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr</code></p>

<p><code>0.00000000</code></p>

<p>How possible is that, considering that the rescan has been performed and that the balance is correct in listaddressgroupings? As a result, I am not able to spend bitcoins from this address.</p>

<p>Thank you for you input/insight!</p>

<p>My bitcoin.conf:</p>

<pre><code>txindex=1
addrindex=1
listen=1
server=1
daemon=1
testnet=1
</code></pre>

CC BY-SA 4.0
2019-03-20T09:41:55.433Z
There is no addrindex=1 setting in Bitcoin Core, so what software are you asking about?   What does the listunspent output show?
G. Maxwell
CC BY-SA 4.0
2019-03-20T10:20:37.817Z
I used [addrindex](https://counterpartytalk.org/t/what-is-addrindex-and-why-is-it-necessary/1202) as I was desperate. My listunspent show the two unspent transactions as expected, both are marked spendable, solvable and safe. Output [here](https://gitlab.univ-lorraine.fr/dufour18/cert-bundle/snippets/7).
f-dufour
CC BY-SA 4.0
2019-03-20T10:28:00.713Z
I use bitcoincore 0.16.3 built from [source](https://github.com/bitcoin/bitcoin).
f-dufour
<bitcoind><electrum><testnet><balance><private-key-import>
getbalance and listaddressgroupings inconsistent
f-dufour
# getbalance and listaddressgroupings inconsistent

(Asked by: username_0 on 2019-03-20)

I imported a private key from my electrum wallet (testnet) to bitcoincore (testnet) as follow:

1. In my electrum wallet, I copy the private key associated to the address [mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr](https://www.blockchain.com/en/btctest/address/mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr) (balance of 0.06 BTC)
2. Then I import it into bitcoincore:

`~# bitcoin-cli importprivkey "the 52 characters private key here" "From Electrum Wallet"`

3. Rescan should be automatic but I ask for a reindex and rescan:

`~# bitcoind -rescan -reindex`

After a while, I can issue:

`~# bitcoin-cli listaddressgroupings`

And I successfully get:

```
[
 [
   [
     "mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr",
     0.06000000,
     "From Electrum Wallet"
   ]
 ],
 [
   [
     "2MwBERpNv7JJaW4nVUbQncXjFjG1nFKLYEp",
     0.05000000,
     "test"
   ],
   [
     "2N4AMdXitdYhNdjafzHG61uUdrErExSdhKs",
     0.00498305
   ]
 ],
 [
   [
     "2N6xTkaeuKsQSHCortgxiNvsVXj2Gv1Qy85",
     0.05000000,
     "test2"
   ]
 ]
]

```

But when I ask for the balance, it returns 0:

`~# bitcoin-cli getbalance mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr`

`0.00000000`

How possible is that, considering that the rescan has been performed and that the balance is correct in listaddressgroupings? As a result, I am not able to spend bitcoins from this address.

Thank you for you input/insight!

My bitcoin.conf:

```
txindex=1
addrindex=1
listen=1
server=1
daemon=1
testnet=1

```

**Tags:** bitcoind, electrum, testnet, balance, private-key-import

> **Comments:**
> **username_1**: There is no addrindex=1 setting in Bitcoin Core, so what software are you asking about?   What does the listunspent output show?  
> **username_0**: I used [addrindex](https://counterpartytalk.org/t/what-is-addrindex-and-why-is-it-necessary/1202) as I was desperate. My listunspent show the two unspent transactions as expected, both are marked spendable, solvable and safe. Output [here](https://gitlab.univ-lorraine.fr/dufour18/cert-bundle/snippets/7).  
> **username_0**: I use bitcoincore 0.16.3 built from [source](https://github.com/bitcoin/bitcoin).  

---

## 1 answers

### Answer by username_2 on 2019-03-22. Score: 1

You are using `getbalance` incorrectly. You have specified an account name of the address that you want the balance for. However this is not how `getbalance` works. Bitcoin does not use accounts and addresses are not accounts. An account here means an account in Bitcoin Core's internal accounts system which has since been removed.

So your command `getbalance mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr` is asking for the balance of the account named `mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr`, but no such account exists. The account that has the address `mmUToPM2vBb2F1ZNcR86J12GxqAbUJtFCr` is named `From Electrum Wallet`. Thus the command you should be using is

```
getbalance "From Electrum Wallet"

```


---

