Author

Topic: In need of TxID and WTxID of BIP143 transactions for UnitTesting (Read 213 times)

sr. member
Activity: 770
Merit: 305
For example the TxID of the first transaction in [1] above is:
Code:
e8151a2af31c368a35053ddd4bdb285a8595c769a3ad83e0fa02314a602d4609

I ended up using Electrum to get the transaction IDs. But I still don't have WTxIDs and I don't know how to get them. For instance is there any command in Bitcoin Core that I can use to get it?

legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Yes. The TXID is the nversion, txin, txout, and nlocktime fields. The wtxid is everything. Just concatenate everything together from the part where each field is broken down. The lengths are still there so you can just stick them all together.

I think you misunderstood my question!
I already know how they is calculated. I am making a library and I just want data (the two hashes) to feed my Unit Tests.
For example the TxID of the first transaction in [1] above is:
Code:
e8151a2af31c368a35053ddd4bdb285a8595c769a3ad83e0fa02314a602d4609

I ended up using Electrum to get the transaction IDs. But I still don't have WTxIDs and I don't know how to get them. For instance is there any command in Bitcoin Core that I can use to get it?
staff
Activity: 3458
Merit: 6793
Just writing some code
Yes. The TXID is the nversion, txin, txout, and nlocktime fields. The wtxid is everything. Just concatenate everything together from the part where each field is broken down. The lengths are still there so you can just stick them all together.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
There are a bunch of transactions in BIP143 [1] which are good for testing since it is broken down into parts and has the signing process included. But it lacks transaction IDs. Now I have only 1 function that doesn't have any unit tests. Also looked at Bitcoin Core's test data [2] but it doesn't seem to have all the transaction IDs.

Is there a way to get both Transaction IDs and Witness Transaction IDs for the serialized signed transaction listed in [1]?

[1] https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki
[2] https://github.com/bitcoin/bitcoin/tree/master/src/test/data
Jump to: