Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature Irregularities #7

Closed
cowholio4 opened this issue Aug 14, 2016 · 4 comments
Closed

Signature Irregularities #7

cowholio4 opened this issue Aug 14, 2016 · 4 comments

Comments

@cowholio4
Copy link

@cowholio4 cowholio4 commented Aug 14, 2016

Hello, firstly I like what you have done with vbuterin's library. It's nice that it's getting some much needed TLC.

I'm having some weird issues with the signature sometimes it works and other times it doesn't. When I see '[ALL]' in scriptSig that's when I know it's going to work. But I don't always get it. Any help would be great and if I find a fix, I'll send a pull request.

tx = mktx(ins, outs)
tx = mk_opreturn(hex_hash, tx) 
tx = sign(tx, 0, from_priv)

Here is a transaction that works:
0100000001dc4c6936943c073fca8164d8d18fdb6095ce46baff328b7e7c1230d82aaad69b010000008a473044022033f80a4c35013d5aab9d4f2763b5761188747eebb67fe15b0379f0c09b37c811022019de06d98d37da77c84bfb6f89ff2194b46a135fe8aa9677b285123b73407341014104e7919ecea9c7e9378aec49a055c532f8e0f9aea653e7c9cbe38ad2d2833a9d908f4d7bf771583f9d1e62574c42847e1aa00d506a32b9004b9b2051e3e53e2767ffffffff02803e0000000000001976a914826d9548ee793a060990bc39a01eca5521841a0988ac0000000000000000226a202c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a300000000

{u'code': 200,
 u'data': {u'statistics': {u'fee': u'0.00005600',
                           u'vins_sum': u'0.00021600',
                           u'vouts_sum': u'0.00016000'},
           u'tx': {u'locktime': 0,
                   u'size': 266,
                   u'txid': u'8cfa33f2eb56a443b10d929b818b01a3a3e3a970d526d212785a2b42b2d19cb9',
                   u'version': 1,
                   u'vin': [{u'scriptSig': {u'asm': u'3044022033f80a4c35013d5aab9d4f2763b5761188747eebb67fe15b0379f0c09b37c811022019de06d98d37da77c84bfb6f89ff2194b46a135fe8aa9677b285123b73407341[ALL] 04e7919ecea9c7e9378aec49a055c532f8e0f9aea653e7c9cbe38ad2d2833a9d908f4d7bf771583f9d1e62574c42847e1aa00d506a32b9004b9b2051e3e53e2767',
                                            u'hex': u'473044022033f80a4c35013d5aab9d4f2763b5761188747eebb67fe15b0379f0c09b37c811022019de06d98d37da77c84bfb6f89ff2194b46a135fe8aa9677b285123b73407341014104e7919ecea9c7e9378aec49a055c532f8e0f9aea653e7c9cbe38ad2d2833a9d908f4d7bf771583f9d1e62574c42847e1aa00d506a32b9004b9b2051e3e53e2767'},
                             u'sequence': 4294967295,
                             u'txid': u'9bd6aa2ad830127c7e8b32ffba46ce9560db8fd1d86481ca3f073c9436694cdc',
                             u'vout': 1}],
                   u'vout': [{u'n': 0,
                              u'scriptPubKey': {u'addresses': [u'1Cte7ugUwdPt3WWt5uxVfUu2dDnony8oqa'],
                                                u'asm': u'OP_DUP OP_HASH160 826d9548ee793a060990bc39a01eca5521841a09 OP_EQUALVERIFY OP_CHECKSIG',
                                                u'hex': u'76a914826d9548ee793a060990bc39a01eca5521841a0988ac',
                                                u'reqSigs': 1,
                                                u'type': u'pubkeyhash'},
                              u'value': 0.00016},
                             {u'n': 1,
                              u'scriptPubKey': {u'asm': u'OP_RETURN 2c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3',
                                                u'hex': u'6a202c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3',
                                                u'type': u'nulldata'},
                              u'value': 0}]}},
 u'message': u'',
 u'status': u'success'}

And here is one that doesn't:
0100000001dc4c6936943c073fca8164d8d18fdb6095ce46baff328b7e7c1230d82aaad69b010000008a4730440220da574cbdac23291faf41d5bd94ae77fe166ab7daebf1a038efa549e441af4dad02206803cadd187e6e4c80c30af06c5d7cfad327fd4d03850a539639e42dea44e8e0014104e7919ecea9c7e9378aec49a055c532f8e0f9aea653e7c9cbe38ad2d2833a9d908f4d7bf771583f9d1e62574c42847e1aa00d506a32b9004b9b2051e3e53e2767ffffffff02803e0000000000001976a914826d9548ee793a060990bc39a01eca5521841a0988ac0000000000000000226a203f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea00000000

{u'code': 200,
 u'data': {u'statistics': {u'fee': u'0.00005600',
                           u'vins_sum': u'0.00021600',
                           u'vouts_sum': u'0.00016000'},
           u'tx': {u'locktime': 0,
                   u'size': 266,
                   u'txid': u'03360c8848808714304bc14188fd2de9d40465a38dceaa153a7fcffdb5ba7a49',
                   u'version': 1,
                   u'vin': [{u'scriptSig': {u'asm': u'30440220da574cbdac23291faf41d5bd94ae77fe166ab7daebf1a038efa549e441af4dad02206803cadd187e6e4c80c30af06c5d7cfad327fd4d03850a539639e42dea44e8e001 04e7919ecea9c7e9378aec49a055c532f8e0f9aea653e7c9cbe38ad2d2833a9d908f4d7bf771583f9d1e62574c42847e1aa00d506a32b9004b9b2051e3e53e2767',
                                            u'hex': u'4730440220da574cbdac23291faf41d5bd94ae77fe166ab7daebf1a038efa549e441af4dad02206803cadd187e6e4c80c30af06c5d7cfad327fd4d03850a539639e42dea44e8e0014104e7919ecea9c7e9378aec49a055c532f8e0f9aea653e7c9cbe38ad2d2833a9d908f4d7bf771583f9d1e62574c42847e1aa00d506a32b9004b9b2051e3e53e2767'},
                             u'sequence': 4294967295,
                             u'txid': u'9bd6aa2ad830127c7e8b32ffba46ce9560db8fd1d86481ca3f073c9436694cdc',
                             u'vout': 1}],
                   u'vout': [{u'n': 0,
                              u'scriptPubKey': {u'addresses': [u'1Cte7ugUwdPt3WWt5uxVfUu2dDnony8oqa'],
                                                u'asm': u'OP_DUP OP_HASH160 826d9548ee793a060990bc39a01eca5521841a09 OP_EQUALVERIFY OP_CHECKSIG',
                                                u'hex': u'76a914826d9548ee793a060990bc39a01eca5521841a0988ac',
                                                u'reqSigs': 1,
                                                u'type': u'pubkeyhash'},
                              u'value': 0.00016},
                             {u'n': 1,
                              u'scriptPubKey': {u'asm': u'OP_RETURN 3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea',
                                                u'hex': u'6a203f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea',
                                                u'type': u'nulldata'},
                              u'value': 0}]}},
 u'message': u'',
 u'status': u'success'}
@cowholio4

This comment has been minimized.

Copy link
Author

@cowholio4 cowholio4 commented Aug 16, 2016

So I found out how to mitigate, I just have to keep changing the hash until it works. The way I'm currently doing it is by decrementing my transaction fee by one satoshi at a time. Now I need to actually fix the code. :D

@wizardofozzie

This comment has been minimized.

Copy link
Owner

@wizardofozzie wizardofozzie commented Aug 20, 2016

@cowholio4 I will look at the issue now, but can you do me a favor and sign a Tx and give me a few broken hashes and a few corresponding working hashes?
(EDIT: including private key, so a dummy Tx of course 👍)

I'm 90% certain this'll be an issue low_s (bip66) where r is XORd based on whether it is low s or not
(EDIT: which I've committed here, does this work, per chance?)

@reiven

This comment has been minimized.

Copy link

@reiven reiven commented Nov 10, 2016

@cowholio4 is this still failing? can we close this issue?

@cowholio4

This comment has been minimized.

Copy link
Author

@cowholio4 cowholio4 commented Nov 15, 2016

@wizardofozzie @reiven yeah thank you! Just synced my repo and it looks good.

@cowholio4 cowholio4 closed this Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.