When signing a transaction, before passing the data to ECDSA related function it is hashed using SHA256
x2, BIP143 refers to them as "sigHash". I was wondering if there was a way to get them for any given transaction using bitcoin core, or if they could be found among test cases.
They are very useful for testing specific part of the code instead of just testing the end result (signed transaction).
I also need help figuring out why bitcoin core can not sign the following:
signrawtransactionwithkey "0200000002aecc62c5db92bb213a0bfdfd3e15aab7367c06ce995ec30936b08b40c513b0560100000000ffffffffaecc62c5db92bb213a0bfdfd3e15aab7367c06ce995ec30936b08b40c513b0560200000000ffffffff0160e31600000000001976a91468cfed146aced22f422a68015ff8ca180761912a88acffffffff" '["_removed_base58_privatekey_"]' '[{"txid":"56b013c5408bb03609c35e99ce067c36b7aa153efdfd0b3a21bb92dbc562ccae", "vout":1, "scriptPubKey":"4104692d8520af5ac174143a928998fd9e8bd767bfd90fc1815e927bc84fdaf912e6687fe598ea324f25890abceb8d99040f70c35f8fd9e82ee206d19f963922dc16ac"}]'
I can sign the other output (vout=2) with the scriptpubkey of
2102fbbd836e18cb88f6dad65ca12dee3270b57818dd91a1cd500dd4c812ed93651cac and a different private key but this one (vout=1) which has a scriptpubkey with an uncompressed public key, fails.
The error message is:
Unable to sign input, invalid stack size (possibly missing key)
... using Bitcoin Core v0.18.0 (64-bit) testnet on Ubuntu 14.04, offline (no blockchain) and the private key is the correct one (will give the same public key)