How to get final transaction hash based on skeleton and privateKey?

How to get final transaction hash based on skeleton and privateKey?

I use https://www.blockcypher.com/ to create BTC transaction. I have to

  1. hit them to get tx skeleton,

  2. sign it (I do have private key)

  3. hit them again (submit tx into network)

How can I get a final tx hash after step 2)?

I guess, I have all needed data.

Some internals (https://www.blockcypher.com/dev/bitcoin/?shell#creating-transactions): after step 1) I have

"hash": "b683602a699f116ea657a2ae92af9c8e0e17a8370af74546c1db01b93aaeaac0",
"tosign_tx": [ "010000000131c7d74ed143c63a2d904f092486241456dd6eafdd3a48cb97bbd5b335568b12010000001976a9143be3c7715d36cea2398cd154e39b6b2ecbe67ee588acffffffff0240420f00000000001976a914f395247d6151b3f86049bb87aeb33da61e64992088ac148ae800000000001976a9143be3c7715d36cea2398cd154e39b6b2ecbe67ee588ac0000000001000000" ], "tosign": [ "0117c8ee1371d334f095110991f07fc5ecaeb6f52702782a1d8f2422d395ec68" ]

This hash is not real one (it's not signed yet).

tosign_tx is array of hex (number of elements corresponds amount of input txs). I can deserialise it into transaction

tx1: Transaction =
2c1444ce2c7f19ec8ca69e234f0eae3c17244b6f5d6aa4851dda7ae2a749030b in DUP HASH160 PUSHDATA(20)[3be3c7715d36cea2398cd154e39b6b2ecbe67ee5] EQUALVERIFY CHECKSIG outpoint:128b5635b3d5bb97cb483addaf6edd5614248624094f902d3ac643d14ed7c731:1 out DUP HASH160 PUSHDATA(20)[f395247d6151b3f86049bb87aeb33da61e649920] EQUALVERIFY CHECKSIG 0.01 BTC out DUP HASH160 PUSHDATA(20)[3be3c7715d36cea2398cd154e39b6b2ecbe67ee5] EQUALVERIFY CHECKSIG 0.152397 BTC prps UNKNOWN

Any code is very appreciated (java/bitcoinj/whatever).

https://ift.tt/2mULRpR

Comments

Popular posts from this blog

bitcoin node: what is the difference between simnet and regtest?

How to check if Electrum is masking my IP with the Tor proxy?

Need help to recover blpckchain.info wallet, my wife forgot her password and the brute force with btcrecover is not catching the password