1

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 (balance of 0.06 BTC)
  2. Then I import it into bitcoincore:

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

  1. 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
  • There is no addrindex=1 setting in Bitcoin Core, so what software are you asking about? What does the listunspent output show? – G. Maxwell Mar 20 at 9:41
  • I used addrindex as I was desperate. My listunspent show the two unspent transactions as expected, both are marked spendable, solvable and safe. Output here. – f-dufour Mar 20 at 10:20
  • I use bitcoincore 0.16.3 built from source. – f-dufour Mar 20 at 10:28
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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.