does P2WPKH decoderawtransaction tx always has different txid and hash? #12575

issue passionofvc opened this issue on March 1, 2018
  1. passionofvc commented at 12:00 PM on March 1, 2018: none

    I decode the raw tx, it show me different txid and hash In P2PKH tx, it always show me the same value between txid and hash. why it is different value between txid and hash when tx has segwit tx in it? and what is diffrence between txid and hash?

    bitcoind.exe --version
    Bitcoin Core Daemon version v0.16.0
    Copyright (C) 2009-2018 The Bitcoin Core developers
    
    

    "txid": "f1c01f5c91685380bf266852bc07eee623ccb774562b1cc531394573af0c9da6", "hash": "87432c4bad6eb0d8f1ee47d8dcbbebbcf4aeb23e61efe5b42517373ce988e3d7",

    decoderawtransaction  010000000001014e36e658e8a9d9c2b0706163a72b2c97a0e4a327f09f431699221f1489dc57c50000000000ffffffff020084d717000000001976a914789b5fae3229db03a2d172462a0675c7c2a318fb88ac1c6aeb0b00000000160014d7011e7ae8d80d54d0381b3e3c8374f63edb46450247304402206751719909ab5344cb9890d51e20c47148914014c930755c5232f66f8a56ed460220521190b717305ace29bf76c9026168fca8bbc9c52d876e760cd7ffe72f0058c80121038f8cede3b7d3bbe9371fbaa68be802f06b548b61d101119e40c4e873fda7541200000000
    {
      "txid": "f1c01f5c91685380bf266852bc07eee623ccb774562b1cc531394573af0c9da6",
      "hash": "87432c4bad6eb0d8f1ee47d8dcbbebbcf4aeb23e61efe5b42517373ce988e3d7",
      "version": 1,
      "size": 225,
      "vsize": 144,
      "locktime": 0,
      "vin": [
        {
          "txid": "c557dc89141f229916439ff027a3e4a0972c2ba7636170b0c2d9a9e858e6364e",
          "vout": 0,
          "scriptSig": {
            "asm": "",
            "hex": ""
          },
          "txinwitness": [
            "304402206751719909ab5344cb9890d51e20c47148914014c930755c5232f66f8a56ed460220521190b717305ace29bf76c9026168fca8bbc9c52d876e760cd7ffe72f0058c801",
            "038f8cede3b7d3bbe9371fbaa68be802f06b548b61d101119e40c4e873fda75412"
          ],
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 4.00000000,
          "n": 0,
          "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 789b5fae3229db03a2d172462a0675c7c2a318fb OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a914789b5fae3229db03a2d172462a0675c7c2a318fb88ac",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": [
              "mrWfWdZcyCjtWqxHmusiYVvwcBatNNKZph"
            ]
          }
        },
        {
          "value": 1.99977500,
          "n": 1,
          "scriptPubKey": {
            "asm": "0 d7011e7ae8d80d54d0381b3e3c8374f63edb4645",
            "hex": "0014d7011e7ae8d80d54d0381b3e3c8374f63edb4645",
            "reqSigs": 1,
            "type": "witness_v0_keyhash",
            "addresses": [
              "tb1q6uq3u7hgmqx4f5pcrvlreqm57cldk3j9xdq2f0"
            ]
          }
        }
      ]
    }
    
    
  2. jonasschnelli commented at 12:32 PM on March 1, 2018: contributor

    See BIP141. In transactions containing witness (SW transactions), the txid(hash) does not cover the witness (the signatures).

  3. MarcoFalke closed this on Mar 1, 2018

  4. sipa commented at 1:02 PM on March 1, 2018: member

    Hash includes the witness, txid by definition does not.

  5. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me