5

I'm unable to create a segwit address in Bitcoin Core 15.0.1 64-bit Windows I have tried multiple times but keep getting the same error. The following is the output from the console

$ getnewaddress
1KxN5zBSMqCiMfaXpbgpbDipo3fdrWmWnF
$ addwitnessaddress 1KxN5zBSMqCiMfaXpbgpbDipo3fdrWmWnF
Public key or redeemscript not known to wallet, or the key is uncompressed (code -4)

I have also tried changing my encryption password but it did not help. I do not want to create a whole new wallet. What else can I do? Thanks

  • Can you post the output of the getwalletinfo command? The address likely corresponds to an uncompressed public key so it cannot be witnessified. – Andrew Chow Oct 21 '17 at 0:19
5

Your wallet is probably old enough that uncompressed public keys are used instead of compressed public keys. Segwit only works with compressed public keys so you cannot currently use segwit with your addresses.

However you can upgrade your wallet to using compressed keys. To do so, first start Bitcoin Core with the -upgradewallet option. That will upgrade your wallet to use compressed keys by default. Then you will need to call getnewaddress ~1000 times in order to get to addresses using compressed public keys keys. I don't believe that there is a way to regenerate the keypool without emptying it by requesting all of the addresses from the keypool.

  • Yes my wallet is from 2012. So the "getnewaddress" command will give me about 1000 receive address. Is there a way to delete some of my receive address? Thanks for you replay – Patrick Brusky Oct 21 '17 at 1:29
  • No, addresses cannot be deleted. – Andrew Chow Oct 21 '17 at 1:30
  • Seems like it would be best if I would backup my wallet.dat and delete form the from "C:\Users\user\AppData\Roaming\Bitcoin" folder and have it create a new one. The new then should be able to create segwit address. – Patrick Brusky Oct 21 '17 at 1:54
  • Yes. You can move all of your coins there by getting some addresses from the new wallet and sending your Bitcoin to those addresses from your old wallet. This also has the benefit of migrating your wallet to the HD wallet type where one backup can theoretically backup all of your private keys ever, although periodic backups are still recommended. – Andrew Chow Oct 21 '17 at 2:33

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.