bitaps-com / pybtc

Python bitcoin library
GNU General Public License v3.0
86 stars 37 forks source link

tx hash vs txId #24

Closed stachlewski closed 3 years ago

stachlewski commented 3 years ago

Why hash is sometimes different than txId? For example when decoding block 481824, tx number 562. What is the purpose of "hash" here?

4tochka commented 3 years ago

Hash this is hash from transaction bytes and hash = txId for old format non segwit transactions, for segwit transaction txId is hash from transaction bytes converted to old format (remove segwit part)

4tochka commented 3 years ago

More details you can find here https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#specification