<p>The only difference appears to be the signature. BIP 340 recommends a particular deterministic nonce generation method, which should result in identical signatures even when signing multiple times with different software. That the signatures are different, coupled with the fact that <code>analyzepsbt</code> fails to consider the input finalizeable, suggests that you are signature is actually invalid.</p>

CC BY-SA 4.0
2024-11-26T05:51:47.213Z
Yes indeed, before I understand it. The problem is most likely in the generated SigHash, but I don't understand why it's calculated incorrectly specifically for PSBT partial signatures. I've made it more readable via GPT, but the it works the same.

https://justpaste.it/26pa0 - Full logs and output. Same Just code + PSBT output https://justpaste.it/i3o75. I also tried SigHashDefault/All (required 0, i.e. default) but nothing changed. Both PSBTs (good/bad) are without extra sig byte
AlexDJfs
CC BY-SA 4.0
2024-11-26T00:19:03.480Z
2024-11-26T00:19:03.480Z
Ava Chow
<p>I wrote the code to partially sign the PSBT. Briefly the server sends me a PSBT in Base64 format and N inputs to be signed. I encode the PSBT, sign the inputs with PK using Schnorr method. I update it back to Base64 and send it to the server (not finalised PSBT with unsigned input 0).</p>
<p>This is how it should look like after processing (correct):</p>
<pre><code>{
    { ‘result’: {
        { ‘inputs’: [
            {
                ‘has_utxo&quot;: true,
                ‘is_final&quot;: false,
                { ‘next’: { ‘updater’.
            },
            {
                ‘has_utxo&quot;: true,
                ‘is_final&quot;: false,
                { ‘next’: ‘finalizer’.
            },
            {
                ‘has_utxo&quot;: true,
                ‘is_final&quot;: false,
                { ‘next’: ‘finalizer’.
            }
        ],
        ‘fee&quot;: 1.328e-5,
        ‘next&quot;: { ‘updater’
    },
    ‘error&quot;: null,
    ‘id&quot;: null
}
</code></pre>
<p>This is what it looks like after being processed by my script. The Updater status should change to finaliser for those inputs I signed, but it doesn't (incorrect) :</p>
<pre><code>{
    &quot;result&quot;: {
        &quot;inputs&quot;: [
            {
                &quot;has_utxo&quot;: true,
                &quot;is_final&quot;: false,
                &quot;next&quot;: &quot;updater&quot;
            },
            {
                &quot;has_utxo&quot;: true,
                &quot;is_final&quot;: false,
                &quot;next&quot;: &quot;updater&quot;
            }
        ],
        &quot;estimated_vsize&quot;: 286,
        &quot;estimated_feerate&quot;: 7.0e-5,
        &quot;fee&quot;: 2.002e-5,
        &quot;next&quot;: &quot;updater&quot;
    },
    &quot;error&quot;: null,
    &quot;id&quot;: null
}
</code></pre>
<p>I checked signatures (they are correct), compared correct partially signed PSBT and my own (no differences except txid, which will be unique every time), even tried to finalise PSBT (although it is absolutely not need), but I still couldn't understand why the status of inputs remains Updater, when it is sent with finilize when signed via any wallet extension.I don't even understand where the error could be, since I do the logs BEFORE signing and AFTER signing, and their status in the logs is updated. Also, if you take the PSBT after my code has processed it and decoded it, it does update and is no different from the correct one except for the TXid.</p>
<p>I'm a complete newbie at coding, sorry if I said anything wrong</p>
<hr />
<p>Wrong of my script:
Raw PSBT:</p>
<pre><code>cHNidP8BAPwCAAAAAh/wxKDynlU3u3GZmUsMr8s/YrxCkOke8gFoZSDWOzMzUgQAAAD/////Q9g6nnkQbdroR/sr2jeNqZ9nlZbVuqSNdjakxTxLgYADAAAAAP////8ETQEAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOmGDAAAAAAAAIlEgsxHYe7mlcSxOwOnapg4WHRT5UuB+vWF8uMz6Oxu5Bf9DAgAAAAAAABYAFAnkWBtaeW/v/BxPBmkgboAct6nr/EgAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgAAAAAI/AJtZQNzaWdAzthBrUOlwXU1Igu3tpbp4SU60sbkdNSiEk6T0dMJUe0FlR7ZHOel2E/atN8Tiak8IT9P4PLKVFv40AxeROVOuwv8Am1lBnNpZ2V4cAhCeTYl8MAAAAABAStNAQAAAAAAACJRIDCs9kAJfdTiQei7Cf+RSH3Cwr5oxFjNj27APixQD2L4ARcgc+G1jBTUGzdWX447VOZ6zEec2eeffMqg8KTrQ6plriIAAQErrtgAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgEXIK0XtHBW7oxyV677kvzIL56kaRx0i5AADj3yumRxQD17AAAAAAA=
</code></pre>
<p>After a partial signature Signed:</p>
<pre><code>cHNidP8BAPwCAAAAAh/wxKDynlU3u3GZmUsMr8s/YrxCkOke8gFoZSDWOzMzUgQAAAD/////Q9g6nnkQbdroR/sr2jeNqZ9nlZbVuqSNdjakxTxLgYADAAAAAP////8ETQEAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOmGDAAAAAAAAIlEgsxHYe7mlcSxOwOnapg4WHRT5UuB+vWF8uMz6Oxu5Bf9DAgAAAAAAABYAFAnkWBtaeW/v/BxPBmkgboAct6nr/EgAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgAAAAAI/AJtZQNzaWdAzthBrUOlwXU1Igu3tpbp4SU60sbkdNSiEk6T0dMJUe0FlR7ZHOel2E/atN8Tiak8IT9P4PLKVFv40AxeROVOuwv8Am1lBnNpZ2V4cAhCeTYl8MAAAAABAStNAQAAAAAAACJRIDCs9kAJfdTiQei7Cf+RSH3Cwr5oxFjNj27APixQD2L4ARcgc+G1jBTUGzdWX447VOZ6zEec2eeffMqg8KTrQ6plriIAAQErrtgAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgETQBvkTWkg2ZTZ+UZ/K7geb9GyQy4QiS7AGiP4OjhrxbzFHNhLKjTMpcmbOSAZtPFuepGYRmt4wVt3LNkCm5rxkEYBFyCtF7RwVu6Mcleu+5L8yC+epGkcdIuQAA498rpkcUA9ewAAAAAA
</code></pre>
<p>Correct:
Raw PSBT:</p>
<pre><code>cHNidP8BAPwCAAAAAnMHa2DPvDr8AAHdLWOhY7syXfPc50uzAbNF8zH2MzMzIgQAAAD/////GZHgrBYm51oXH2xnmP7B58ww7ASUjKguqKsl2IUt2SUBAAAAAP////8ETQEAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOmGDAAAAAAAAI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zdWX447VOZ6zEec2eeffMqg8KTrQ6plriIAAQEr6GMBAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgETQHvmy2yIG/Q/vgrA2GmZ40W/Ah7OT/ScTq2lTG7QxLJ6FjSgWf+rrkub+/PkZGp6FrIr7cXJQ+i+7lu+rkidy3oBFyCtF7RwVu6Mcleu+5L8yC+epGkcdIuQAA498rpkcUA9ewAAAAAA
</code></pre>

CC BY-SA 4.0
2024-11-25T02:39:50.450Z
Can you provide the PSBT before and after you have processed it?
Ava Chow
CC BY-SA 4.0
2024-11-25T08:14:21.140Z
https://justpaste.it/gpp9u  Not scam, just text share. Can't paste here because out of limit characters. There I specified Before/After (Raw/Partially signed) PSBTs and specified two cases: 1. This is what my script outputs. 2. Successful (which is received by the server successfully).


I'd like to point out that I don't sign input 0, because that's the PSBT I'm returning to the server. I also don't finalise inputs for the same reason. I swear I don't see any difference besides UNKNOWN and TXid fields which are unique every time a new signature is made. TBH I don't see the difference
AlexDJfs
CC BY-SA 4.0
2024-11-26T00:09:48.883Z
I have edited your question to include the PSBTs.
Ava Chow
<taproot><bip174-psbt><bip><input-script><p2tr>
Subscribe PSBT inputs via Golang
AlexDJfs
# Subscribe PSBT inputs via Golang

(Asked by: username_0 on 2024-11-24)

I wrote the code to partially sign the PSBT. Briefly the server sends me a PSBT in Base64 format and N inputs to be signed. I encode the PSBT, sign the inputs with PK using Schnorr method. I update it back to Base64 and send it to the server (not finalised PSBT with unsigned input 0).

This is how it should look like after processing (correct):

```
{
    { ‘result’: {
        { ‘inputs’: [
            {
                ‘has_utxo": true,
                ‘is_final": false,
                { ‘next’: { ‘updater’.
            },
            {
                ‘has_utxo": true,
                ‘is_final": false,
                { ‘next’: ‘finalizer’.
            },
            {
                ‘has_utxo": true,
                ‘is_final": false,
                { ‘next’: ‘finalizer’.
            }
        ],
        ‘fee": 1.328e-5,
        ‘next": { ‘updater’
    },
    ‘error": null,
    ‘id": null
}

```

This is what it looks like after being processed by my script. The Updater status should change to finaliser for those inputs I signed, but it doesn't (incorrect) :

```
{
    "result": {
        "inputs": [
            {
                "has_utxo": true,
                "is_final": false,
                "next": "updater"
            },
            {
                "has_utxo": true,
                "is_final": false,
                "next": "updater"
            }
        ],
        "estimated_vsize": 286,
        "estimated_feerate": 7.0e-5,
        "fee": 2.002e-5,
        "next": "updater"
    },
    "error": null,
    "id": null
}

```

I checked signatures (they are correct), compared correct partially signed PSBT and my own (no differences except txid, which will be unique every time), even tried to finalise PSBT (although it is absolutely not need), but I still couldn't understand why the status of inputs remains Updater, when it is sent with finilize when signed via any wallet extension.I don't even understand where the error could be, since I do the logs BEFORE signing and AFTER signing, and their status in the logs is updated. Also, if you take the PSBT after my code has processed it and decoded it, it does update and is no different from the correct one except for the TXid.

I'm a complete newbie at coding, sorry if I said anything wrong

---

Wrong of my script:
Raw PSBT:

```
cHNidP8BAPwCAAAAAh/wxKDynlU3u3GZmUsMr8s/YrxCkOke8gFoZSDWOzMzUgQAAAD/////Q9g6nnkQbdroR/sr2jeNqZ9nlZbVuqSNdjakxTxLgYADAAAAAP////8ETQEAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOmGDAAAAAAAAIlEgsxHYe7mlcSxOwOnapg4WHRT5UuB+vWF8uMz6Oxu5Bf9DAgAAAAAAABYAFAnkWBtaeW/v/BxPBmkgboAct6nr/EgAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgAAAAAI/AJtZQNzaWdAzthBrUOlwXU1Igu3tpbp4SU60sbkdNSiEk6T0dMJUe0FlR7ZHOel2E/atN8Tiak8IT9P4PLKVFv40AxeROVOuwv8Am1lBnNpZ2V4cAhCeTYl8MAAAAABAStNAQAAAAAAACJRIDCs9kAJfdTiQei7Cf+RSH3Cwr5oxFjNj27APixQD2L4ARcgc+G1jBTUGzdWX447VOZ6zEec2eeffMqg8KTrQ6plriIAAQErrtgAAAAAAAAiU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QD2L4ARcgc+G1jBTUGzdWX447VOZ6zEec2eeffMqg8KTrQ6plriIAAQEr6GMBAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgETQHvmy2yIG/Q/vgrA2GmZ40W/Ah7OT/ScTq2lTG7QxLJ6FjSgWf+rrkub+/PkZGp6FrIr7cXJQ+i+7lu+rkidy3oBFyCtF7RwVu6Mcleu+5L8yC+epGkcdIuQAA498rpkcUA9ewAAAAAA

```

**Tags:** taproot, bip174-psbt, bip, input-script, p2tr

> **Comments:**
> **username_1**: Can you provide the PSBT before and after you have processed it?  
> **username_0**: https://justpaste.it/gpp9u  Not scam, just text share. Can't paste here because out of limit characters. There I specified Before/After (Raw/Partially signed) PSBTs and specified two cases: 1. This is what my script outputs. 2. Successful (which is received by the server successfully).   I'd like to point out that I don't sign input 0, because that's the PSBT I'm returning to the server. I also don't finalise inputs for the same reason. I swear I don't see any difference besides UNKNOWN and TXid fields which are unique every time a new signature is made. TBH I don't see the difference  
> **username_1**: I have edited your question to include the PSBTs.  

---

## 1 answers

### Answer by username_1 on 2024-11-26. Score: 0

The only difference appears to be the signature. BIP 340 recommends a particular deterministic nonce generation method, which should result in identical signatures even when signing multiple times with different software. That the signatures are different, coupled with the fact that `analyzepsbt` fails to consider the input finalizeable, suggests that you are signature is actually invalid.

> **Comments:**
> **username_0**: Yes indeed, before I understand it. The problem is most likely in the generated SigHash, but I don't understand why it's calculated incorrectly specifically for PSBT partial signatures. I've made it more readable via GPT, but the it works the same.  https://justpaste.it/26pa0 - Full logs and output. Same Just code + PSBT output https://justpaste.it/i3o75. I also tried SigHashDefault/All (required 0, i.e. default) but nothing changed. Both PSBTs (good/bad) are without extra sig byte  

---

