pycoin icon indicating copy to clipboard operation
pycoin copied to clipboard

`tx -s` prints wrong z value for segwit transactions

Open richardkiss opened this issue 4 years ago • 3 comments

The source for this tx can be found at https://gist.github.com/richardkiss/0c7d3da47c94d1d662a3cebe0ce32bb8

tx -s 0100000001117887afe5b31d70b4cbd2c06de7907dfaa8aac08789a7ae8f4adb55580e4d1a00000000\
85483045022100c9794be4c51d2b5ca82510e456e321c1f403d7c10109c3944d76e4b574246a1b022\
05f920a39a8f32595606071539130da5e5186fdd66575247411886193625eefc901210279be667ef9d\
cbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817981976a914751e76e8199196d454941\
c45d1b3a323f1433bd688acffffffff0164000000000000001976a914751e76e8199196d454941c45d1\
b3a323f1433bd688ac0000000000f2052a0100000017a914cd7b44d0b03f2d026d1e586d7ae18903\
b0d385f687 | grep z:
      z: 0xc9aed3b525b17e85d5afb4c368086881ba3bd14e5e7e5ff2f11e22bfcb261f73 SIGHASH_ALL

The z value is actually 0x14e7ab9ca658ca76d8b8111b82dd54fcafd2178f4cd42c235f587ce1bf3ad45.

richardkiss avatar Mar 09 '20 03:03 richardkiss

Any updates on this issue?

maninder95 avatar Aug 17 '22 15:08 maninder95

@maninder95 I haven't had much time to work on this lately. Is this a blocker for you?

richardkiss avatar Sep 29 '22 17:09 richardkiss

Yes. I can't fix it on my own, my coding skills are not there yet. I would appreciate if you could address this at some point. Is there any alternative tools to calculate Z value you could recommend in the meantime?

maninder95 avatar Sep 29 '22 21:09 maninder95

tx -d performs disassembly, and it prints the correct z value, so that's a workaround for the time being.

richardkiss avatar Mar 08 '23 18:03 richardkiss

Fixed in 20ce00fb2e14a61a52ac67bc26c23fc767612da6

richardkiss avatar Mar 27 '23 01:03 richardkiss