Post
Topic
Board Bitcoin Technical Support
Merits 2 from 1 user
Re: Is ChatGPT's answer correct? (Question about P2WPKH)
by
nc50lc
on 23/12/2024, 05:06:40 UTC
⭐ Merited by philipma1957 (2)
Quote from: ChatGPT
In Bitcoin, when you're working with P2WPKH (Pay-to-Witness-PubKey-Hash) transactions, the signature is embedded into the scriptWitness (for SegWit transactions) rather than in the traditional `scriptSig` field used in legacy transactions. This is key to understanding why you only see a `final_scriptwitness` field instead of an explicit signature in the signed PSBT file. -snip-
That is actually good and direct answer. (probably because "PSBT" is relatively new)
The key concepts can be nitpicked or expanded here and there but the general explanation is on point.

For actual example, here's the mentioned part of a testnet4 transaction's PSBT:
(transaction: 3a59bb3faabe232f62d8a67d60b5930e876ac26186565e7099c0b65b9bcff66a)
Code:
,
                "final_scriptwitness": [
                    "304402201616c3090b25b40a1972fc1af2100fac806c6671a6c0f2c3d70760dc0bddda3c02203ae0cb30476e5c9ecfe022cedc645fb7e82fcd4dc966935eb5dd9016af0311c501",
                    "029c9d450af9db59bdb3646bdd1a5faf9ed10a5d319d9fe0f479a889b51aa46b54"
                ]

Input part of "getrawtransaction true" result:
(as you can see, there's no scrptSig)
Code:
"vin": [
        {
            "txid": "19271fea772888b5628a21971079c1cdfb4f619a83658f180dd0af5ebb97f740",
            "vout": 1,
            "scriptSig": {
                "asm": "",
                "hex": ""
            },
            "txinwitness": [
                "304402201616c3090b25b40a1972fc1af2100fac806c6671a6c0f2c3d70760dc0bddda3c02203ae0cb30476e5c9ecfe022cedc645fb7e82fcd4dc966935eb5dd9016af0311c501",
                "029c9d450af9db59bdb3646bdd1a5faf9ed10a5d319d9fe0f479a889b51aa46b54"
            ],
            "sequence": 4294967293
        }
    ]