2

I use Bitcoin Core for offline signing. I created a legacy watch-only wallet, imported a public key using importpubkey, then called rescanblockchain, then generated a psbt transaction text(psbt_tx_txt), and finally successfully signed offline with my Bitcoin Core signing client.

However, if I restart the Bitcoin Core watch-only client, and regenerate psbt_tx_txt, it will missing the public key: analyzing psbt_tx_txt with analyzepsbt, it prompts missing pubkey:

{
  "inputs": [
    {
      "has_utxo": true,
      "is_final": false,
      "next": "updater",
      "missing": {
        "pubkeys": [
          "a_public_key_id"
        ]
      }
    }
  ],
  "fee": 0.00001100,
  "next": "updater"
}

But when I query the address information with getaddressinfo, the public key is exactly included in it:

{
  "address": "bc1......",
  "scriptPubKey": "......",
  "ismine": false,
  "solvable": true,
  "desc": "wpkh(......)#l8qyd3u4",
  "iswatchonly": true,
  "isscript": false,
  "iswitness": true,
  "witness_version": 0,
  "witness_program": "......",
  "pubkey": "a_PUBLIC_KEY",
  "ischange": false,
  "timestamp": 1,
  "labels": [
    "......"
  ]
}

If I use the psbt_tx_txt to sign on the signing client, the bitcoin core client prompts: transaction is missing some information about inputs.


After restarting Bitcoin Core, it doesn't seem to be able to find the previously imported public key.

This means that every time I create an offline signed transaction, I need to create a new wallet, importpubkey,and rescanblockchain.

I think the public key should be able to be inserted into the psbt_tx_txt, next time I can JUST create the psbt, am I missing something?


[update]

The issue can be reproduced by this:

Starting the bitcoin-qt GUI client and synchronizing the blocks. Create a blank ledgcy watch-only wallet and enable the coin control feature in the bitcoin-qt preferences settings.

Import the public key of the address with the balance using importpubkey in the bitcoin-qt console. Select the Send main menu, select an input in the inputs option, go back to the Send main menu and leave the change address empty. Fill in a receiving address, select the maximum amount(Use available balance), enable Subtract fee from amount, customize the transaction fee to a fixed value, disable Replace-By-Fee feature, click Create Unsigned button to create psbt-string-A.

Restart bitcoin-qt, select the wallet you just created, and repeat the the same operation to create psbt-string-B.

Analyzing psbt-string-A and psbt-string-B with analyzepsbt in bitcoin-qt console, psbt-string-A is normal, psbt-string-B is missing public key.

MonKong
  • 53
  • 3
  • After you had signed the psbt, did you broadcast the transaction? Are you giving your watch-only wallet exactly the same psbt? – Andrew Chow Aug 25 '23 at 15:00
  • @AndrewChow Yes, after signing the psbt, I broadcast the transaction. Yes, it was exactly the same psbt. – MonKong Aug 26 '23 at 01:40
  • To clarify, you used exactly the same psbt string? You did not redo all of the commands and assumed that the resulting psbt was the same? – Andrew Chow Aug 26 '23 at 05:28
  • @AndrewChow I created the same simple transaction in the bitcoin-qt GUI interface to generate the psbt string, I think it should be the same and I tried it several times. The point is that after each restart of Bitcoin Core, the previously imported public key is not inserted into the psbt string. For example, I imported the public key of address A, and after restarting Bitcoin Core and generating psbt transactions(address A transferring money to address B), there is no public key of address A in the psbt string. – MonKong Aug 26 '23 at 09:17
  • That's not the same transaction. It will have different inputs, and depending on how you set it up, could be sending coins to somewhere that your wallet isn't watching. Please describe exactly how you are making your transactions - i.e. what buttons you are clicking on and which fields you are filling in. A couple of important things to know are whether you are selecting inputs manually and what you're setting the change address to, if at all. The output of `getwalletinfo` will also be useful. – Andrew Chow Aug 26 '23 at 16:54
  • @AndrewChow I've updated the issue reproduction action at the bottom of the question, please check it out. – MonKong Aug 27 '23 at 01:58

0 Answers0