Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Coding Enthusiast on August 06, 2018, 05:22:04 AM



Title: In need of TxID and WTxID of BIP143 transactions for UnitTesting
Post by: Coding Enthusiast on August 06, 2018, 05:22:04 AM
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


Title: Re: In need of TxID and WTxID of BIP143 transactions for UnitTesting
Post by: achow101 on August 07, 2018, 06:29:31 AM
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.


Title: Re: In need of TxID and WTxID of BIP143 transactions for UnitTesting
Post by: Coding Enthusiast on August 07, 2018, 03:49:45 PM
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?


Title: Re: In need of TxID and WTxID of BIP143 transactions for UnitTesting
Post by: amaclin1 on August 07, 2018, 04:46:38 PM
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?

https://i.imgur.com/4CbtOY2.png