<p>I use Bitcoin Core for offline signing. I created a legacy watch-only wallet, imported a public key using <code>importpubkey</code>, then called <code>rescanblockchain</code>, then generated a psbt transaction text(<em>psbt_tx_txt</em>), and finally successfully signed offline with my Bitcoin Core signing client.</p>
<p><strong>However</strong>, if I restart the Bitcoin Core watch-only client, and regenerate <em>psbt_tx_txt</em>, <strong>it will missing the public key</strong>: analyzing <em>psbt_tx_txt</em> with <code>analyzepsbt</code>, it prompts missing pubkey:</p>
<pre><code>{
  &quot;inputs&quot;: [
    {
      &quot;has_utxo&quot;: true,
      &quot;is_final&quot;: false,
      &quot;next&quot;: &quot;updater&quot;,
      &quot;missing&quot;: {
        &quot;pubkeys&quot;: [
          &quot;a_public_key_id&quot;
        ]
      }
    }
  ],
  &quot;fee&quot;: 0.00001100,
  &quot;next&quot;: &quot;updater&quot;
}
</code></pre>
<p>But when I query the address information with <code>getaddressinfo</code>, the public key is exactly included in it:</p>
<pre><code>{
  &quot;address&quot;: &quot;bc1......&quot;,
  &quot;scriptPubKey&quot;: &quot;......&quot;,
  &quot;ismine&quot;: false,
  &quot;solvable&quot;: true,
  &quot;desc&quot;: &quot;wpkh(......)#l8qyd3u4&quot;,
  &quot;iswatchonly&quot;: true,
  &quot;isscript&quot;: false,
  &quot;iswitness&quot;: true,
  &quot;witness_version&quot;: 0,
  &quot;witness_program&quot;: &quot;......&quot;,
  &quot;pubkey&quot;: &quot;a_PUBLIC_KEY&quot;,
  &quot;ischange&quot;: false,
  &quot;timestamp&quot;: 1,
  &quot;labels&quot;: [
    &quot;......&quot;
  ]
}
</code></pre>
<p>If I use the <em>psbt_tx_txt</em> to sign on the signing client, the bitcoin core client prompts: <strong>transaction is missing some information about inputs.</strong></p>
<hr />
<p><strong>After restarting Bitcoin Core, it doesn't seem to be able to find the previously imported public key.</strong></p>
<p>This means that every time I create an offline signed transaction, I need to create a new wallet, <code>importpubkey</code>,and <code>rescanblockchain</code>.</p>
<p>I think the public key should be able to be inserted into the <em>psbt_tx_txt</em>, next time I can JUST create the psbt, am I missing something?</p>
<hr />
<p>[update]</p>
<p>The issue can be reproduced by this:</p>
<p>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.</p>
<p>Import the public key of the address with the balance using <code>importpubkey</code> 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 <em>psbt-string-A</em>.</p>
<p>Restart bitcoin-qt, select the wallet you just created, and repeat the the same operation to create <em>psbt-string-B</em>.</p>
<p>Analyzing <em>psbt-string-A</em> and <em>psbt-string-B</em> with <code>analyzepsbt</code> in bitcoin-qt console, <em>psbt-string-A</em> is normal, <em>psbt-string-B</em> is missing public key.</p>

CC BY-SA 4.0
2023-08-25T15:00:44.837Z
After you had signed the psbt, did you broadcast the transaction? Are you giving your watch-only wallet exactly the same psbt?
Ava Chow
CC BY-SA 4.0
2023-08-26T01:40:49.250Z
@AndrewChow Yes, after signing the psbt, I broadcast the transaction. Yes, it was exactly the same psbt.
MonKong
CC BY-SA 4.0
2023-08-26T05:28:57.640Z
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?
Ava Chow
CC BY-SA 4.0
2023-08-26T09:17:17.347Z
@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
CC BY-SA 4.0
2023-08-26T16:54:18.290Z
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.
Ava Chow
CC BY-SA 4.0
2023-08-27T01:58:08.623Z
@AndrewChow I've updated the issue reproduction action at the bottom of the question, please check it out.
MonKong
<bitcoin-core><coldstorage><bip174-psbt><offline-transactions>
Bitcoin Core missing public key when generating PSBT transaction
MonKong
# Bitcoin Core missing public key when generating PSBT transaction

(Asked by: username_0 on 2023-08-25)

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.

**Tags:** bitcoin-core, coldstorage, bip174-psbt, offline-transactions

> **Comments:**
> **username_1**: After you had signed the psbt, did you broadcast the transaction? Are you giving your watch-only wallet exactly the same psbt?  
> **username_0**: @AndrewChow Yes, after signing the psbt, I broadcast the transaction. Yes, it was exactly the same psbt.  
> **username_1**: 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?  
> **username_0**: @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.  
> **username_1**: 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.  
> **username_0**: @AndrewChow I've updated the issue reproduction action at the bottom of the question, please check it out.  

---

## 0 answers

