cashshuffle / cashshuffle-electron-cash-plugin

Electron cash cash-shuffle plugin
27 stars 13 forks source link

Wrong TX signature from player X... #11

Closed checksum0 closed 5 years ago

checksum0 commented 6 years ago

Plugin somehow provided a wrong signature from one of the player TX...

protocol started

start thread thread started b'\nN\nL\x1aD\nB029e8f42f557f56cc79f6bf983114f0a8c74a2ffa08cc052c262e5c7519d0f9a05:\x04\x08\xc0\x84=' b'\nb\n\n\x16dSDTAQJsI8JFpPm8uqpXHW\x10\x01\x1aD\nB029e8f42f557f56cc79f6bf983114f0a8c74a2ffa08cc052c262e5c7519d0f9a05' b'\n\x98\x02\n\xd0\x01\n\x16dSDTAQJsI8JFpPm8uqpXHW\x10\x01\x1aD\nB029e8f42f557f56cc79f6bf983114f0a8c74a2ffa08cc052c262e5c7519d0f9a05(\x012l\n$\n"16Mh8KUrN3dZ152pXaWxpCa5cWwqB6S31f\x12D\nB0236d7b303d3de8836566eb055ba658af0a8a8d45f63a663656977b512fcb5d59e\x12C\nA\x1f\x81\xbb\xa8\xb1\xbf\xa9\r\x13\xe9\re0 b\xfa\x1eQ\xb1P\xb8\x12\xd3\r\x1a\xb5,\x80\xf3\xa5KhvA_\xee\xfa\x953\xc3t\xdb\x9a\xe0\xaa\xf0\xc2\xca\xc2 \xc9xe\x1b\xdc\xbd\xael\xb9\x92\\W:g\x12' b'\n\xaa\x04\n\xe2\x03\n\x16dSDTAQJsI8JFpPm8uqpXHW\x10\x01\x1aD\nB029e8f42f557f56cc79f6bf983114f0a8c74a2ffa08cc052c262e5c7519d0f9a05"D\nB02926864a932475417ab6dbfab4212a38d80d4ab3eb4bc758ae5f249111f6a7a57(\x022\xb7\x02*\xb4\x02QklFMQP30q55jh6LTbslT4ihO/3lmpb/KlgucbeMcjpskIOO7RRg3y67bxAMa+QV2zcLpYkO41sFvTuKoH5W+n/IEyus/WQFwh12Kd+8WJjemt5Fc+p78xJjm53tY8qvOyzOh4x0sXiOo5DwCiNRuD8STQXA95okWuCk4jhXmEN/uXlNYTOUbLsv8ftn3BdBGIbHIaqePeof1B4Zoqms2A/UhAysxRwv0INi3GMjsZcID2rNYVDjzQiyw67MUtK2fpyyKut0bnnZsuxVjIvEq3G0RScQ2fG9MYtr+TJp26carE/+MA==\x12C\nA\x1fQ\xbd\xce^\x93\x9e3\xf8?\xd6.H\xd5o\xdc\xdc\xd1p]w -\x10\xee\xa0\xf7\xdc\xe7\xcf\x97E\xb1\x05\x81\x062I\xcer\xbe\xbd\xd2-\xd0z\xb0\r\xca\xfd\xeb\xa4\xf7\xb3\x83\x058\xef*\xca\xd1P25\xd6' b'\n\xcc\x01\n\x84\x01\n\x16dSDTAQJsI8JFpPm8uqpXHW\x10\x01\x1aD\nB029e8f42f557f56cc79f6bf983114f0a8c74a2ffa08cc052c262e5c7519d0f9a05(\x042 \x1a\x1e\n\x1c|%\xda%\x933>\xe0j\xe5\xcd\x82fZ\xc9\'N\xaa\xbe\xd9\xf1 T\xca\x84\x93Q\xf4wo\x00{\x14\xa5\tn\x86z\x9b:\x93\x9b\x05k\xb8\xcdvEW\x08\xc8!\xe9\xa0\x01\x9a\x1c\xf6\xaf\x11\xf1@\xf4\x95\xc0\xe5^\xf7\xab\xdc$x\x1f$\x95\xc3\x85wG' b'\n\xf6\x01\n\xae\x01\n\x16dSDTAQJsI8JFpPm8uqpXHW\x10\x01\x1aD\nB029e8f42f557f56cc79f6bf983114f0a8c74a2ffa08cc052c262e5c7519d0f9a05(\x062J2H\x08\x05\x12D\nB02ec0097a96215efaf04f4b77d1074e4cf31ef756a295e16ce330e2ae740491746\x12C\nA\x1f\x7f\xf4\x0bB\xaf\xc2\x86/\x16\xd1\xa0\xe7\xfd\x0c\xe5\xba\x11`\xad\xb2\xed\xb5\x81N\xecD\xa6\xc7\x0cK?k\x1bn\xb5\xfc\x06\xc4oS\xa3\x10\x93&\x10"\rhl\x8a\xf2\xe5\x14\xe4\xfc^\xba\xa14\xb0\xfa\xff\xd2\xdb' Exception in thread Thread-54: Traceback (most recent call last): File "C:\Users\iande\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:\Users\iande\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "D:\fresh\Electron Cash-3.0\plugins\shuffle\coin_shuffle.py", line 339, in protocol_definition raise BlameException('Wrong tx signature from player ' + str(player)) electroncash_plugins.shuffle.coin_shuffle.BlameException: Wrong tx signature from player 3
clifordsymack commented 6 years ago

It means that player 3 have a different transaction then other. How did you get it?

checksum0 commented 6 years ago

It happened between three cooperating testers all running the same version of both Electron Cash and also the plugin. I have no idea how this could happen.

clifordsymack commented 6 years ago

Can you ask em for a few question: 1) What amount was choosen? 2) What type of public keys they use (compressed or uncompressed?)

checksum0 commented 6 years ago

Will do and report ASAIK

checksum0 commented 6 years ago

In fact, we redid the shuffle by reversing the order of shuffler and it worked right after that (player 1 became 3 and vice-versa, player 2 stayed player 2).

https://bch.btc.com/72c0c7da0eeeb695db3dee5f1a8baf644b5db8bb98fb32294d064ddcc270cb30

You can see in that transaction the input that were tried and their addresses.

clifordsymack commented 6 years ago

Ok. I will review, thanks.

senescent1 commented 6 years ago

I'm able to reproduce this on my machine:

Player 1: Blame: wrong transaction signature from player 2

Player 2: Blame: wrong transaction signature from player 1

Player 3: Blame: wrong transaction signature from player 1

All three wallets were created today using Electron Cash 3.0.

senescent1 commented 6 years ago

I have some more data about the above run:

Player 1 successfully verifies his own signature, but tries four recids of Player 2 to no avail. It should be noted that no exception was caught when iterating through recids of Player 2:

Player 1 got transction signatures Verifying transaction signature of Player 1 Have txin Trying recid: 0 Verifying transaction signature of Player 2 Have txin Trying recid: 0 Trying recid: 1 Trying recid: 2 Trying recid: 3 False Blame: wrong transaction signature from player 2

On Player Two and Three:

Player 2 got transction signatures Verifying transaction signature of Player 1 Have txin Trying recid: 0 Trying recid: 1 Trying recid: 2 Exception AssertionError() Trying recid: 3 Exception AssertionError() False Blame: wrong transaction signature from player 1

Note that AssertionErrors were thrown while trying recid 2 and 3.

clifordsymack commented 6 years ago

@senescent1 thanks for your feedback. I'm writing test routines and will update repo with it soon. I used Transaction signing routine from Electrum libs. And it looks like it always assume public key of coin to be compressed. There is a problem i want to cathc and resolve first. Do you use a compressed public keys in a wallet? Can you share it?

senescent1 commented 6 years ago

Electron Cash is showing a 111 character Master Public Key. Is that what you were looking for?

clifordsymack commented 6 years ago

No just regular public key. You can find input address in addresses tab and press details in a popup menu

senescent1 commented 6 years ago

65 character public key there.

clifordsymack commented 6 years ago

This should work now