5
I am attempting to manually generate a signed transaction which is to be sent from my address 1GiJZtN7wjUuL4V5i7ZYYDAvFtqi5AhCDr which is bitcoincash:qzk9nxh6qpd9yt3hvv6vvun78s834f3escdhu2vdjp in the new address format. I am using an uncompressed public key in this transaction.
I have the following unsigned Bitcoin Cash transaction. How do I find its hash preimage which is the hash used in the signing of this transaction?
0100000001fb4a8e5c7ac5311f32fbe127f031134ee3e7490f3308ca19c567f78d6aa96d770000000000ffffffff0100a00700000000001976a914a8e181e0847b495df439066ca8fb36ce093692be88ac00000000
Breaking it up, it looks like this:
01000000 - nVersion
01 - num of inputs
fb4a8e5c7ac5311f32fbe127f031134ee3e7490f3308ca19c567f78d6aa96d77 - txid (little-endian)
00000000 - vout
00 - size of sigScript
ffffffff - sequence number
01 - num of outputs
00a0070000000000 - amount (hex, little-endian)
1976a914a8e181e0847b495df439066ca8fb36ce093692be88ac - scriptPubKey
00000000 - timeLock
I am attempting to consume output 0 from the transaction with txid: 776da96a8df767c519ca08330f49e7e34e1331f027e1fb321f31c57a5c8e4afb,
The scriptPubKey for that transaction's output 0 is:
1976a914ac599afa005a522e376334c6727e3c0f1aa6398688ac
The value of the received output is 0.005 BCH
The transaction I am attempting to consume can be found here: https://bch.btc.com/776da96a8df767c519ca08330f49e7e34e1331f027e1fb321f31c57a5c8e4afb And the rawtx for the transaction I want to consume is here: https://bch.btc.com/776da96a8df767c519ca08330f49e7e34e1331f027e1fb321f31c57a5c8e4afb.rawhex
Can anybody help me?
I get the "hashPrevouts" to be: "be16f25831b40c713fed6627e39aa7717170f5cdd62c765bd4882abbefdaa50e" which is sha256d("fb4a8e5c7ac5311f32fbe127f031134ee3e7490f3308ca19c567f78d6aa96d7700000000").
Who of us is right? – Thorkil Værge – 2018-02-23T09:33:42.803
1Hmm, yes, you're right. I will edit the answer – Andrew Chow – 2018-02-23T15:54:35.340
What exactly does this value of the sighash field mean? – Thorkil Værge – 2018-02-28T21:26:45.880
1Sighash indicates what data exactly is being signed. It's a type indicator. – Andrew Chow – 2018-02-28T22:14:00.513