Here's an example of a SegWit transaction that also contains data in the ScriptSig field:

  "txid": "954f43dbb30ad8024981c07d1f5eb6c9fd461e2cf1760dd1283f052af746fc88",
  "hash": "a5947589e2762107ff650958ba0e3a3cf341f53281d15593530bf9762c4edab1",
  "size": 231,
  "vsize": 148,
  "version": 1,
  "locktime": 0,
  "vin": [
      "txid": "56f87210814c8baef7068454e517a70da2f2103fc3ac7f687e32a228dc80e115",
      "vout": 4,
      "scriptSig": {
        "asm": "002001d5d92effa6ffba3efa379f9830d0f75618b13393827152d26e4309000e88b1",
        "hex": "22002001d5d92effa6ffba3efa379f9830d0f75618b13393827152d26e4309000e88b1"
      "txinwitness": [
      "sequence": 4294967295

If the txinwitness is the new location for the "unlocking script" section for a vin (as opposed to the old scriptSig field), then why would this transaction still have data in its scriptSig field?

  • I think its to store the hash of signature. I am not completely sure though.
    – abeikverdi
    Nov 1 '16 at 17:38

The reason is that for now, no native segwit address format exists, so transactions cannot be sent directly to segwit outputs. A proposal for native segwit addresses was created, but it won't be usable until all senders and receivers support it.

Instead, segwit-inside-P2SH is used, where outputs go to a BIP16 output with as hash script the hash of the witness program.

To spend such outputs, we must stay compatible with BIP16, and thus a scriptSig that reveals the full witness program is required. That is what you're seeing in this transaction: a BIP16 scriptSig, which reveals a witness program, which on its turn causes inspection of the witness data for the real verification.

  • Are there any proposals for a native P2WPKH address format? Will such transactions be valid when segwit activates in 0.13.1? Or does all segwit have to be contained in P2SH for now?
    – pinhead
    Nov 5 '16 at 23:19
  • There is no address format for native P2WPKH, but it is included in BIP141, so such outputs are fully consensus valid and standard, there is just no way to ask a sender to construct such an output yet. I'm working on a proposal, though. Nov 6 '16 at 0:20

segwit if a soft-fork, so it must be compatible with bip16. scriptSig contains a pushstack operation which hash is 2N5SJg3gxB8HNxjnj9ZyrLCTxKNrKGH5dHp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.