Transcript for #bitcoin-dev 2017/08/07

12:43 procrash hi
12:43 procrash is anybody online?
15:41 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
15:42 dermoth I'm using them to validate new segwit code in Bitcoin-abe
16:05 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
16:45 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?
16:47 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
17:24 dermoth great, so the input tells me if segwit serialization should be used
17:26 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)
17:26 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)
17:27 dermoth actually I look for 0x0001
17:27 dermoth marker + flag
17:27 arubi I don't think anybody is going to search for a tx by its hash, that defeats the whole purpose :)
17:28 dermoth ok, easier for me, do txindex index by txid only (which == to hash on no-segwit)
17:28 dermoth s/do/so/
17:28 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
17:29 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
17:33 dermoth I parse only mempool and blockin tx... signel and all, so it's safe! (for a moment you got me worried...)
17:33 dermoth blockchain
17:34 arubi yep, that should be fine. no 0 input txs :)
17:35 arubi dermoth, a good one to try is : 0100000000010200000000000000a9514104aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000023220020aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000004104aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000017160014aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaffffffff012102000000000000160014aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0200000100010253ae00000100
17:36 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 :)
17:47 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
17:49 arubi oh for sure, mine is only supplemental to whatever's in the standard
17:58 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
17:58 dermoth oh I see you got this :)
17:59 dermoth I'll probably add it to the list, thanks. so for merkle tree is it the hash or id that is used?
18:00 arubi well there's both, hash is used for the witness commitment and txid for the block header merkle root
18:38 arubi oh no, I don't think that's right at all
18:39 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.
18:39 arubi the coinbase txid is just treated as 0x00..00 in the commitment
18:41 arubi oh you're here, I couldn't autocomplete you for some reason and thought you left. sorry
18:42 arubi got confused even though I just wrote some code to just that a few days ago :)