1 2017-08-07 12:43:17 <procrash> hi
 2 2017-08-07 12:43:32 <procrash> is anybody online?
 3 2017-08-07 15:41:55 <dermoth> Hi... In https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#Example there are a few tx esamples, however it does not include the txid and wtxid... what's the easiest way to get that
 4 2017-08-07 15:42:49 <dermoth> I'm using them to validate new segwit code in Bitcoin-abe
 5 2017-08-07 16:05:31 <arubi> dermoth, you can use 'decoderawtransaction' to see those.  the hash is just the hash256 of the whole transaction (like txid is today) and the txid is the hash256 of the non witness data
 6 2017-08-07 16:45:51 <dermoth> Thanks arubi... regarding serialization format are all post-segwit tx'es serialized this way, or will I see a mix? I guess either way they should be treated the same way (compute witness txid and index both), correct?
 7 2017-08-07 16:47:53 <arubi> dermoth, only transactions containing at least one segwit input will be serialized using the new format.  for non-sw txs, the hash and txid are always the same.  in a block, the generation tx might also contain a witness and will have the new format
 8 2017-08-07 17:24:30 <dermoth> great, so the input tells me if segwit serialization should be used
 9 2017-08-07 17:26:32 <arubi> well, the segwit marker and segwit flags (two bytes) are right after the tx version, so you'll kinda have to know in advance.  if transactions are being read from the chain, then it's very easy.  a 0x00 after the version means segwit.  if the tx is just being independently decoded, then it might also be just a zero input transaction (unfunded)
10 2017-08-07 17:26:32 <dermoth> and actually won't this mean I can just ignore the txhash for segwit tx.... Will there be anyone searching for segwit tx by hash? (IOW WWBD (what would Bitcoin do), eg with -txindex)
11 2017-08-07 17:27:33 <arubi> I don't think anybody is going to search for a tx by its hash, that defeats the whole purpose :)
12 2017-08-07 17:27:33 <dermoth> actually I look for 0x0001
13 2017-08-07 17:27:33 <dermoth> marker + flag
14 2017-08-07 17:28:33 <arubi> yea, but for some random transaction you decode (not from the chain or mempool), it might be an unfunded zero in , one out tx
15 2017-08-07 17:28:33 <dermoth> ok, easier for me, do txindex index by txid only (which == to hash  on no-segwit)
16 2017-08-07 17:28:33 <dermoth> s/do/so/
17 2017-08-07 17:29:34 <arubi> right, and a segwit's txid never changes by the witness changing (unlike the hash), so grabbing a segwit tx by its txid is even safer
18 2017-08-07 17:33:40 <dermoth> I parse only mempool and blockin tx... signel and all, so it's safe! (for a moment you got me worried...)
19 2017-08-07 17:33:51 <dermoth> blockchain
20 2017-08-07 17:34:55 <arubi> yep, that should be fine.  no 0 input txs :)
21 2017-08-07 17:35:48 <arubi> dermoth, a good one to try is : 0100000000010200000000000000a9514104aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000023220020aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000004104aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000017160014aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaffffffff012102000000000000160014aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0200000100010253ae00000100
22 2017-08-07 17:36:44 <arubi> if you only expect a mempool\chain tx, you should have a 2 in , one out transaction.  if you get an unfunded to one multisig output, you got it wrong :)
23 2017-08-07 17:47:52 <dermoth> thanks... I'll see. I have the bip143 example with everything pre-decoded already... and I was considering parsing https://github.com/bitcoin/bitcoin/blob/master/src/test/data/tx_valid.json too
24 2017-08-07 17:49:54 <arubi> oh for sure, mine is only supplemental to whatever's in the standard
25 2017-08-07 17:58:02 <dermoth> thanks... I'll see. I have the bip143 example with everything pre-decoded already... and I was considering parsing https://github.com/bitcoin/bitcoin/blob/master/src/test/data/tx_valid.json too
26 2017-08-07 17:58:13 <dermoth> oh I see you got this :)
27 2017-08-07 17:59:04 <dermoth> I'll probably add it to the list, thanks. so for merkle tree is it the hash or id that is used?
28 2017-08-07 18:00:04 <arubi> well there's both, hash is used for the witness commitment and txid for the block header merkle root
29 2017-08-07 18:38:51 <arubi> oh no, I don't think that's right at all
30 2017-08-07 18:39:43 <arubi> no that can't be right, dermoth, if you read this on the channel log, that was wrong ^ . the txid is used for both of these.
31 2017-08-07 18:39:55 <arubi> the coinbase txid is just treated as 0x00..00 in the commitment
32 2017-08-07 18:41:02 <arubi> oh you're here, I couldn't autocomplete you for some reason and thought you left.  sorry
33 2017-08-07 18:42:46 <arubi> got confused even though I just wrote some code to just that a few days ago :)