Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Can't generate a change-address key. No keys in the internal keypool and can't generate any keys." #16091

Closed
redblade7 opened this issue May 26, 2019 · 43 comments

Comments

@redblade7
Copy link

redblade7 commented May 26, 2019

Hi,

I am trying to make a purchase but am unable to. bitcoin-qt gives the error:

"Can't generate a change-address key. No keys in the internal keypool and can't generate any keys."

When I try to Google this error, I only come up with mirrors of Bitcoin's source code. debug.log doesn't show any additional information.

No money is sent and there are no new transactions with the wallet.

The wallet is encrypted and unlocked. Using bitcoin-qt v0.18.0 on Gentoo Linux. Tried both the third-party layman version and compiling the official bitcoincore.org source and both fail to let me make a purchase. The last transaction on the wallet was in December 2018 and whatever the latest version of bitcoin-qt was back then.

@redblade7
Copy link
Author

redblade7 commented May 26, 2019

I was able to do a send and receive just fine with Bitcoin Testnet, same version.

If this helps, the Bitcoin Testnet uses an HD wallet, while the mainnet wallet I'm having problems with is older and non-HD. Both are encrypted.

@maflcko
Copy link
Member

maflcko commented May 26, 2019

Can you do a keypoolrefill RPC in the debug console?

@redblade7
Copy link
Author

redblade7 commented May 26, 2019

I ran keypoolrefill (no parameters) on Testnet and Mainnet and both return "null" so I guess so

@redblade7
Copy link
Author

After downgrading to 0.17.1 I was able to make a purchase with no errors.

@promag
Copy link
Member

promag commented Jun 11, 2019

So you couldn't create the transaction with 0.18.0 even after keypoolrefill?

@redblade7
Copy link
Author

No, I wasn't able to.

@byt3farm
Copy link

Hello Same here. Just wanted to send bitcoins and got the
"Can't generate a change-address key. No keys in the internal keypool and can't generate any keys."
Error Message.
keypoolrefill (returned null) but didn't fix anything.
Downgrade to version v0.17.1 (64-bit) fixed the problem.

To make a transaction is a core feature of this application, right? Quite uncool experience when you really need to do a transfer but you can't because the latest software is broken somehow, should be fixed asap!

@darosior
Copy link
Member

darosior commented Jul 7, 2019

@byt3farm

Hello

Hello

Just wanted to send bitcoins and got the
"Can't generate a change-address key. No keys in the internal keypool and can't generate any keys."
Error Message.
keypoolrefill (returned null) but didn't fix anything.
Downgrade to version v0.17.1 (64-bit) fixed the problem.

Which command did you use ? sendtoaddress ? I cannot reproduce using v0.18.0 on testnet, and I cannot inspect efficiently without reproduce instructions.

To make a transaction is a core feature of this application, right? Quite uncool experience when you really need to do a transfer but you can't because the latest software is broken somehow, should be fixed asap!

It is, that's why we need you to add instructions and details so that we can reproduce and try to fix it. Here are some questions which answers would help for debuging :

  • What RPC command did you use ?
  • Have you been using your wallet for some time ? / Did it happen before ? / Did it work for some time using 0.18 ?
  • Does it works with a fresh wallet ?

@redblade7 if you can answer some of the above questions, it could help too

@redblade7
Copy link
Author

I did not have any problems with a testnet HD wallet (see second comment). The wallet having problems goes back to 2015 and is non-HD.

To make the transaction, I used the GUI, not an RPC command.

@byt3farm
Copy link

byt3farm commented Jul 8, 2019

Hello

  • I am using an old wallet (maybe from 2011?)
  • I just recently encrypted the wallet (before it was not encrypted at all)
  • My last transaction before this error occured is more than 1 Year ago
  • I never saw this error ever before
  • I did not try with a fresh wallet
  • I did not use any RPC commands, I was using the GUI and didnt do anything special at all

@darosior
Copy link
Member

darosior commented Jul 8, 2019

Ok so it seems to be related to pre-HD split : could you try to start v0.18 with -upgradewallet ?

@redblade7
Copy link
Author

Unfortunately I can't upgrade my wallet because of bug #14422

@darosior
Copy link
Member

darosior commented Jul 8, 2019

I'll give a look to make possible to upgrade encrypted wallets.

@darosior
Copy link
Member

darosior commented Jul 9, 2019

Ok, I've succesfully reproduced (using v0.11.1 to create the wallet, then v0.18, and encrypted it) and upgraded. 🎉

This was referenced Jul 9, 2019
@mattpopovich
Copy link

Can confirm having the same issues as @redblade7 on v0.18.0 and still on v0.18.1.
Same error: "Can't generate a change-address key. No keys in the internal keypool and can't generate any keys."
And can also not use the -upgradewallet flag due to bug #14422

Wallet created around v0.11.1 and encrypted some time after that, ~v0.15.0 or so.

Let me know if you need anything from me to help troubleshoot/reproduce.

@Delitants
Copy link

Still persists same problem.

@maflcko
Copy link
Member

maflcko commented Oct 11, 2019

Are there steps to reproduce?

I tried generating a wallet with 0.11.1, encrypting it with 0.18.1, and then calling getnewaddress and getrawchangeaddress. No issue on my side.

wget --no-clobber "https://bitcoincore.org/bin/bitcoin-core-0.11.1/bitcoin-0.11.1-linux64.tar.gz"
echo "1e2c16e1dca75112e20f2cfb1acbdc45eb6fd4c6b49919fd64b45d960531abe2  bitcoin-0.11.1-linux64.tar.gz" | sha256sum -c
tar -xvf "bitcoin-0.11.1-linux64.tar.gz"
mkdir -p $(pwd)/testnet_datadir/
echo "Running bitcoind. Hit CTRL+C after the wallet has been generated."
bitcoin-0.11.1/bin/bitcoind -testnet -noconnect -nolisten -datadir=$(pwd)/testnet_datadir/ -rpcuser=u -rpcpassword=p -keypool=10
wget --no-clobber "https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz"
echo "600d1db5e751fa85903e935a01a74f5cc57e1e7473c15fd3e17ed21e202cfe5a  bitcoin-0.18.1-x86_64-linux-gnu.tar.gz" | sha256sum -c
tar -xvf "bitcoin-0.18.1-x86_64-linux-gnu.tar.gz"
echo "Running bitcoind."
echo "run 'bitcoin-0.18.1/bin/bitcoin-cli -testnet -rpcuser=u -rpcpassword=p encryptwallet p1' in and then hit CTRL+C after the wallet has been encrypted."
bitcoin-0.18.1/bin/bitcoind -testnet -noconnect -nolisten -datadir=$(pwd)/testnet_datadir/ -rpcuser=u -rpcpassword=p -keypool=10

@bitcoal
Copy link

bitcoal commented Dec 30, 2019

Experiencing same issue in v0.19.0.1

@p3yot3
Copy link

p3yot3 commented Feb 3, 2020

Experiencing same issue in v0.19.0.1

Same here. Been waiting patiently for a fix for this issue for weeks now - is there any movement on this? What are my options? I'd really like to be able to use my wallet for it's intended purpose.

@darosior
Copy link
Member

darosior commented Feb 3, 2020

Experiencing same issue in v0.19.0.1

Same here. Been waiting patiently for a fix for this issue for weeks now

I've closed #16360 (which solved this) 6 months ago in favor of #15761, which unfortunately conflicted with other work from the same author.

is there any movement on this?

#15761 has been rebased lately so...

@p3yot3
Copy link

p3yot3 commented Feb 3, 2020

OK. What are my options as I need to access my BTC - a previous release maybe? If so, what version?

@p3yot3
Copy link

p3yot3 commented Feb 3, 2020

OK. What are my options as I need to access my BTC - a previous release maybe? If so, what version?

Anyone?

@darosior
Copy link
Member

darosior commented Feb 3, 2020

OK. What are my options as I need to access my BTC - a previous release maybe? If so, what version?

Anyone?

Helping with review maybe ?..

@p3yot3
Copy link

p3yot3 commented Feb 3, 2020

A review of what exactly?

After reading what @byt3farm said a few posts up I also downgraded to version v0.17.1 (64-bit) & am now able to use my wallet normally & send payments.

This issue was reported here on 26 May 2019 - that's 8 months ago. Since then there have been 3 releases & still the problem persists. I know you guys are busy, but that's pretty lame. How is a casual user supposed to know about this & how to fix it? Suddenly being unable to send payments from one's wallet for no apparent reason is enough to scare anyone, especially as there is no mention of this in the release notes of any of those 3 releases.

Something in the release notes along the lines of "You might suddenly be unable to send coins from your own wallet for no reason if you upgrade to any version above 17.1 - this is a long known about issue" would be appropriate - at least users would then be aware & decide if they want to be locked out of their own wallets - only to get asked for a "review" here when asking for help.

@darosior
Copy link
Member

darosior commented Feb 3, 2020

A review of what exactly?

The fix ... ie #15761

@darosior
Copy link
Member

darosior commented Feb 3, 2020

at least users would then be aware & decide if they want to be locked out of their own wallets - only to get asked for a "review" here.

I did not meant to be rude at all, that's just that ... We can't really know what will be merged or not (even less me, I'm just a casual contributor) : nobody decides. PRs get merged if they are reviewed. PRs are reviewed if there are people interesting in doing it (i.e. excited about the improvement, or because they have a stake in it !). Hence my answer.

Now to be more precise, you could just test the PR and leave a comment saying you did so : that way achow101 would be aware that it's worth the rebases / fixes !

@p3yot3
Copy link

p3yot3 commented Feb 3, 2020

I'm a casual user, like most people, not a coder. I found this by googling the problem, because I'd never seen or had this problem before. I do read the release notes before deciding weather to upgrade or not though & as there's no mention of this in any of the release notes I presumed it would be safe to upgrade, wrongfully it seems.
Please ask whoever is capable of doing so to include this problem in the release notes - it would save everyone a lot of wasted time & stress.

@adamjonas
Copy link
Member

closed by #15761

@maflcko
Copy link
Member

maflcko commented Apr 24, 2020

Thanks @adamjonas

@maflcko maflcko closed this as completed Apr 24, 2020
@mattpopovich
Copy link

mattpopovich commented Jul 26, 2020

Can confirm having the same issues as @redblade7 on v0.18.0 and still on v0.18.1.
Same error: "Can't generate a change-address key. No keys in the internal keypool and can't generate any keys."
And can also not use the -upgradewallet flag due to bug #14422

Wallet created around v0.11.1 and encrypted some time after that, ~v0.15.0 or so.

Let me know if you need anything from me to help troubleshoot/reproduce.

Reaffirming @adamjonas' comment as #15761 has fixed this issue for my wallet.

@MatthewLM
Copy link

MatthewLM commented Jul 31, 2020

#15761 would have been nice provided in a 0.20.1 release since the inability to use old encrypted wallets is a pretty major bug. I'm not sure if I should temporarily use 0.17.1, or build the master branch to upgrade the wallet. I don't feel particularly comfortable using pre-release code for mainnet wallets.

Edit: I did decide to build from master for the purpose of upgrading the wallet only. This went fine though I did have to deplete the keypool by running getnewaddress some 800 times (I did this using a bash for loop) before bech32 addresses would be generated.

Hopefully in the future more attention will be made towards any wallet upgrades so that they go more smoothly as non-technically minded users wouldn't be able to resolve this as easily.

@ADCJustinH
Copy link

Hopefully in the future more attention will be made towards any wallet upgrades so that they go more smoothly as non-technically minded users wouldn't be able to resolve this as easily.

Really wish this was prioritized. I have a wallet from 2010 that I just recovered and I really don't want to be building core myself just to upgrade. More and more people willing be digging up old wallets as the price climbs and not all of us 'early adopters' went into software development...

@achow101
Copy link
Member

Really wish this was prioritized. I have a wallet from 2010 that I just recovered and I really don't want to be building core myself just to upgrade. More and more people willing be digging up old wallets as the price climbs and not all of us 'early adopters' went into software development...

The PR in question has already been merged and will be in the next major release which should be in ~1 month.

@p3yot3
Copy link

p3yot3 commented Nov 13, 2020

Can we not have a hotfix release before then? I & others would really like to access our funds & use our wallets before then.

@achow101
Copy link
Member

Can we not have a hotfix release before then? I & others would really like to access our funds & use our wallets before then.

At this point in time, a hotfix release would not be much faster than the 0.21 release itself. We are already in the release process for 0.21 itself and this process usually takes ~1 month for the final release. However there will be release candidates published before the final release. The first release candidate should be soon and will contain the fix.

Additionally, #15761 itself has a few bugs and issues that are being addressed by #18836. This will be merged prior to 0.21 and any release candidates.

@daveblack1
Copy link

daveblack1 commented Nov 29, 2020

Also experiencing this bug with a 2011 wallet that was not upgraded to HD, but was encrypted. Using v17.1 allowed me to send again, however the transaction is stuck. I transferred alot of trapped Bitcoin into this wallet...

@maflcko
Copy link
Member

maflcko commented Dec 1, 2020

fyi, 0.21 rc2 is available for testing: https://lists.linuxfoundation.org/pipermail/bitcoin-core-dev/2020-November/000094.html

Please use caution when testing a release that is not final.

@p3yot3
Copy link

p3yot3 commented Dec 1, 2020

fyi, 0.21 rc2 is available for testing: https://lists.linuxfoundation.org/pipermail/bitcoin-core-dev/2020-November/000094.html

Please use caution when testing a release that is not final.

Did anyone try this yet? I'm afraid I don't have the bottle - too much BTC to lose if it goes south & I'd hate to be in the same position as @daveblack1

@p3yot3
Copy link

p3yot3 commented Jan 6, 2021

Should I presume that nobody tried it - or no, it doesn't work?

@ADCJustinH
Copy link

I didn't want to be the first :)

@p3yot3
Copy link

p3yot3 commented Jan 7, 2021

This issue should be opened again until it has been confirmed that the problem is fixed.

@MatthewLM
Copy link

@p3yot3 I successfully upgraded the wallet from the pre-release master branch and I've had no problems since. I'd be highly surprised if the RC doesn't work. I upgraded the wallet and then went straight back to using 0.20. I made sure to backup the wallet first of-course. If upgrading take note of my previous comment:

I did have to deplete the keypool by running getnewaddress some 800 times (I did this using a bash for loop) before bech32 addresses would be generated.

Hopefully 0.21 will be released soon, so it might be best to simply wait unless access is urgent.

@p3yot3
Copy link

p3yot3 commented Jan 8, 2021

Fixed in RC5 & with the god-like help from @achow101

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests