1 2017-07-14 14:43:03 <mmgen> arubi: are you there?
 2 2017-07-14 14:43:21 <arubi> mmgen, yea
 3 2017-07-14 14:44:02 <arubi> so you wanna show the data that you're signing?
 4 2017-07-14 14:44:15 <mmgen> sure
 5 2017-07-14 14:44:53 <mmgen> 02000000000101517103aaebde01ae59971223020a8cc1b467cec9c92905d2abb63990771721dd0000000017160014fc1fa9b1449a75438f8a5f2d98cffd38c9c383a9ffffffff01d0e22c000000000017a914cb6aaea6ae5739c2801d8e622cb084636836c064870247304402203619ae3cbeabe37346469f2a7659d330f4120af3fa0edbf87e57ad811fded7c10220322f00c9d2f21cbc8368092b9c44c7468d4b8a14354e08f95a75a9c98701103a01210248c35b571c4c5b1246114df85e008b328a8e534a819e0173
 6 2017-07-14 14:44:59 <mmgen> 152a70a515655d6b00000000
 7 2017-07-14 14:46:04 <arubi> that can't be right, is that what you're hashing towards signing?
 8 2017-07-14 14:46:18 <arubi> (do you know that there's a new sighash scheme for segwit?)
 9 2017-07-14 14:47:22 <mmgen> no I didn't
10 2017-07-14 14:47:58 <mmgen> that's the already signed transaction
11 2017-07-14 14:48:17 <arubi> and what did you sign?
12 2017-07-14 14:48:37 <mmgen> that's the tx I signed.  Sending it fails
13 2017-07-14 14:49:07 <arubi> or did you use core to sign?
14 2017-07-14 14:49:19 <mmgen> yes, signed with Core
15 2017-07-14 14:49:45 <mmgen> the data is on two lines here, if you missed that
16 2017-07-14 14:50:21 <mmgen> 02000... and 152a...
17 2017-07-14 14:50:24 <arubi> I didn't, also I'm pretty sure I just sent it
18 2017-07-14 14:51:09 <arubi> https://testnet.smartbit.com.au/tx/9dc8f347be4cba49de10ec918e73c56657ee148f5ef91403937a3a954f88bd5d
19 2017-07-14 14:51:15 <mmgen> bitcoin-cli -testnet decoderawtransaction <the data I posted here>
20 2017-07-14 14:51:27 <arubi> mmgen, the transaction you signed is ok
21 2017-07-14 14:51:58 <mmgen> so why does txsend fail?
22 2017-07-14 14:52:29 <arubi> on your end, I don't know.  I just sent it from my node and it didn't complain
23 2017-07-14 14:54:12 <arubi> huh, maybe I got confused and relayed the one I signed locally
24 2017-07-14 14:55:13 <arubi> not sure.  anyway, if you used core to sign it, can you show the json you used as input for prevtx?
25 2017-07-14 14:56:14 <arubi> anyway, I don't think I relayed my own test.  pretty sure I used yours
26 2017-07-14 14:58:19 <mmgen> you could try resending it
27 2017-07-14 14:59:17 <arubi> what do you mean?  relay the same thing?  how will it help?
28 2017-07-14 15:00:01 <mmgen> now it's working for me too.
29 2017-07-14 15:00:21 <mmgen> I just relayed it again. It worked
30 2017-07-14 15:01:05 <mmgen> No error this time.
31 2017-07-14 15:01:19 <arubi> awesome
32 2017-07-14 15:02:20 <arubi> maybe just a copy paste issue the previous time.  happens a lot for me
33 2017-07-14 15:09:26 <mmgen> arubi: oops, I sent you the wrong data. Here's the failed signed tx:
34 2017-07-14 15:09:31 <mmgen> 020000000001015dbd884f953a7a930314f95e8f14ee5766c5738e91ec10de49ba4cbe47f3c89d00000000171600148d4f3ba7746c8bf8b920176a346bd06acb9466b0ffffffff0159da2c000000000017a914cb6aaea6ae5739c2801d8e622cb084636836c064870247304402205d09c1c1ab755d1395f6e93f18178a1e65f581c1904f03125d8d3234f355317b02200d04e1099d5e8e51d6417cd2cf9c5fa792a5af7fa3876ed573bb46c235faa529012102421e545e7d38e10cafbf23fc5cbf6a68629f523d4bc8d8d6
35 2017-07-14 15:09:36 <mmgen> 941d7cf6d2aaa88d00000000
36 2017-07-14 15:10:32 <arubi> that's redeeming a different input
37 2017-07-14 15:10:40 <mmgen> sendrawtransaction fails with error code: -26
38 2017-07-14 15:10:44 <mmgen> I know
39 2017-07-14 15:11:30 <arubi> okay, can you show what it is that you're sining?
40 2017-07-14 15:11:30 <arubi> signing*
41 2017-07-14 15:11:35 <arubi> I mean, the `signrawtransaction` command
42 2017-07-14 15:13:05 <mmgen> the unsigned hex? wait a sec
43 2017-07-14 15:14:32 <arubi> the unsigned hex, the prevtx json, the privkey json
44 2017-07-14 15:15:47 <mmgen> 02000000015dbd884f953a7a930314f95e8f14ee5766c5738e91ec10de49ba4cbe47f3c89d0000000000ffffffff0159da2c000000000017a914cb6aaea6ae5739c2801d8e622cb084636836c0648700000000
45 2017-07-14 15:17:46 <mmgen> Did you try just sending the signed data?
46 2017-07-14 15:18:45 <mmgen> Your previous send worked, whereas mine didn't
47 2017-07-14 15:18:57 <arubi> no.  the private key you shared before is not correct for this tx
48 2017-07-14 15:19:08 <mmgen> I know
49 2017-07-14 15:19:39 <mmgen> here: cUHonksjUUSEkmACwdbhQ2YguRrprL5ujYDyALvjK5Xtv16Qm546
50 2017-07-14 15:19:53 <arubi> and what's the json that you used for prevtx?
51 2017-07-14 15:20:57 <arubi> mmgen, It'd be a lot easier for me if you just lay out the data as you used it
52 2017-07-14 15:21:39 <arubi> so, when you ran bitcoin-cli -testnet signrawtransaction ... , what did you input?
53 2017-07-14 15:22:11 <mmgen> I'm not working at the cmdline but inside a script.  Wait a sec
54 2017-07-14 15:23:43 <arubi> still the commands are the same if you're using core
55 2017-07-14 15:26:33 <mmgen> Here's what I passed to signrawtransaction, besides the key and hex:
56 2017-07-14 15:26:44 <mmgen> {   'redeemScript': '00148d4f3ba7746c8bf8b920176a346bd06acb9466b0',
57 2017-07-14 15:26:45 <mmgen> 'scriptPubKey': u'a914cb6aaea6ae5739c2801d8e622cb084636836c06487',
58 2017-07-14 15:26:45 <mmgen> 'txid': u'9dc8f347be4cba49de10ec918e73c56657ee148f5ef91403937a3a954f88bd5d',
59 2017-07-14 15:26:47 <mmgen> 'vout': 0}
60 2017-07-14 15:27:25 <mmgen> The key and hex are the ones above
61 2017-07-14 15:28:41 <mmgen> I'm not passing a sighashtype
62 2017-07-14 15:31:49 <arubi> 020000000001015dbd884f953a7a930314f95e8f14ee5766c5738e91ec10de49ba4cbe47f3c89d00000000171600148d4f3ba7746c8bf8b920176a346bd06acb9466b0ffffffff0159da2c000000000017a914cb6aaea6ae5739c2801d8e622cb084636836c0648702483045022100f068f4da1d33c29412b34e3294a7c218cd7439eb04a4a920b0fcacf8f74fea740220774e2d6bd83b4f7685fe2c39b2ba63d1d3bf581d5ce1c1ecde968b83d90d7855012102421e545e7d38e10cafbf23fc5cbf6a68629f523d4bc8d8d6941d7cf6d2aaa88d00000000
63 2017-07-14 15:31:49 <arubi> this is what I'm getting:
64 2017-07-14 15:32:50 <arubi> ","amount":0.02941648}]' '["cUHonksjUUSEkmACwdbhQ2YguRrprL5ujYDyALvjK5Xtv16Qm546"]'`
65 2017-07-14 15:32:50 <arubi> redeemed in c9640421ed7d95a1c1b8e72df0320a6b8c5aee7354c3995dddaa4a498b7f652e
66 2017-07-14 15:32:50 <arubi> using: `bitcoin-cli -testnet signrawtransaction "$(bitcoin-cli -testnet createrawtransaction '[{"txid":"9dc8f347be4cba49de10ec918e73c56657ee148f5ef91403937a3a954f88bd5d","vout":0}]' '{"2NBnnxdthfqdhm3KoiWkQ3Q9h8gmDie373X":0.02939481}')" '[{"txid":"9dc8f347be4cba49de10ec918e73c56657ee148f5ef91403937a3a954f88bd5d","vout":0,"scriptPubKey":"A914CB6AAEA6AE5739C2801D8E622CB084636836C06487","redeemScript":"00148D4F3BA7746C8BF8B920176A346BD06ACB9466B0
67 2017-07-14 15:33:51 <arubi> maybe you're not passing an amount, or passing the wrong amount for signing.  not sure, the output is kinda broken
68 2017-07-14 15:34:08 <mmgen> your data differs from mine. It's two bytes longer
69 2017-07-14 15:38:39 <mmgen> arubi: That's it. The amount is missing
70 2017-07-14 15:39:58 <mmgen> I just forgot it
71 2017-07-14 15:48:39 <mmgen> arubi: Success! 5bb5937b610f9b3efda431af74bf75bc4b0671c0fdd512fa3886a5b4a53d56ea
72 2017-07-14 15:49:08 <mmgen> Oh those stupid errors...
73 2017-07-14 15:49:40 <mmgen> arubi: can't thank you enough for your help
74 2017-07-14 15:52:29 <To7> General dev, time to protect bitcoin !
75 2017-07-14 15:52:30 <To7> I need help spreading the word on this: https://medium.com/bitcoinfoundation/the-foul-smell-of-federal-cryptocurrency-legislation-bd0a58995b60
76 2017-07-14 15:52:30 <To7> Instructions are here: https://www.reddit.com/r/Bitcoin/comments/6n9lah/anyone_knows_how_to_get_hold_of_the_other_cryptos
77 2017-07-14 15:59:16 <arubi> mmgen, cheers :)
78 2017-07-14 15:59:35 <mmgen> arubi: :)
79 2017-07-14 16:00:42 <mmgen> arubi: https://github.com/mmgen/mmgen
80 2017-07-14 16:01:02 <mmgen> Segwit support coming soon
81 2017-07-14 16:02:20 <arubi> awesome.  just in time