Saturday, April 26, 2025
HomeBitcointaproot - Subscribe PSBT inputs through Golang

taproot – Subscribe PSBT inputs through Golang

I wrote the code to partially signal the PSBT. Briefly the server sends me a PSBT in Base64 format and N inputs to be signed. I encode the PSBT, signal the inputs with PK utilizing Schnorr technique. I replace it again to Base64 and ship it to the server (not finalised PSBT with unsigned enter 0).

That is the way it ought to appear to be after processing (right):

{
    { ‘end 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’.
            }
        ],
        ‘price": 1.328e-5,
        ‘subsequent": { ‘updater’
    },
    ‘error": null,
    ‘id": null
}

That is what it appears like after being processed by my script. The Updater standing ought to change to finaliser for these inputs I signed, however it does not (incorrect) :

{
    "end 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,
        "price": 2.002e-5,
        "subsequent": "updater"
    },
    "error": null,
    "id": null
}

I checked signatures (they’re right), in contrast right partially signed PSBT and my very own (no variations besides txid, which might be distinctive each time), even tried to finalise PSBT (though it’s completely not want), however I nonetheless could not perceive why the standing of inputs stays Updater, when it’s despatched with finilize when signed through any pockets extension.I do not even perceive the place the error might be, since I do the logs BEFORE signing and AFTER signing, and their standing within the logs is up to date. Additionally, in case you take the PSBT after my code has processed it and decoded it, it does replace and is not any completely different from the right one apart from the TXid.

I am an entire beginner at coding, sorry if I stated something mistaken


Unsuitable of my script:
Uncooked PSBT:

cHNidP8BAPwCAAAAAh/wxKDynlU3u3GZmUsMr8s/YrxCkOke8gFoZSDWOzMzUgQAAAD/////Q9g6nnkQbdroR/sr2jeNqZ9nlZbVuqSNdjakxTxLgYADAAAAAP////8ETQEA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/////GZHgrBYm51oXH2xnmP7B58ww7ASUjKguqKsl2IUt2SUBAAAAAP////8ETQEAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOmGDAAAAAAAAIlEgsxHYe7mlcSxOwOnapg4WHRT5UuB+vWF8uMz6Oxu5Bf9DAgAAAAAAABYAFAnkWBtaeW/v/BxPBmkgboAct6nrrtgAAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgAAAAAI/AJtZQNzaWdAftmCmUuo19ugM6sLcugvp5gSVViC1jqht25Z7TRUKU1d/Vt71BYtDObkQiDuQLoh6Eh1E96kTNglLr2uxsw+MAv8Am1lBnNpZ2V4cAhCeTYd8ReQAAABAStNAQAAAAAAACJRIDCs9kAJfdTiQei7Cf+RSH3Cwr5oxFjNj27APixQD2L4ARcgc+G1jBTUGzdWX447VOZ6zEec2eeffMqg8KTrQ6plriIAAQEr6GMBAAAAAAAiUSCJwof7Xh35Js6aL/iDn8TPfRHPzAuFSuiewIWArB8uOgETQHvmy2yIG/Q/vgrA2GmZ40W/Ah7OT/ScTq2lTG7QxLJ6FjSgWf+rrkub+/PkZGp6FrIr7cXJQ+i+7lu+rkidy3oBFyCtF7RwVu6Mcleu+5L8yC+epGkcdIuQAA498rpkcUA9ewAAAAAA

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments