<p>Though it is named <code>scriptPubKey</code>, it is a script which often does not contain a pubkey, nor even if it did, just a pubkey.</p>
<p>The PSBT does not contain a pubkey because Bitcoin Core does not know enough about the script in order to know what pubkey to place into it.</p>
<p>The script appears to be nonstandard and does not appear to be Miniscript either, so Bitcoin Core has no idea how to sign for it. As it does not know how to sign for it, it cannot figure out what other components are necessary, such as which public keys. Hence it does not insert any pubkeys or any other data into the PSBT.</p>

CC BY-SA 4.0
2024-06-30T20:39:38.900Z
2024-06-30T20:39:38.900Z
Ava Chow
<p>I have created a PSBT to sign an HTLC using a funded P2WSH, that I wish to sign with my xverse wallet. This is my decoded PSBT which I have created using <code>bitcoin-cli</code></p>
<pre><code>o@OscarPC:~/bitcoin-htlc$ bitcoin-cli -testnet decodepsbt cHNidP8BAF4CAAAAAbPL7V1jyb+3R1UCjZ59ivvArJkc/+7bfxvA0QDjwJy+AAAAAAD+////AQAAAAAAAAAAIlEgmI+kZEmjRbl0oD6FTqJ7RKSipe+ZpSLIz0whDVrEu+MAAAAAAAEBK+gDAAAAAAAAIgAgpgjnxrbDIB0mCTFhbICxZdnAIvuWCkOZt5f+fZV3HMoBBVljqCBlLH3Gh9mMmIkwTtLkCMdLYR6GpAyqUcS0Px3VkTxc0Ih2qRTjmQVsTKY1caykT8LRGz/axpo34GcAsXV2qRTjmQVsTKY1caykT8LRGz/axpo34GiIrAAA
{
  &quot;tx&quot;: {
    &quot;txid&quot;: &quot;a1eaefe490f5d3be11fbd6a5afeffcff20a9e92cfde3363484168c9f5769c57a&quot;,
    &quot;hash&quot;: &quot;a1eaefe490f5d3be11fbd6a5afeffcff20a9e92cfde3363484168c9f5769c57a&quot;,
    &quot;version&quot;: 2,
    &quot;size&quot;: 94,
    &quot;vsize&quot;: 94,
    &quot;weight&quot;: 376,
    &quot;locktime&quot;: 0,
    &quot;vin&quot;: [
      {
        &quot;txid&quot;: &quot;be9cc0e300d1c01b7fdbeeff1c99acc0fb8a7d9e8d025547b7bfc9635dedcbb3&quot;,
        &quot;vout&quot;: 0,
        &quot;scriptSig&quot;: {
          &quot;asm&quot;: &quot;&quot;,
          &quot;hex&quot;: &quot;&quot;
        },
        &quot;sequence&quot;: 4294967294
      }
    ],
    &quot;vout&quot;: [
      {
        &quot;value&quot;: 0.00000000,
        &quot;n&quot;: 0,
        &quot;scriptPubKey&quot;: {
          &quot;asm&quot;: &quot;1 988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3&quot;,
          &quot;desc&quot;: &quot;rawtr(988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3)#4xpnet5r&quot;,
          &quot;hex&quot;: &quot;5120988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3&quot;,
          &quot;address&quot;: &quot;tb1pnz86gezf5dzmja9q86z5agnmgjj29f00nxjj9jx0fsss6kkyh03sjkqhpd&quot;,
          &quot;type&quot;: &quot;witness_v1_taproot&quot;
        }
      }
    ]
  },
  &quot;global_xpubs&quot;: [
  ],
  &quot;psbt_version&quot;: 0,
  &quot;proprietary&quot;: [
  ],
  &quot;unknown&quot;: {
  },
  &quot;inputs&quot;: [
    {
      &quot;witness_utxo&quot;: {
        &quot;amount&quot;: 0.00001000,
        &quot;scriptPubKey&quot;: {
          &quot;asm&quot;: &quot;0 a608e7c6b6c3201d260931616c80b165d9c022fb960a4399b797fe7d95771cca&quot;,
          &quot;desc&quot;: &quot;addr(tb1q5cyw034kcvsp6fsfx9skeq93vhvuqghmjc9y8xdhjll8m9thrn9q5mv0nr)#wjcfmgw8&quot;,
          &quot;hex&quot;: &quot;0020a608e7c6b6c3201d260931616c80b165d9c022fb960a4399b797fe7d95771cca&quot;,
          &quot;address&quot;: &quot;tb1q5cyw034kcvsp6fsfx9skeq93vhvuqghmjc9y8xdhjll8m9thrn9q5mv0nr&quot;,
          &quot;type&quot;: &quot;witness_v0_scripthash&quot;
        }
      },
      &quot;witness_script&quot;: {
        &quot;asm&quot;: &quot;OP_IF OP_SHA256 652c7dc687d98c9889304ed2e408c74b611e86a40caa51c4b43f1dd5913c5cd0 OP_EQUALVERIFY OP_DUP OP_HASH160 e399056c4ca63571aca44fc2d11b3fdac69a37e0 OP_ELSE 0 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 e399056c4ca63571aca44fc2d11b3fdac69a37e0 OP_ENDIF OP_EQUALVERIFY OP_CHECKSIG&quot;,
        &quot;hex&quot;: &quot;63a820652c7dc687d98c9889304ed2e408c74b611e86a40caa51c4b43f1dd5913c5cd08876a914e399056c4ca63571aca44fc2d11b3fdac69a37e06700b17576a914e399056c4ca63571aca44fc2d11b3fdac69a37e06888ac&quot;,
        &quot;type&quot;: &quot;nonstandard&quot;
      }
    }
  ],
  &quot;outputs&quot;: [
    {
    }
  ],
  &quot;fee&quot;: 0.00001000
}
</code></pre>
<p>It is my intention to follow this sats-connect example from the <a href="https://docs.xverse.app/sats-connect/bitcoin-methods/signpsbt" rel="nofollow noreferrer">official sats connect docs</a> to do the signing using my xverse wallet:</p>
<pre><code>import {
  BitcoinNetworkType,
  RpcErrorCode,
  request,
} from &quot;sats-connect&quot;;
    
const signPsbtOptions = {
    payload: {
      network: {
        type: 'Testnet
      },
      psbtBase64: `cHNidP8BAF4CAAAAAbPL7V1jyb+3R1UCjZ59ivvArJkc/+7bfxvA0QDjwJy+AAAAAAD+////AQAAAAAAAAAAIlEgmI+kZEmjRbl0oD6FTqJ7RKSipe+ZpSLIz0whDVrEu+MAAAAAAAEBK+gDAAAAAAAAIgAgpgjnxrbDIB0mCTFhbICxZdnAIvuWCkOZt5f+fZV3HMoBBVljqCBlLH3Gh9mMmIkwTtLkCMdLYR6GpAyqUcS0Px3VkTxc0Ih2qRTjmQVsTKY1caykT8LRGz/axpo34GcAsXV2qRTjmQVsTKY1caykT8LRGz/axpo34GiIrAAA`,
      allowedSignHash: btc.SignatureHash.SINGLE | btc.SignatureHash.DEFAULT_ANYONECANPAY,
      broadcast: false, 
      inputsToSign: [
          {
              address: &quot;tb1pnz86gezf5dzmja9q86z5agnmgjj29f00nxjj9jx0fsss6kkyh03sjkqhpd&quot;,
              signingIndexes: [0]
          }
      ],
    },
    onFinish: (response) =&gt; {
      console.log('Signed PSBT:', response.psbtBase64);
    },
    onCancel: () =&gt; alert('Signing canceled'),
  };

  try {
    await signTransaction(signPsbtOptions);
  } catch (error) {
    console.error('Error signing PSBT:', error);
  }
</code></pre>
<p>However, whenever I try to sign the PSBT using my xverse wallet from the browser, it throws an error:</p>
<pre><code>Input script doesn't have pubKey: 99,168,32,101,44,125,198,135,217,140,152,137,48,78,210,228,8,199,75,97,30,134,164,12,170,81,196,180,63,29,213,145,60,92,208,136,118,169,20,227,153,5,108,76,166,53,113,172,164,79,194,209,27,63,218,198,154,55,224,103,0,177,117,118,169,20,227,153,5,108,76,166,53,113,172,164,79,194,209,27,63,218,198,154,55,224,104,136,172
</code></pre>
<p><a href="https://i.sstatic.net/hCBTJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hCBTJ.png" alt="enter image description here" /></a></p>
<p><strong>This brings me to my question</strong></p>
<p>Why does my PSBT input script not have a pub key? In the inputs section of the decoded psbt, there is a scriptPubKey section inside the input field.</p>

<script><bip174-psbt><hash-time-locked-contract><p2wsh><sats-connect>
Why does my PSBT's input script not have a pub key?
Dev Oskii
# Why does my PSBT's input script not have a pub key?

(Asked by: username_0 on 2024-04-14)

I have created a PSBT to sign an HTLC using a funded P2WSH, that I wish to sign with my xverse wallet. This is my decoded PSBT which I have created using `bitcoin-cli`

```
o@OscarPC:~/bitcoin-htlc$ bitcoin-cli -testnet decodepsbt cHNidP8BAF4CAAAAAbPL7V1jyb+3R1UCjZ59ivvArJkc/+7bfxvA0QDjwJy+AAAAAAD+////AQAAAAAAAAAAIlEgmI+kZEmjRbl0oD6FTqJ7RKSipe+ZpSLIz0whDVrEu+MAAAAAAAEBK+gDAAAAAAAAIgAgpgjnxrbDIB0mCTFhbICxZdnAIvuWCkOZt5f+fZV3HMoBBVljqCBlLH3Gh9mMmIkwTtLkCMdLYR6GpAyqUcS0Px3VkTxc0Ih2qRTjmQVsTKY1caykT8LRGz/axpo34GcAsXV2qRTjmQVsTKY1caykT8LRGz/axpo34GiIrAAA
{
  "tx": {
    "txid": "a1eaefe490f5d3be11fbd6a5afeffcff20a9e92cfde3363484168c9f5769c57a",
    "hash": "a1eaefe490f5d3be11fbd6a5afeffcff20a9e92cfde3363484168c9f5769c57a",
    "version": 2,
    "size": 94,
    "vsize": 94,
    "weight": 376,
    "locktime": 0,
    "vin": [
      {
        "txid": "be9cc0e300d1c01b7fdbeeff1c99acc0fb8a7d9e8d025547b7bfc9635dedcbb3",
        "vout": 0,
        "scriptSig": {
          "asm": "",
          "hex": ""
        },
        "sequence": 4294967294
      }
    ],
    "vout": [
      {
        "value": 0.00000000,
        "n": 0,
        "scriptPubKey": {
          "asm": "1 988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3",
          "desc": "rawtr(988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3)#4xpnet5r",
          "hex": "5120988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3",
          "address": "tb1pnz86gezf5dzmja9q86z5agnmgjj29f00nxjj9jx0fsss6kkyh03sjkqhpd",
          "type": "witness_v1_taproot"
        }
      }
    ]
  },
  "global_xpubs": [
  ],
  "psbt_version": 0,
  "proprietary": [
  ],
  "unknown": {
  },
  "inputs": [
    {
      "witness_utxo": {
        "amount": 0.00001000,
        "scriptPubKey": {
          "asm": "0 a608e7c6b6c3201d260931616c80b165d9c022fb960a4399b797fe7d95771cca",
          "desc": "addr(tb1q5cyw034kcvsp6fsfx9skeq93vhvuqghmjc9y8xdhjll8m9thrn9q5mv0nr)#wjcfmgw8",
          "hex": "0020a608e7c6b6c3201d260931616c80b165d9c022fb960a4399b797fe7d95771cca",
          "address": "tb1q5cyw034kcvsp6fsfx9skeq93vhvuqghmjc9y8xdhjll8m9thrn9q5mv0nr",
          "type": "witness_v0_scripthash"
        }
      },
      "witness_script": {
        "asm": "OP_IF OP_SHA256 652c7dc687d98c9889304ed2e408c74b611e86a40caa51c4b43f1dd5913c5cd0 OP_EQUALVERIFY OP_DUP OP_HASH160 e399056c4ca63571aca44fc2d11b3fdac69a37e0 OP_ELSE 0 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 e399056c4ca63571aca44fc2d11b3fdac69a37e0 OP_ENDIF OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "63a820652c7dc687d98c9889304ed2e408c74b611e86a40caa51c4b43f1dd5913c5cd08876a914e399056c4ca63571aca44fc2d11b3fdac69a37e06700b17576a914e399056c4ca63571aca44fc2d11b3fdac69a37e06888ac",
        "type": "nonstandard"
      }
    }
  ],
  "outputs": [
    {
    }
  ],
  "fee": 0.00001000
}

```

It is my intention to follow this sats-connect example from the [official sats connect docs](https://docs.xverse.app/sats-connect/bitcoin-methods/signpsbt) to do the signing using my xverse wallet:

```
import {
  BitcoinNetworkType,
  RpcErrorCode,
  request,
} from "sats-connect";
    
const signPsbtOptions = {
    payload: {
      network: {
        type: 'Testnet
      },
      psbtBase64: `cHNidP8BAF4CAAAAAbPL7V1jyb+3R1UCjZ59ivvArJkc/+7bfxvA0QDjwJy+AAAAAAD+////AQAAAAAAAAAAIlEgmI+kZEmjRbl0oD6FTqJ7RKSipe+ZpSLIz0whDVrEu+MAAAAAAAEBK+gDAAAAAAAAIgAgpgjnxrbDIB0mCTFhbICxZdnAIvuWCkOZt5f+fZV3HMoBBVljqCBlLH3Gh9mMmIkwTtLkCMdLYR6GpAyqUcS0Px3VkTxc0Ih2qRTjmQVsTKY1caykT8LRGz/axpo34GcAsXV2qRTjmQVsTKY1caykT8LRGz/axpo34GiIrAAA`,
      allowedSignHash: btc.SignatureHash.SINGLE | btc.SignatureHash.DEFAULT_ANYONECANPAY,
      broadcast: false, 
      inputsToSign: [
          {
              address: "tb1pnz86gezf5dzmja9q86z5agnmgjj29f00nxjj9jx0fsss6kkyh03sjkqhpd",
              signingIndexes: [0]
          }
      ],
    },
    onFinish: (response) => {
      console.log('Signed PSBT:', response.psbtBase64);
    },
    onCancel: () => alert('Signing canceled'),
  };

  try {
    await signTransaction(signPsbtOptions);
  } catch (error) {
    console.error('Error signing PSBT:', error);
  }

```

However, whenever I try to sign the PSBT using my xverse wallet from the browser, it throws an error:

```
Input script doesn't have pubKey: 99,168,32,101,44,125,198,135,217,140,152,137,48,78,210,228,8,199,75,97,30,134,164,12,170,81,196,180,63,29,213,145,60,92,208,136,118,169,20,227,153,5,108,76,166,53,113,172,164,79,194,209,27,63,218,198,154,55,224,103,0,177,117,118,169,20,227,153,5,108,76,166,53,113,172,164,79,194,209,27,63,218,198,154,55,224,104,136,172

```

[![enter image description here](https://i.sstatic.net/hCBTJ.png)](https://i.sstatic.net/hCBTJ.png)

**This brings me to my question**

Why does my PSBT input script not have a pub key? In the inputs section of the decoded psbt, there is a scriptPubKey section inside the input field.

**Tags:** script, bip174-psbt, hash-time-locked-contract, p2wsh, sats-connect


---

## 1 answers

### Answer by username_1 on 2024-06-30. Score: 1

Though it is named `scriptPubKey`, it is a script which often does not contain a pubkey, nor even if it did, just a pubkey.

The PSBT does not contain a pubkey because Bitcoin Core does not know enough about the script in order to know what pubkey to place into it.

The script appears to be nonstandard and does not appear to be Miniscript either, so Bitcoin Core has no idea how to sign for it. As it does not know how to sign for it, it cannot figure out what other components are necessary, such as which public keys. Hence it does not insert any pubkeys or any other data into the PSBT.


---

