Transcript for #bitcoin-dev 2017/02/08

16:36 Drawn anybody at the elementsproject?
16:41 waxwing Drawn: there's #sidechains-dev (although you might find the same people), more likely focused on whatever you're going to ask
16:42 Chris_Stewart_5 waxwing: I think 'finding the same people' is true across every project in bitcoin sadly :(. Hopefully we can get more people to contribute!
19:11 Drawn Hey dudes - I have a problem with a mac installing the bitcoin core at the point when I want to create the autoconf. Anybody here can help me? Im on mac
19:25 doffing81 Can anyone verify that my serialized raw transactions, just before double hashing, for the complex transaction example (https://bitcoin.org/en/developer-examples#simple-raw-transaction) are correct?
19:25 doffing81 1.) 0100000002f327e86da3e66bd20e1129b1fb36d07056f0b9a117199e759396526b8f3a20780000000023210229688a74abd0d5ad3b06ddff36fa9cd8edd181d97b9489a6adc40431fb56e1d8acfffffffff0ede03d75050f20801d50358829ae02c058e8677d2cc74df51f738285013c260000000000ffffffff02f028d6dc010000001976a914ffb035781c3c69e076d48b60c3d38592e7ce06a788ac00ca9a3b000000001976a914fa5139067622fd7e1e722a05c17c2bb7d5fd6df088ac0000000001000000
19:25 doffing81 2.) 0100000002f327e86da3e66bd20e1129b1fb36d07056f0b9a117199e759396526b8f3a20780000000000fffffffff0ede03d75050f20801d50358829ae02c058e8677d2cc74df51f738285013c26000000001976a9149ba386253ea698158b6d34802bb9b550f5ce36dd88acffffffff02f028d6dc010000001976a914ffb035781c3c69e076d48b60c3d38592e7ce06a788ac00ca9a3b000000001976a914fa5139067622fd7e1e722a05c17c2bb7d5fd6df088ac0000000001000000
19:28 arubi doffing81, sure, sec.
19:29 arubi reading about the complex example, I can't remember what it's about
19:29 arubi okay, lemme check
19:31 doffing81 doh, linked to the simplt tx, and not the complex one
19:31 arubi well first I see that the order of utxo1 and utxo2 is different
19:31 arubi right I figured that :)
19:31 arubi ^^ at least for 1.
19:32 arubi and for 2. at least that's promising :)
19:32 arubi oh wait, sorry
19:33 arubi looked at the first byte only and 26->26 :) my output is.. reversed :)
19:34 arubi so doffing81, are you getting an error when signing it?
19:34 doffing81 just trying to match what core gives me
19:35 arubi in terms of what? the signature?
19:35 doffing81 yeah
19:35 arubi well, are you using rfc6979 for generating k?
19:35 doffing81 yup
19:35 arubi so what's your sighash?
19:36 arubi even better, which hash do you feed to the function that does rfc6979 for you? :)
19:36 arubi which = "what is the.."
19:37 doffing81 hmmm
19:38 doffing81 I double sha256 hash both of those separately and generate their r,s values
19:38 doffing81 ?
19:40 doffing81 then encode for the signature
19:40 arubi well doffing81 , to generate r you have to generate k. to generate k you use rfc6979 with the sha256 of 1. and 2. respectively
19:40 doffing81 right, that is what I am doing
19:41 arubi do you feed the double sha256 (hash256) of those into rfc6979, or the sha256 of them?
19:41 doffing81 double
19:41 arubi rfc6979 will hash your message
19:41 arubi so, feed the single sha256
19:41 doffing81 interesting
19:42 doffing81 I may have to look at how I have implemented things
19:43 arubi it's step 3.2.a specifically
19:43 doffing81 I was aware that rfc6979 used a single hash, but my double hash seems to work without hashing in my rfc6979 implementation for other tx's
19:44 arubi ah, that's interesting. let me try to do follow the steps here
19:46 arubi so my r for 1. is CE5DD767430D42A9DF1AC88D1BFD04A3FE4CF0CA3241C0BB143E76677528B9F7, is that what you have?
19:46 doffing81 yeah
19:46 arubi 4A47099EB4427A30869F84B5C9E3FDE32D7D0C93C9CD4C90265B86B9674E5F4D for 2.
19:47 doffing81 b14bfacb90c6a4292fd0385ef94671ff26a8f14ab7086a6c1ac1ee6d64ae0cbd for 2 :(
19:47 arubi oh I missed replacing the private key
19:47 arubi hehe, it's all very manual
19:47 arubi B14BFACB90C6A4292FD0385EF94671FF26A8F14AB7086A6C1AC1EE6D64AE0CBD
19:48 doffing81 so, correct?!
19:48 arubi well I only used your transactions
19:48 arubi I could try to make my own and see if we get different ones
19:49 arubi few minutes, I'll make some tea. what are the values core give you?
19:49 doffing81 I mean, that would be the coolest ;) But yeah, I guess I just need to make sure that I have correctly serialized
19:50 doffing81 I just use the example
19:50 doffing81 assuming that is what core would give me
19:52 doffing81 and the example don't use the scriptPubKey as placeholders, or append the sigHashType, at least not in the rawTransaction output
20:08 arubi well well
20:09 arubi at least for input 2. it says '"vout" : 1,' in the json output but then goes on with UTXO2_VOUT=0
20:12 arubi still I can't get it to sign :) their hex says it's input 0 but json output says 1.
20:13 arubi still should sign if I set the vout:0, maybe I'm messing with something in the copy+paste
20:13 doffing81 you're saying mine has a vout:1?
20:14 arubi yours has 0
20:14 arubi on both. it's their second input that shows it's vout:1 when they listunspent, but then they set it as 0 themselves
20:17 arubi oh, I'm wrong again, they have both
20:17 doffing81 yeah
20:17 doffing81 I thought they were correct
20:17 arubi that format is really hard to read through
20:17 arubi too many line breakes and it's too narrow :)
20:17 doffing81 yup
20:18 arubi anyway, it signs correctly and we have the same r values :)
20:18 arubi so, assuming the sky isn't falling, I don't have to check s :)
20:18 doffing81 lol
20:20 doffing81 but we have the same r values?
20:20 arubi yep, all set up correctly
20:21 arubi I used your 1. and 2. to generate my k values, and core signs the same transaction with the same signature
20:21 arubi so seems like we're all in agreement
20:21 doffing81 cool, thx
20:21 arubi cheers
20:22 doffing81 sounds like i'm on the right track
20:22 doffing81 Thanks a bunch arubi!
20:22 arubi try different sighash types too, it gets pretty interesting
20:22 doffing81 I'm just getting started with all this
20:22 arubi sure, trust me there's time. it all goes very slowly
20:23 doffing81 Yeah, just building my own wallet to learn
20:23 arubi nice! I'm implementing everything I can here too. I guess we're doing the same thing basically. which language?
20:23 doffing81 swift
20:24 arubi cool, never got to try it. I'm using bash and bc
20:25 doffing81 word. not much crypto functionality with swift, at least not for iOS, soooo I'm getting a crash course in a ll things Bitcoin
20:26 arubi excellent. it's very interesting imo. if you get the basics right, then pretty much everything builds on the same building blocks
20:27 doffing81 Indeed to all of the above!
20:46 arubi ;;tell doffing81 later https://gist.github.com/fivepiece/db0181148b749d13b4213e199f4ab232 cheers
20:46 gribble Error: I haven't seen doffing81, I'll let you do the telling.
20:46 arubi you blind motherf...