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.
Calculating txid for SegWit transactions with the help of RPC #15232
issue kristapsk opened this issue on January 23, 2019-
kristapsk commented at 12:17 AM on January 23, 2019: contributor
-
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). -
kristapsk commented at 12:44 AM on January 23, 2019: contributor
Ohhh, yes, you're right, somehow missed that.
- kristapsk closed this on Jan 23, 2019
- kristapsk referenced this in commit 84d4765634 on Jan 23, 2019
- MarcoFalke locked this on Dec 16, 2021