Calculating txid for SegWit transactions with the help of RPC #15232

issue kristapsk opened this issue on January 23, 2019
  1. kristapsk commented at 12:17 AM on January 23, 2019: contributor

    With legacy non-SegWit transactions one could do (for example, in bash script), createrawtransaction, then signtransactionwith{wallet,key} and then calculate txid using SHA-256d hash of returned transaction hex string, without sending transaction to the network using sendrawtransaction. That's not possible with SegWit transactions, as returned hex string includes witness data. Would be great if we could somehow export either CTransaction::ComputeHash() via RPC or be able to get hex string of transactions without witness data too.

  2. achow101 commented at 12:36 AM on January 23, 2019: member

    Use decoderawtransaction. It gives you the txid and the hash (which are the same for non-segwit transactions).

  3. kristapsk commented at 12:44 AM on January 23, 2019: contributor

    Ohhh, yes, you're right, somehow missed that.

  4. kristapsk closed this on Jan 23, 2019

  5. kristapsk referenced this in commit 84d4765634 on Jan 23, 2019
  6. MarcoFalke locked this on Dec 16, 2021
Contributors

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-05-03 03:14 UTC

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